expo-template-bare-minimum 47.0.22 → 48.0.2
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/android/app/build.gradle +91 -217
- package/android/app/src/debug/java/com/helloworld/ReactNativeFlipper.java +11 -5
- package/android/app/src/main/AndroidManifest.xml +1 -1
- package/android/app/src/main/java/com/helloworld/MainActivity.java +13 -28
- package/android/app/src/main/java/com/helloworld/MainApplication.java +37 -67
- package/android/app/src/release/java/com/helloworld/ReactNativeFlipper.java +20 -0
- package/android/build.gradle +7 -30
- package/android/gitignore +0 -6
- package/android/gradle.properties +1 -1
- package/android/settings.gradle +0 -7
- package/app.json +1 -2
- package/gitignore +5 -6
- package/ios/HelloWorld/AppDelegate.h +2 -4
- package/ios/HelloWorld/AppDelegate.mm +12 -111
- package/ios/HelloWorld.xcodeproj/project.pbxproj +2 -0
- package/ios/Podfile +32 -5
- package/ios/Podfile.properties.json +1 -1
- package/package.json +7 -7
- package/.buckconfig +0 -6
- package/android/app/BUCK +0 -55
- package/android/app/build_defs.bzl +0 -19
- package/android/app/src/main/java/com/helloworld/newarchitecture/MainApplicationReactNativeHost.java +0 -117
- package/android/app/src/main/java/com/helloworld/newarchitecture/components/MainComponentsRegistry.java +0 -36
- package/android/app/src/main/java/com/helloworld/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java +0 -48
- package/android/app/src/main/jni/CMakeLists.txt +0 -7
- package/android/app/src/main/jni/MainApplicationModuleProvider.cpp +0 -32
- package/android/app/src/main/jni/MainApplicationModuleProvider.h +0 -16
- package/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp +0 -45
- package/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h +0 -38
- package/android/app/src/main/jni/MainComponentsRegistry.cpp +0 -65
- package/android/app/src/main/jni/MainComponentsRegistry.h +0 -32
- package/android/app/src/main/jni/OnLoad.cpp +0 -11
package/android/app/build.gradle
CHANGED
|
@@ -1,135 +1,107 @@
|
|
|
1
1
|
apply plugin: "com.android.application"
|
|
2
|
+
apply plugin: "com.facebook.react"
|
|
2
3
|
|
|
3
4
|
import com.android.build.OutputFile
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
|
|
7
|
-
* and bundleReleaseJsAndAssets).
|
|
8
|
-
* These basically call `react-native bundle` with the correct arguments during the Android build
|
|
9
|
-
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
|
|
10
|
-
* bundle directly from the development server. Below you can see all the possible configurations
|
|
11
|
-
* and their defaults. If you decide to add a configuration block, make sure to add it before the
|
|
12
|
-
* `apply from: "../../node_modules/react-native/react.gradle"` line.
|
|
13
|
-
*
|
|
14
|
-
* project.ext.react = [
|
|
15
|
-
* // the name of the generated asset file containing your JS bundle
|
|
16
|
-
* bundleAssetName: "index.android.bundle",
|
|
17
|
-
*
|
|
18
|
-
* // the entry file for bundle generation. If none specified and
|
|
19
|
-
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
|
|
20
|
-
* // default. Can be overridden with ENTRY_FILE environment variable.
|
|
21
|
-
* entryFile: "index.android.js",
|
|
22
|
-
*
|
|
23
|
-
* // https://reactnative.dev/docs/performance#enable-the-ram-format
|
|
24
|
-
* bundleCommand: "ram-bundle",
|
|
25
|
-
*
|
|
26
|
-
* // whether to bundle JS and assets in debug mode
|
|
27
|
-
* bundleInDebug: false,
|
|
28
|
-
*
|
|
29
|
-
* // whether to bundle JS and assets in release mode
|
|
30
|
-
* bundleInRelease: true,
|
|
31
|
-
*
|
|
32
|
-
* // whether to bundle JS and assets in another build variant (if configured).
|
|
33
|
-
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
|
|
34
|
-
* // The configuration property can be in the following formats
|
|
35
|
-
* // 'bundleIn${productFlavor}${buildType}'
|
|
36
|
-
* // 'bundleIn${buildType}'
|
|
37
|
-
* // bundleInFreeDebug: true,
|
|
38
|
-
* // bundleInPaidRelease: true,
|
|
39
|
-
* // bundleInBeta: true,
|
|
40
|
-
*
|
|
41
|
-
* // whether to disable dev mode in custom build variants (by default only disabled in release)
|
|
42
|
-
* // for example: to disable dev mode in the staging build type (if configured)
|
|
43
|
-
* devDisabledInStaging: true,
|
|
44
|
-
* // The configuration property can be in the following formats
|
|
45
|
-
* // 'devDisabledIn${productFlavor}${buildType}'
|
|
46
|
-
* // 'devDisabledIn${buildType}'
|
|
47
|
-
*
|
|
48
|
-
* // the root of your project, i.e. where "package.json" lives
|
|
49
|
-
* root: "../../",
|
|
50
|
-
*
|
|
51
|
-
* // where to put the JS bundle asset in debug mode
|
|
52
|
-
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
|
|
53
|
-
*
|
|
54
|
-
* // where to put the JS bundle asset in release mode
|
|
55
|
-
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
|
|
56
|
-
*
|
|
57
|
-
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
|
58
|
-
* // require('./image.png')), in debug mode
|
|
59
|
-
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
|
|
60
|
-
*
|
|
61
|
-
* // where to put drawable resources / React Native assets, e.g. the ones you use via
|
|
62
|
-
* // require('./image.png')), in release mode
|
|
63
|
-
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
|
|
64
|
-
*
|
|
65
|
-
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
|
|
66
|
-
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
|
|
67
|
-
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
|
|
68
|
-
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
|
|
69
|
-
* // for example, you might want to remove it from here.
|
|
70
|
-
* inputExcludes: ["android/**", "ios/**"],
|
|
71
|
-
*
|
|
72
|
-
* // override which node gets called and with what additional arguments
|
|
73
|
-
* nodeExecutableAndArgs: ["node"],
|
|
74
|
-
*
|
|
75
|
-
* // supply additional arguments to the packager
|
|
76
|
-
* extraPackagerArgs: []
|
|
77
|
-
* ]
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
6
|
def projectRoot = rootDir.getAbsoluteFile().getParentFile().getAbsolutePath()
|
|
7
|
+
def expoDebuggableVariants = ['debug']
|
|
8
|
+
// Override `debuggableVariants` for expo-updates debugging
|
|
9
|
+
if (System.getenv('EX_UPDATES_NATIVE_DEBUG') == "1") {
|
|
10
|
+
react {
|
|
11
|
+
expoDebuggableVariants = []
|
|
12
|
+
}
|
|
13
|
+
}
|
|
81
14
|
|
|
82
|
-
def reactNativeRoot = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath()
|
|
83
15
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
]
|
|
16
|
+
/**
|
|
17
|
+
* This is the configuration block to customize your React Native Android app.
|
|
18
|
+
* By default you don't need to apply any configuration, just uncomment the lines you need.
|
|
19
|
+
*/
|
|
20
|
+
react {
|
|
21
|
+
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", projectRoot, "android", "absolute"].execute(null, rootDir).text.trim())
|
|
22
|
+
reactNativeDir = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
|
|
23
|
+
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
|
|
24
|
+
debuggableVariants = expoDebuggableVariants
|
|
25
|
+
|
|
26
|
+
/* Folders */
|
|
27
|
+
// The root of your project, i.e. where "package.json" lives. Default is '..'
|
|
28
|
+
// root = file("../")
|
|
29
|
+
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
|
|
30
|
+
// reactNativeDir = file("../node_modules/react-native")
|
|
31
|
+
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
|
|
32
|
+
// codegenDir = file("../node_modules/react-native-codegen")
|
|
33
|
+
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
|
|
34
|
+
// cliFile = file("../node_modules/react-native/cli.js")
|
|
35
|
+
|
|
36
|
+
/* Variants */
|
|
37
|
+
// The list of variants to that are debuggable. For those we're going to
|
|
38
|
+
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
|
|
39
|
+
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
|
|
40
|
+
// debuggableVariants = ["liteDebug", "prodDebug"]
|
|
41
|
+
|
|
42
|
+
/* Bundling */
|
|
43
|
+
// A list containing the node command and its flags. Default is just 'node'.
|
|
44
|
+
// nodeExecutableAndArgs = ["node"]
|
|
45
|
+
//
|
|
46
|
+
// The command to run when bundling. By default is 'bundle'
|
|
47
|
+
// bundleCommand = "ram-bundle"
|
|
48
|
+
//
|
|
49
|
+
// The path to the CLI configuration file. Default is empty.
|
|
50
|
+
// bundleConfig = file(../rn-cli.config.js)
|
|
51
|
+
//
|
|
52
|
+
// The name of the generated asset file containing your JS bundle
|
|
53
|
+
// bundleAssetName = "MyApplication.android.bundle"
|
|
54
|
+
//
|
|
55
|
+
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
|
|
56
|
+
// entryFile = file("../js/MyApplication.android.js")
|
|
57
|
+
//
|
|
58
|
+
// A list of extra flags to pass to the 'bundle' commands.
|
|
59
|
+
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
|
|
60
|
+
// extraPackagerArgs = []
|
|
61
|
+
|
|
62
|
+
/* Hermes Commands */
|
|
63
|
+
// The hermes compiler command to run. By default it is 'hermesc'
|
|
64
|
+
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
|
|
65
|
+
//
|
|
66
|
+
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
|
|
67
|
+
// hermesFlags = ["-O", "-output-source-map"]
|
|
68
|
+
}
|
|
91
69
|
|
|
92
|
-
|
|
70
|
+
// Override `hermesEnabled` by `expo.jsEngine`
|
|
71
|
+
ext {
|
|
72
|
+
hermesEnabled = (findProperty('expo.jsEngine') ?: "hermes") == "hermes"
|
|
73
|
+
}
|
|
93
74
|
|
|
94
75
|
/**
|
|
95
|
-
* Set this to true to create
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* Upload all the APKs to the Play Store and people will download
|
|
100
|
-
* the correct one based on the CPU architecture of their device.
|
|
76
|
+
* Set this to true to create four separate APKs instead of one,
|
|
77
|
+
* one for each native architecture. This is useful if you don't
|
|
78
|
+
* use App Bundles (https://developer.android.com/guide/app-bundle/)
|
|
79
|
+
* and want to have separate APKs to upload to the Play Store.
|
|
101
80
|
*/
|
|
102
81
|
def enableSeparateBuildPerCPUArchitecture = false
|
|
103
82
|
|
|
104
83
|
/**
|
|
105
|
-
* Run Proguard to
|
|
84
|
+
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
|
|
106
85
|
*/
|
|
107
86
|
def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInReleaseBuilds') ?: false).toBoolean()
|
|
108
87
|
|
|
109
88
|
/**
|
|
110
|
-
* The preferred build flavor of JavaScriptCore
|
|
89
|
+
* The preferred build flavor of JavaScriptCore (JSC)
|
|
111
90
|
*
|
|
112
91
|
* For example, to use the international variant, you can use:
|
|
113
92
|
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
|
|
114
93
|
*
|
|
115
94
|
* The international variant includes ICU i18n library and necessary data
|
|
116
95
|
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
|
|
117
|
-
* give correct results when using with locales other than en-US.
|
|
96
|
+
* give correct results when using with locales other than en-US. Note that
|
|
118
97
|
* this variant is about 6MiB larger per architecture than default.
|
|
119
98
|
*/
|
|
120
99
|
def jscFlavor = 'org.webkit:android-jsc:+'
|
|
121
100
|
|
|
122
101
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
|
|
127
|
-
* and the benefits of using Hermes will therefore be sharply reduced.
|
|
128
|
-
*/
|
|
129
|
-
def enableHermes = project.ext.react.get("enableHermes", false);
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Architectures to build native code for.
|
|
102
|
+
* Private function to get the list of Native Architectures you want to build.
|
|
103
|
+
* This reads the value from reactNativeArchitectures in your gradle.properties
|
|
104
|
+
* file and works together with the --active-arch-only flag of react-native run-android.
|
|
133
105
|
*/
|
|
134
106
|
def reactNativeArchitectures() {
|
|
135
107
|
def value = project.getProperties().get("reactNativeArchitectures")
|
|
@@ -141,72 +113,13 @@ android {
|
|
|
141
113
|
|
|
142
114
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
143
115
|
|
|
116
|
+
namespace "com.helloworld"
|
|
144
117
|
defaultConfig {
|
|
145
118
|
applicationId "com.helloworld"
|
|
146
119
|
minSdkVersion rootProject.ext.minSdkVersion
|
|
147
120
|
targetSdkVersion rootProject.ext.targetSdkVersion
|
|
148
121
|
versionCode 1
|
|
149
122
|
versionName "1.0"
|
|
150
|
-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
151
|
-
|
|
152
|
-
if (isNewArchitectureEnabled()) {
|
|
153
|
-
// We configure the CMake build only if you decide to opt-in for the New Architecture.
|
|
154
|
-
externalNativeBuild {
|
|
155
|
-
cmake {
|
|
156
|
-
arguments "-DPROJECT_BUILD_DIR=$buildDir",
|
|
157
|
-
"-DREACT_ANDROID_DIR=${reactNativeRoot}/ReactAndroid",
|
|
158
|
-
"-DREACT_ANDROID_BUILD_DIR=${reactNativeRoot}/ReactAndroid/build",
|
|
159
|
-
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
|
|
160
|
-
"-DANDROID_STL=c++_shared"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (!enableSeparateBuildPerCPUArchitecture) {
|
|
164
|
-
ndk {
|
|
165
|
-
abiFilters (*reactNativeArchitectures())
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (isNewArchitectureEnabled()) {
|
|
172
|
-
// We configure the CMake build only if you decide to opt-in for the New Architecture.
|
|
173
|
-
externalNativeBuild {
|
|
174
|
-
cmake {
|
|
175
|
-
path "$projectDir/src/main/jni/CMakeLists.txt"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
|
|
179
|
-
def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) {
|
|
180
|
-
dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck")
|
|
181
|
-
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
|
182
|
-
into("$buildDir/react-ndk/exported")
|
|
183
|
-
}
|
|
184
|
-
def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) {
|
|
185
|
-
dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck")
|
|
186
|
-
from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib")
|
|
187
|
-
into("$buildDir/react-ndk/exported")
|
|
188
|
-
}
|
|
189
|
-
afterEvaluate {
|
|
190
|
-
// If you wish to add a custom TurboModule or component locally,
|
|
191
|
-
// you should uncomment this line.
|
|
192
|
-
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
|
|
193
|
-
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
|
|
194
|
-
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
|
|
195
|
-
|
|
196
|
-
// Due to a bug inside AGP, we have to explicitly set a dependency
|
|
197
|
-
// between configureCMakeDebug* tasks and the preBuild tasks.
|
|
198
|
-
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
|
|
199
|
-
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
|
|
200
|
-
configureCMakeDebug.dependsOn(preDebugBuild)
|
|
201
|
-
reactNativeArchitectures().each { architecture ->
|
|
202
|
-
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
|
|
203
|
-
dependsOn("preDebugBuild")
|
|
204
|
-
}
|
|
205
|
-
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
|
|
206
|
-
dependsOn("preReleaseBuild")
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
123
|
}
|
|
211
124
|
|
|
212
125
|
splits {
|
|
@@ -243,11 +156,12 @@ android {
|
|
|
243
156
|
variant.outputs.each { output ->
|
|
244
157
|
// For each separate APK per architecture, set a unique version code as described here:
|
|
245
158
|
// https://developer.android.com/studio/build/configure-apk-splits.html
|
|
159
|
+
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
|
|
246
160
|
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
|
|
247
161
|
def abi = output.getFilter(OutputFile.ABI)
|
|
248
162
|
if (abi != null) { // null for the universal-debug, universal-release variants
|
|
249
163
|
output.versionCodeOverride =
|
|
250
|
-
|
|
164
|
+
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
|
|
251
165
|
}
|
|
252
166
|
|
|
253
167
|
}
|
|
@@ -275,10 +189,8 @@ android {
|
|
|
275
189
|
}
|
|
276
190
|
|
|
277
191
|
dependencies {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
//noinspection GradleDynamicVersion
|
|
281
|
-
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
192
|
+
// The version of react-native is set by the React Native Gradle Plugin
|
|
193
|
+
implementation("com.facebook.react:react-android")
|
|
282
194
|
|
|
283
195
|
def isGifEnabled = (findProperty('expo.gif.enabled') ?: "") == "true";
|
|
284
196
|
def isWebpEnabled = (findProperty('expo.webp.enabled') ?: "") == "true";
|
|
@@ -287,76 +199,38 @@ dependencies {
|
|
|
287
199
|
|
|
288
200
|
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
|
|
289
201
|
if (isGifEnabled || isWebpEnabled) {
|
|
290
|
-
implementation
|
|
291
|
-
implementation
|
|
202
|
+
implementation("com.facebook.fresco:fresco:${frescoVersion}")
|
|
203
|
+
implementation("com.facebook.fresco:imagepipeline-okhttp3:${frescoVersion}")
|
|
292
204
|
}
|
|
293
205
|
|
|
294
206
|
if (isGifEnabled) {
|
|
295
207
|
// For animated gif support
|
|
296
|
-
implementation
|
|
208
|
+
implementation("com.facebook.fresco:animated-gif:${frescoVersion}")
|
|
297
209
|
}
|
|
298
210
|
|
|
299
211
|
if (isWebpEnabled) {
|
|
300
212
|
// For webp support
|
|
301
|
-
implementation
|
|
213
|
+
implementation("com.facebook.fresco:webpsupport:${frescoVersion}")
|
|
302
214
|
if (isWebpAnimatedEnabled) {
|
|
303
215
|
// Animated webp support
|
|
304
|
-
implementation
|
|
216
|
+
implementation("com.facebook.fresco:animated-webp:${frescoVersion}")
|
|
305
217
|
}
|
|
306
218
|
}
|
|
307
219
|
|
|
308
|
-
implementation
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
220
|
+
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
|
|
221
|
+
|
|
222
|
+
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
|
|
312
223
|
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
|
|
313
|
-
exclude group:'com.facebook.flipper'
|
|
314
224
|
exclude group:'com.squareup.okhttp3', module:'okhttp'
|
|
315
225
|
}
|
|
316
|
-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
317
|
-
exclude group:'com.facebook.flipper'
|
|
318
|
-
}
|
|
226
|
+
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
|
|
319
227
|
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
|
|
323
|
-
exclude group:'com.facebook.fbjni'
|
|
324
|
-
}
|
|
228
|
+
if (hermesEnabled.toBoolean()) {
|
|
229
|
+
implementation("com.facebook.react:hermes-android")
|
|
325
230
|
} else {
|
|
326
231
|
implementation jscFlavor
|
|
327
232
|
}
|
|
328
233
|
}
|
|
329
234
|
|
|
330
|
-
if (isNewArchitectureEnabled()) {
|
|
331
|
-
// If new architecture is enabled, we let you build RN from source
|
|
332
|
-
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
|
|
333
|
-
// This will be applied to all the imported transtitive dependency.
|
|
334
|
-
configurations.all {
|
|
335
|
-
resolutionStrategy.dependencySubstitution {
|
|
336
|
-
substitute(module("com.facebook.react:react-native"))
|
|
337
|
-
.using(project(":ReactAndroid"))
|
|
338
|
-
.because("On New Architecture we're building React Native from source")
|
|
339
|
-
substitute(module("com.facebook.react:hermes-engine"))
|
|
340
|
-
.using(project(":ReactAndroid:hermes-engine"))
|
|
341
|
-
.because("On New Architecture we're building Hermes from source")
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// Run this once to be able to run the application with BUCK
|
|
347
|
-
// puts all compile dependencies into folder libs for BUCK to use
|
|
348
|
-
task copyDownloadableDepsToLibs(type: Copy) {
|
|
349
|
-
from configurations.implementation
|
|
350
|
-
into 'libs'
|
|
351
|
-
}
|
|
352
|
-
|
|
353
235
|
apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json')"].execute(null, rootDir).text.trim(), "../native_modules.gradle");
|
|
354
236
|
applyNativeModulesAppBuildGradle(project)
|
|
355
|
-
|
|
356
|
-
def isNewArchitectureEnabled() {
|
|
357
|
-
// To opt-in for the New Architecture, you can either:
|
|
358
|
-
// - Set `newArchEnabled` to true inside the `gradle.properties` file
|
|
359
|
-
// - Invoke gradle with `-newArchEnabled=true`
|
|
360
|
-
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
|
|
361
|
-
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
362
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
3
|
*
|
|
4
4
|
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
|
5
5
|
* directory of this source tree.
|
|
@@ -17,22 +17,27 @@ import com.facebook.flipper.plugins.inspector.DescriptorMapping;
|
|
|
17
17
|
import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin;
|
|
18
18
|
import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor;
|
|
19
19
|
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
|
|
20
|
-
import com.facebook.flipper.plugins.react.ReactFlipperPlugin;
|
|
21
20
|
import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin;
|
|
21
|
+
import com.facebook.react.ReactInstanceEventListener;
|
|
22
22
|
import com.facebook.react.ReactInstanceManager;
|
|
23
23
|
import com.facebook.react.bridge.ReactContext;
|
|
24
24
|
import com.facebook.react.modules.network.NetworkingModule;
|
|
25
25
|
import okhttp3.OkHttpClient;
|
|
26
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
|
+
*/
|
|
27
31
|
public class ReactNativeFlipper {
|
|
28
32
|
public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) {
|
|
29
33
|
if (FlipperUtils.shouldEnableFlipper(context)) {
|
|
30
34
|
final FlipperClient client = AndroidFlipperClient.getInstance(context);
|
|
35
|
+
|
|
31
36
|
client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults()));
|
|
32
|
-
client.addPlugin(new ReactFlipperPlugin());
|
|
33
37
|
client.addPlugin(new DatabasesFlipperPlugin(context));
|
|
34
38
|
client.addPlugin(new SharedPreferencesFlipperPlugin(context));
|
|
35
39
|
client.addPlugin(CrashReporterPlugin.getInstance());
|
|
40
|
+
|
|
36
41
|
NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin();
|
|
37
42
|
NetworkingModule.setCustomClientBuilder(
|
|
38
43
|
new NetworkingModule.CustomClientBuilder() {
|
|
@@ -43,12 +48,13 @@ public class ReactNativeFlipper {
|
|
|
43
48
|
});
|
|
44
49
|
client.addPlugin(networkFlipperPlugin);
|
|
45
50
|
client.start();
|
|
51
|
+
|
|
46
52
|
// Fresco Plugin needs to ensure that ImagePipelineFactory is initialized
|
|
47
53
|
// Hence we run if after all native modules have been initialized
|
|
48
54
|
ReactContext reactContext = reactInstanceManager.getCurrentReactContext();
|
|
49
55
|
if (reactContext == null) {
|
|
50
56
|
reactInstanceManager.addReactInstanceEventListener(
|
|
51
|
-
new
|
|
57
|
+
new ReactInstanceEventListener() {
|
|
52
58
|
@Override
|
|
53
59
|
public void onReactContextInitialized(ReactContext reactContext) {
|
|
54
60
|
reactInstanceManager.removeReactInstanceEventListener(this);
|
|
@@ -66,4 +72,4 @@ public class ReactNativeFlipper {
|
|
|
66
72
|
}
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
}
|
|
75
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
2
2
|
|
|
3
3
|
<uses-permission android:name="android.permission.INTERNET"/>
|
|
4
4
|
<!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->
|
|
@@ -5,7 +5,8 @@ import android.os.Bundle;
|
|
|
5
5
|
|
|
6
6
|
import com.facebook.react.ReactActivity;
|
|
7
7
|
import com.facebook.react.ReactActivityDelegate;
|
|
8
|
-
import com.facebook.react.
|
|
8
|
+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
|
|
9
|
+
import com.facebook.react.defaults.DefaultReactActivityDelegate;
|
|
9
10
|
|
|
10
11
|
import expo.modules.ReactActivityDelegateWrapper;
|
|
11
12
|
|
|
@@ -29,15 +30,20 @@ public class MainActivity extends ReactActivity {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
|
-
* Returns the instance of the {@link ReactActivityDelegate}.
|
|
33
|
-
*
|
|
34
|
-
* (
|
|
33
|
+
* Returns the instance of the {@link ReactActivityDelegate}. Here we use a util class {@link
|
|
34
|
+
* DefaultReactActivityDelegate} which allows you to easily enable Fabric and Concurrent React
|
|
35
|
+
* (aka React 18) with two boolean flags.
|
|
35
36
|
*/
|
|
36
37
|
@Override
|
|
37
38
|
protected ReactActivityDelegate createReactActivityDelegate() {
|
|
38
|
-
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
return new ReactActivityDelegateWrapper(this, BuildConfig.IS_NEW_ARCHITECTURE_ENABLED, new DefaultReactActivityDelegate(
|
|
40
|
+
this,
|
|
41
|
+
getMainComponentName(),
|
|
42
|
+
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
43
|
+
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
|
|
44
|
+
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
|
|
45
|
+
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
|
|
46
|
+
));
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
/**
|
|
@@ -59,25 +65,4 @@ public class MainActivity extends ReactActivity {
|
|
|
59
65
|
// because it's doing more than {@link Activity#moveTaskToBack} in fact.
|
|
60
66
|
super.invokeDefaultOnBackPressed();
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
public static class MainActivityDelegate extends ReactActivityDelegate {
|
|
64
|
-
public MainActivityDelegate(ReactActivity activity, String mainComponentName) {
|
|
65
|
-
super(activity, mainComponentName);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@Override
|
|
69
|
-
protected ReactRootView createRootView() {
|
|
70
|
-
ReactRootView reactRootView = new ReactRootView(getContext());
|
|
71
|
-
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
|
|
72
|
-
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
|
|
73
|
-
return reactRootView;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
@Override
|
|
77
|
-
protected boolean isConcurrentRootEnabled() {
|
|
78
|
-
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
|
|
79
|
-
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
|
|
80
|
-
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
68
|
}
|