@react-native-community/template 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template/Gemfile +3 -4
- package/template/__tests__/App.test.tsx +5 -3
- package/template/android/app/build.gradle +8 -8
- package/template/android/app/src/main/AndroidManifest.xml +2 -1
- package/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/template/android/gradle.properties +1 -1
- package/template/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
- package/template/ios/Podfile +2 -2
- package/template/package.json +6 -7
- package/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java +0 -75
- package/template/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.kt +0 -54
- package/template/android/app/src/main/java/com/helloworld/MainActivity.java +0 -32
- package/template/android/app/src/main/java/com/helloworld/MainApplication.java +0 -62
- package/template/android/app/src/release/java/com/helloworld/ReactNativeFlipper.java +0 -20
- package/template/android/app/src/release/java/com/helloworld/ReactNativeFlipper.kt +0 -15
- package/template/android/gradle-wrapper.jar +0 -0
- package/template/android/gradle-wrapper.properties +0 -7
- package/template/template/App.tsx +0 -118
- package/template/template/Gemfile +0 -8
- package/template/template/README.md +0 -79
- package/template/template/__tests__/App.test.tsx +0 -17
- package/template/template/_bundle/config +0 -2
- package/template/template/_eslintrc.js +0 -4
- package/template/template/_gitignore +0 -74
- package/template/template/_prettierrc.js +0 -7
- package/template/template/_watchmanconfig +0 -1
- package/template/template/android/app/build.gradle +0 -118
- package/template/template/android/app/debug.keystore +0 -0
- package/template/template/android/app/proguard-rules.pro +0 -10
- package/template/template/android/app/src/debug/AndroidManifest.xml +0 -9
- package/template/template/android/app/src/main/AndroidManifest.xml +0 -26
- package/template/template/android/app/src/main/java/com/helloworld/MainActivity.kt +0 -22
- package/template/template/android/app/src/main/java/com/helloworld/MainApplication.kt +0 -43
- package/template/template/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
- package/template/template/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/template/template/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/template/template/android/app/src/main/res/values/strings.xml +0 -3
- package/template/template/android/app/src/main/res/values/styles.xml +0 -9
- package/template/template/android/build.gradle +0 -21
- package/template/template/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/template/template/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/template/template/android/gradle.properties +0 -41
- package/template/template/android/gradlew +0 -249
- package/template/template/android/gradlew.bat +0 -92
- package/template/template/android/settings.gradle +0 -4
- package/template/template/app.json +0 -4
- package/template/template/babel.config.js +0 -3
- package/template/template/index.js +0 -9
- package/template/template/ios/HelloWorld/AppDelegate.h +0 -6
- package/template/template/ios/HelloWorld/AppDelegate.mm +0 -31
- package/template/template/ios/HelloWorld/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/template/template/ios/HelloWorld/Images.xcassets/Contents.json +0 -6
- package/template/template/ios/HelloWorld/Info.plist +0 -52
- package/template/template/ios/HelloWorld/LaunchScreen.storyboard +0 -47
- package/template/template/ios/HelloWorld/main.m +0 -10
- package/template/template/ios/HelloWorld.xcodeproj/project.pbxproj +0 -688
- package/template/template/ios/HelloWorld.xcodeproj/xcshareddata/xcschemes/HelloWorld.xcscheme +0 -88
- package/template/template/ios/HelloWorldTests/HelloWorldTests.m +0 -66
- package/template/template/ios/HelloWorldTests/Info.plist +0 -24
- package/template/template/ios/Podfile +0 -40
- package/template/template/ios/_xcode.env +0 -11
- package/template/template/jest.config.js +0 -3
- package/template/template/metro.config.js +0 -11
- package/template/template/package.json +0 -36
- package/template/template/tsconfig.json +0 -3
- /package/template/{template/ios → ios}/HelloWorld/PrivacyInfo.xcprivacy +0 -0
package/package.json
CHANGED
package/template/Gemfile
CHANGED
|
@@ -3,7 +3,6 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
4
|
ruby ">= 2.6.10"
|
|
5
5
|
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
gem '
|
|
9
|
-
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'
|
|
6
|
+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
@@ -10,8 +10,10 @@ import App from '../App';
|
|
|
10
10
|
import {it} from '@jest/globals';
|
|
11
11
|
|
|
12
12
|
// Note: test renderer must be required after react-native.
|
|
13
|
-
import
|
|
13
|
+
import ReactTestRenderer from 'react-test-renderer';
|
|
14
14
|
|
|
15
|
-
it('renders correctly', () => {
|
|
16
|
-
|
|
15
|
+
it('renders correctly', async () => {
|
|
16
|
+
await ReactTestRenderer.act(() => {
|
|
17
|
+
ReactTestRenderer.create(<App />);
|
|
18
|
+
});
|
|
17
19
|
});
|
|
@@ -8,14 +8,14 @@ apply plugin: "com.facebook.react"
|
|
|
8
8
|
*/
|
|
9
9
|
react {
|
|
10
10
|
/* Folders */
|
|
11
|
-
// The root of your project, i.e. where "package.json" lives. Default is '
|
|
12
|
-
// root = file("
|
|
13
|
-
// The folder where the react-native NPM package is. Default is
|
|
14
|
-
// reactNativeDir = file("
|
|
15
|
-
// The folder where the react-native Codegen package is. Default is
|
|
16
|
-
// codegenDir = file("
|
|
17
|
-
// The cli.js file which is the React Native CLI entrypoint. Default is
|
|
18
|
-
// cliFile = file("
|
|
11
|
+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
|
|
12
|
+
// root = file("../../")
|
|
13
|
+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
|
|
14
|
+
// reactNativeDir = file("../../node_modules/react-native")
|
|
15
|
+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
|
|
16
|
+
// codegenDir = file("../../node_modules/@react-native/codegen")
|
|
17
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
|
|
18
|
+
// cliFile = file("../../node_modules/react-native/cli.js")
|
|
19
19
|
|
|
20
20
|
/* Variants */
|
|
21
21
|
// The list of variants to that are debuggable. For those we're going to
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
android:icon="@mipmap/ic_launcher"
|
|
9
9
|
android:roundIcon="@mipmap/ic_launcher_round"
|
|
10
10
|
android:allowBackup="false"
|
|
11
|
-
android:theme="@style/AppTheme"
|
|
11
|
+
android:theme="@style/AppTheme"
|
|
12
|
+
android:supportsRtl="true">
|
|
12
13
|
<activity
|
|
13
14
|
android:name=".MainActivity"
|
|
14
15
|
android:label="@string/app_name"
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
validateDistributionUrl=true
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
|
@@ -32,7 +32,7 @@ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
|
|
|
32
32
|
# your application. You should enable this flag either if you want
|
|
33
33
|
# to write custom TurboModules/Fabric components OR use libraries that
|
|
34
34
|
# are providing them.
|
|
35
|
-
newArchEnabled=
|
|
35
|
+
newArchEnabled=false
|
|
36
36
|
|
|
37
37
|
# Use this property to enable or disable the Hermes JS engine.
|
|
38
38
|
# If set to false, you will be using JSC instead.
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = HelloWorld/Images.xcassets; sourceTree = "<group>"; };
|
|
37
37
|
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = HelloWorld/Info.plist; sourceTree = "<group>"; };
|
|
38
38
|
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = HelloWorld/main.m; sourceTree = "<group>"; };
|
|
39
|
+
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = HelloWorld/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
|
|
39
40
|
19F6CBCC0A4E27FBF8BF4A61 /* libPods-HelloWorld-HelloWorldTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-HelloWorld-HelloWorldTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
40
41
|
3B4392A12AC88292D35C810B /* Pods-HelloWorld.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.debug.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.debug.xcconfig"; sourceTree = "<group>"; };
|
|
41
42
|
5709B34CF0A7D63546082F79 /* Pods-HelloWorld.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HelloWorld.release.xcconfig"; path = "Target Support Files/Pods-HelloWorld/Pods-HelloWorld.release.xcconfig"; sourceTree = "<group>"; };
|
|
@@ -92,6 +93,7 @@
|
|
|
92
93
|
13B07FB61A68108700A75B9A /* Info.plist */,
|
|
93
94
|
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
|
|
94
95
|
13B07FB71A68108700A75B9A /* main.m */,
|
|
96
|
+
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
|
|
95
97
|
);
|
|
96
98
|
name = HelloWorld;
|
|
97
99
|
sourceTree = "<group>";
|
package/template/ios/Podfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Resolve react_native_pods.rb with node to allow for hoisting
|
|
2
2
|
require Pod::Executable.execute_command('node', ['-p',
|
|
3
3
|
'require.resolve(
|
|
4
|
-
|
|
4
|
+
"react-native/scripts/react_native_pods.rb",
|
|
5
5
|
{paths: [process.argv[1]]},
|
|
6
6
|
)', __dir__]).strip
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ if linkage != nil
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
target 'HelloWorld' do
|
|
18
|
-
config =
|
|
18
|
+
config = use_native_modules!
|
|
19
19
|
|
|
20
20
|
use_react_native!(
|
|
21
21
|
:path => config[:reactNativePath],
|
package/template/package.json
CHANGED
|
@@ -10,25 +10,24 @@
|
|
|
10
10
|
"test": "jest"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"react": "
|
|
13
|
+
"react": "19.0.0-rc-fb9a90fa48-20240614",
|
|
14
14
|
"react-native": "1000.0.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@babel/core": "^7.20.0",
|
|
18
18
|
"@babel/preset-env": "^7.20.0",
|
|
19
19
|
"@babel/runtime": "^7.20.0",
|
|
20
|
-
"@react-native/babel-preset": "0.
|
|
21
|
-
"@react-native/eslint-config": "0.
|
|
22
|
-
"@react-native/metro-config": "0.
|
|
23
|
-
"@react-native/typescript-config": "0.
|
|
24
|
-
"@react-native-community/cli": "latest",
|
|
20
|
+
"@react-native/babel-preset": "0.75.0-main",
|
|
21
|
+
"@react-native/eslint-config": "0.75.0-main",
|
|
22
|
+
"@react-native/metro-config": "0.75.0-main",
|
|
23
|
+
"@react-native/typescript-config": "0.75.0-main",
|
|
25
24
|
"@types/react": "^18.2.6",
|
|
26
25
|
"@types/react-test-renderer": "^18.0.0",
|
|
27
26
|
"babel-jest": "^29.6.3",
|
|
28
27
|
"eslint": "^8.19.0",
|
|
29
28
|
"jest": "^29.6.3",
|
|
30
29
|
"prettier": "2.8.8",
|
|
31
|
-
"react-test-renderer": "
|
|
30
|
+
"react-test-renderer": "19.0.0-rc-fb9a90fa48-20240614",
|
|
32
31
|
"typescript": "5.0.4"
|
|
33
32
|
},
|
|
34
33
|
"engines": {
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
|
5
|
-
* directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
package com.helloworld;
|
|
8
|
-
|
|
9
|
-
import android.content.Context;
|
|
10
|
-
import com.facebook.flipper.android.AndroidFlipperClient;
|
|
11
|
-
import com.facebook.flipper.android.utils.FlipperUtils;
|
|
12
|
-
import com.facebook.flipper.core.FlipperClient;
|
|
13
|
-
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin;
|
|
14
|
-
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin;
|
|
15
|
-
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin;
|
|
16
|
-
import com.facebook.flipper.plugins.inspector.DescriptorMapping;
|
|
17
|
-
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
|
|
18
|
-
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
|
|
19
|
-
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
|
|
20
|
-
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
|
|
21
|
-
import com.facebook.react.ReactInstanceEventListener;
|
|
22
|
-
import com.facebook.react.ReactInstanceManager;
|
|
23
|
-
import com.facebook.react.bridge.ReactContext;
|
|
24
|
-
import com.facebook.react.modules.network.NetworkingModule;
|
|
25
|
-
import okhttp3.OkHttpClient;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Class responsible of loading Flipper inside your React Native application. This is the debug
|
|
29
|
-
* flavor of it. Here you can add your own plugins and customize the Flipper setup.
|
|
30
|
-
*/
|
|
31
|
-
public class ReactNativeFlipper {
|
|
32
|
-
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
|
|
33
|
-
if (FlipperUtils.shouldEnableFlipper(context)) {
|
|
34
|
-
final FlipperClient client = AndroidFlipperClient.getInstance(context);
|
|
35
|
-
|
|
36
|
-
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
|
|
37
|
-
client.addPlugin(new DatabasesFlipperPlugin(context));
|
|
38
|
-
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
|
|
39
|
-
client.addPlugin(CrashReporterPlugin.getInstance());
|
|
40
|
-
|
|
41
|
-
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
|
|
42
|
-
NetworkingModule.setCustomClientBuilder(
|
|
43
|
-
new NetworkingModule.CustomClientBuilder() {
|
|
44
|
-
@Override
|
|
45
|
-
public void apply(OkHttpClient.Builder builder) {
|
|
46
|
-
builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
client.addPlugin(networkFlipperPlugin);
|
|
50
|
-
client.start();
|
|
51
|
-
|
|
52
|
-
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
|
|
53
|
-
// Hence we run if after all native modules have been initialized
|
|
54
|
-
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
|
|
55
|
-
if (reactContext == null) {
|
|
56
|
-
reactInstanceManager.addReactInstanceEventListener(
|
|
57
|
-
new ReactInstanceEventListener() {
|
|
58
|
-
@Override
|
|
59
|
-
public void onReactContextInitialized(ReactContext reactContext) {
|
|
60
|
-
reactInstanceManager.removeReactInstanceEventListener(this);
|
|
61
|
-
reactContext.runOnNativeModulesQueueThread(
|
|
62
|
-
new Runnable() {
|
|
63
|
-
@Override
|
|
64
|
-
public void run() {
|
|
65
|
-
client.addPlugin(new FrescoFlipperPlugin());
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
} else {
|
|
71
|
-
client.addPlugin(new FrescoFlipperPlugin());
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
package com.helloworld
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import com.facebook.flipper.android.AndroidFlipperClient
|
|
5
|
-
import com.facebook.flipper.android.utils.FlipperUtils
|
|
6
|
-
import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin
|
|
7
|
-
import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin
|
|
8
|
-
import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin
|
|
9
|
-
import com.facebook.flipper.plugins.inspector.DescriptorMapping
|
|
10
|
-
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin
|
|
11
|
-
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor
|
|
12
|
-
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin
|
|
13
|
-
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin
|
|
14
|
-
import com.facebook.react.ReactInstanceEventListener
|
|
15
|
-
import com.facebook.react.ReactInstanceManager
|
|
16
|
-
import com.facebook.react.bridge.ReactContext
|
|
17
|
-
import com.facebook.react.modules.network.NetworkingModule
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Class responsible of loading Flipper inside your React Native application. This is the debug
|
|
21
|
-
* flavor of it. Here you can add your own plugins and customize the Flipper setup.
|
|
22
|
-
*/
|
|
23
|
-
object ReactNativeFlipper {
|
|
24
|
-
fun initializeFlipper(context: Context, reactInstanceManager: ReactInstanceManager) {
|
|
25
|
-
if (FlipperUtils.shouldEnableFlipper(context)) {
|
|
26
|
-
val client = AndroidFlipperClient.getInstance(context)
|
|
27
|
-
client.addPlugin(InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()))
|
|
28
|
-
client.addPlugin(DatabasesFlipperPlugin(context))
|
|
29
|
-
client.addPlugin(SharedPreferencesFlipperPlugin(context))
|
|
30
|
-
client.addPlugin(CrashReporterPlugin.getInstance())
|
|
31
|
-
val networkFlipperPlugin = NetworkFlipperPlugin()
|
|
32
|
-
NetworkingModule.setCustomClientBuilder { builder ->
|
|
33
|
-
builder.addNetworkInterceptor(FlipperOkhttpInterceptor(networkFlipperPlugin))
|
|
34
|
-
}
|
|
35
|
-
client.addPlugin(networkFlipperPlugin)
|
|
36
|
-
client.start()
|
|
37
|
-
|
|
38
|
-
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
|
|
39
|
-
// Hence we run if after all native modules have been initialized
|
|
40
|
-
val currentReactContext = reactInstanceManager.currentReactContext
|
|
41
|
-
if (currentReactContext == null) {
|
|
42
|
-
reactInstanceManager.addReactInstanceEventListener(
|
|
43
|
-
object : ReactInstanceEventListener {
|
|
44
|
-
override fun onReactContextInitialized(context: ReactContext) {
|
|
45
|
-
reactInstanceManager.removeReactInstanceEventListener(this)
|
|
46
|
-
context.runOnNativeModulesQueueThread { client.addPlugin(FrescoFlipperPlugin()) }
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
} else {
|
|
50
|
-
client.addPlugin(FrescoFlipperPlugin())
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
package com.helloworld;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.ReactActivity;
|
|
4
|
-
import com.facebook.react.ReactActivityDelegate;
|
|
5
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
|
6
|
-
import com.facebook.react.defaults.DefaultReactActivityDelegate;
|
|
7
|
-
|
|
8
|
-
public class MainActivity extends ReactActivity {
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns the name of the main component registered from JavaScript. This is used to schedule
|
|
12
|
-
* rendering of the component.
|
|
13
|
-
*/
|
|
14
|
-
@Override
|
|
15
|
-
protected String getMainComponentName() {
|
|
16
|
-
return "HelloWorld";
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
|
|
21
|
-
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
|
|
22
|
-
* (aka React 18) with two boolean flags.
|
|
23
|
-
*/
|
|
24
|
-
@Override
|
|
25
|
-
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
26
|
-
return new DefaultReactActivityDelegate(
|
|
27
|
-
this,
|
|
28
|
-
getMainComponentName(),
|
|
29
|
-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
30
|
-
DefaultNewArchitectureEntryPoint.getFabricEnabled());
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
package com.helloworld;
|
|
2
|
-
|
|
3
|
-
import android.app.Application;
|
|
4
|
-
import com.facebook.react.PackageList;
|
|
5
|
-
import com.facebook.react.ReactApplication;
|
|
6
|
-
import com.facebook.react.ReactNativeHost;
|
|
7
|
-
import com.facebook.react.ReactPackage;
|
|
8
|
-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
|
9
|
-
import com.facebook.react.defaults.DefaultReactNativeHost;
|
|
10
|
-
import com.facebook.soloader.SoLoader;
|
|
11
|
-
import java.util.List;
|
|
12
|
-
|
|
13
|
-
public class MainApplication extends Application implements ReactApplication {
|
|
14
|
-
|
|
15
|
-
private final ReactNativeHost mReactNativeHost =
|
|
16
|
-
new DefaultReactNativeHost(this) {
|
|
17
|
-
@Override
|
|
18
|
-
public boolean getUseDeveloperSupport() {
|
|
19
|
-
return BuildConfig.DEBUG;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Override
|
|
23
|
-
protected List<ReactPackage> getPackages() {
|
|
24
|
-
@SuppressWarnings("UnnecessaryLocalVariable")
|
|
25
|
-
List<ReactPackage> packages = new PackageList(this).getPackages();
|
|
26
|
-
// Packages that cannot be autolinked yet can be added manually here, for example:
|
|
27
|
-
// packages.add(new MyReactNativePackage());
|
|
28
|
-
return packages;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Override
|
|
32
|
-
protected String getJSMainModuleName() {
|
|
33
|
-
return "index";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Override
|
|
37
|
-
protected boolean isNewArchEnabled() {
|
|
38
|
-
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Override
|
|
42
|
-
protected Boolean isHermesEnabled() {
|
|
43
|
-
return BuildConfig.IS_HERMES_ENABLED;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
@Override
|
|
48
|
-
public ReactNativeHost getReactNativeHost() {
|
|
49
|
-
return mReactNativeHost;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@Override
|
|
53
|
-
public void onCreate() {
|
|
54
|
-
super.onCreate();
|
|
55
|
-
SoLoader.init(this, /* native exopackage */ false);
|
|
56
|
-
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
|
|
57
|
-
// If you opted-in for the New Architecture, we load the native entry point for this app.
|
|
58
|
-
DefaultNewArchitectureEntryPoint.load();
|
|
59
|
-
}
|
|
60
|
-
ReactNativeFlipper.initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
|
5
|
-
* directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
package com.helloworld;
|
|
8
|
-
|
|
9
|
-
import android.content.Context;
|
|
10
|
-
import com.facebook.react.ReactInstanceManager;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Class responsible of loading Flipper inside your React Native application. This is the release
|
|
14
|
-
* flavor of it so it's empty as we don't want to load Flipper.
|
|
15
|
-
*/
|
|
16
|
-
public class ReactNativeFlipper {
|
|
17
|
-
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
|
|
18
|
-
// Do nothing as we don't want to initialize Flipper on Release.
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
package com.helloworld
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import com.facebook.react.ReactInstanceManager
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Class responsible of loading Flipper inside your React Native application. This is the release
|
|
8
|
-
* flavor of it so it's empty as we don't want to load Flipper.
|
|
9
|
-
*/
|
|
10
|
-
object ReactNativeFlipper {
|
|
11
|
-
@Suppress("UNUSED_PARAMETER")
|
|
12
|
-
fun initializeFlipper(context: Context, reactInstanceManager: ReactInstanceManager) {
|
|
13
|
-
// Do nothing as we don't want to initialize Flipper on Release.
|
|
14
|
-
}
|
|
15
|
-
}
|
|
Binary file
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sample React Native App
|
|
3
|
-
* https://github.com/facebook/react-native
|
|
4
|
-
*
|
|
5
|
-
* @format
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React from 'react';
|
|
9
|
-
import type {PropsWithChildren} from 'react';
|
|
10
|
-
import {
|
|
11
|
-
SafeAreaView,
|
|
12
|
-
ScrollView,
|
|
13
|
-
StatusBar,
|
|
14
|
-
StyleSheet,
|
|
15
|
-
Text,
|
|
16
|
-
useColorScheme,
|
|
17
|
-
View,
|
|
18
|
-
} from 'react-native';
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
Colors,
|
|
22
|
-
DebugInstructions,
|
|
23
|
-
Header,
|
|
24
|
-
LearnMoreLinks,
|
|
25
|
-
ReloadInstructions,
|
|
26
|
-
} from 'react-native/Libraries/NewAppScreen';
|
|
27
|
-
|
|
28
|
-
type SectionProps = PropsWithChildren<{
|
|
29
|
-
title: string;
|
|
30
|
-
}>;
|
|
31
|
-
|
|
32
|
-
function Section({children, title}: SectionProps): React.JSX.Element {
|
|
33
|
-
const isDarkMode = useColorScheme() === 'dark';
|
|
34
|
-
return (
|
|
35
|
-
<View style={styles.sectionContainer}>
|
|
36
|
-
<Text
|
|
37
|
-
style={[
|
|
38
|
-
styles.sectionTitle,
|
|
39
|
-
{
|
|
40
|
-
color: isDarkMode ? Colors.white : Colors.black,
|
|
41
|
-
},
|
|
42
|
-
]}>
|
|
43
|
-
{title}
|
|
44
|
-
</Text>
|
|
45
|
-
<Text
|
|
46
|
-
style={[
|
|
47
|
-
styles.sectionDescription,
|
|
48
|
-
{
|
|
49
|
-
color: isDarkMode ? Colors.light : Colors.dark,
|
|
50
|
-
},
|
|
51
|
-
]}>
|
|
52
|
-
{children}
|
|
53
|
-
</Text>
|
|
54
|
-
</View>
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function App(): React.JSX.Element {
|
|
59
|
-
const isDarkMode = useColorScheme() === 'dark';
|
|
60
|
-
|
|
61
|
-
const backgroundStyle = {
|
|
62
|
-
backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<SafeAreaView style={backgroundStyle}>
|
|
67
|
-
<StatusBar
|
|
68
|
-
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
|
|
69
|
-
backgroundColor={backgroundStyle.backgroundColor}
|
|
70
|
-
/>
|
|
71
|
-
<ScrollView
|
|
72
|
-
contentInsetAdjustmentBehavior="automatic"
|
|
73
|
-
style={backgroundStyle}>
|
|
74
|
-
<Header />
|
|
75
|
-
<View
|
|
76
|
-
style={{
|
|
77
|
-
backgroundColor: isDarkMode ? Colors.black : Colors.white,
|
|
78
|
-
}}>
|
|
79
|
-
<Section title="Step One">
|
|
80
|
-
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
|
|
81
|
-
screen and then come back to see your edits.
|
|
82
|
-
</Section>
|
|
83
|
-
<Section title="See Your Changes">
|
|
84
|
-
<ReloadInstructions />
|
|
85
|
-
</Section>
|
|
86
|
-
<Section title="Debug">
|
|
87
|
-
<DebugInstructions />
|
|
88
|
-
</Section>
|
|
89
|
-
<Section title="Learn More">
|
|
90
|
-
Read the docs to discover what to do next:
|
|
91
|
-
</Section>
|
|
92
|
-
<LearnMoreLinks />
|
|
93
|
-
</View>
|
|
94
|
-
</ScrollView>
|
|
95
|
-
</SafeAreaView>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const styles = StyleSheet.create({
|
|
100
|
-
sectionContainer: {
|
|
101
|
-
marginTop: 32,
|
|
102
|
-
paddingHorizontal: 24,
|
|
103
|
-
},
|
|
104
|
-
sectionTitle: {
|
|
105
|
-
fontSize: 24,
|
|
106
|
-
fontWeight: '600',
|
|
107
|
-
},
|
|
108
|
-
sectionDescription: {
|
|
109
|
-
marginTop: 8,
|
|
110
|
-
fontSize: 18,
|
|
111
|
-
fontWeight: '400',
|
|
112
|
-
},
|
|
113
|
-
highlight: {
|
|
114
|
-
fontWeight: '700',
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
export default App;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
source 'https://rubygems.org'
|
|
2
|
-
|
|
3
|
-
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
|
|
4
|
-
ruby ">= 2.6.10"
|
|
5
|
-
|
|
6
|
-
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
|
|
7
|
-
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
|
|
8
|
-
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
|
2
|
-
|
|
3
|
-
# Getting Started
|
|
4
|
-
|
|
5
|
-
>**Note**: Make sure you have completed the [React Native - Environment Setup](https://reactnative.dev/docs/environment-setup) instructions till "Creating a new application" step, before proceeding.
|
|
6
|
-
|
|
7
|
-
## Step 1: Start the Metro Server
|
|
8
|
-
|
|
9
|
-
First, you will need to start **Metro**, the JavaScript _bundler_ that ships _with_ React Native.
|
|
10
|
-
|
|
11
|
-
To start Metro, run the following command from the _root_ of your React Native project:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# using npm
|
|
15
|
-
npm start
|
|
16
|
-
|
|
17
|
-
# OR using Yarn
|
|
18
|
-
yarn start
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Step 2: Start your Application
|
|
22
|
-
|
|
23
|
-
Let Metro Bundler run in its _own_ terminal. Open a _new_ terminal from the _root_ of your React Native project. Run the following command to start your _Android_ or _iOS_ app:
|
|
24
|
-
|
|
25
|
-
### For Android
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# using npm
|
|
29
|
-
npm run android
|
|
30
|
-
|
|
31
|
-
# OR using Yarn
|
|
32
|
-
yarn android
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### For iOS
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# using npm
|
|
39
|
-
npm run ios
|
|
40
|
-
|
|
41
|
-
# OR using Yarn
|
|
42
|
-
yarn ios
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
If everything is set up _correctly_, you should see your new app running in your _Android Emulator_ or _iOS Simulator_ shortly provided you have set up your emulator/simulator correctly.
|
|
46
|
-
|
|
47
|
-
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
|
48
|
-
|
|
49
|
-
## Step 3: Modifying your App
|
|
50
|
-
|
|
51
|
-
Now that you have successfully run the app, let's modify it.
|
|
52
|
-
|
|
53
|
-
1. Open `App.tsx` in your text editor of choice and edit some lines.
|
|
54
|
-
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
|
|
55
|
-
|
|
56
|
-
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
|
|
57
|
-
|
|
58
|
-
## Congratulations! :tada:
|
|
59
|
-
|
|
60
|
-
You've successfully run and modified your React Native App. :partying_face:
|
|
61
|
-
|
|
62
|
-
### Now what?
|
|
63
|
-
|
|
64
|
-
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
65
|
-
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
|
|
66
|
-
|
|
67
|
-
# Troubleshooting
|
|
68
|
-
|
|
69
|
-
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
70
|
-
|
|
71
|
-
# Learn More
|
|
72
|
-
|
|
73
|
-
To learn more about React Native, take a look at the following resources:
|
|
74
|
-
|
|
75
|
-
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
76
|
-
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
77
|
-
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
78
|
-
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
79
|
-
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @format
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import 'react-native';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import App from '../App';
|
|
8
|
-
|
|
9
|
-
// Note: import explicitly to use the types shipped with jest.
|
|
10
|
-
import {it} from '@jest/globals';
|
|
11
|
-
|
|
12
|
-
// Note: test renderer must be required after react-native.
|
|
13
|
-
import renderer from 'react-test-renderer';
|
|
14
|
-
|
|
15
|
-
it('renders correctly', () => {
|
|
16
|
-
renderer.create(<App />);
|
|
17
|
-
});
|