Skip to content

Commit 0a26639

Browse files
authored
chore: bump library and examples to rn 0.70-rc3 (software-mansion#1837)
PR bumping library to RN 0.70-rc3, which might make it not compatible with earlier versions of RN on Fabric. It should come with the same change in other libraries. In this PR, I had to remove macos code from Example since it breaks @react-native-community/cli resolution. Hopefully we can bring it back soon.
1 parent 98c14b4 commit 0a26639

File tree

77 files changed

+3322
-6888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3322
-6888
lines changed

.github/workflows/macos-build-test.yml

Lines changed: 0 additions & 78 deletions
This file was deleted.

Example/.flowconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ node_modules/react-native/Libraries/polyfills/.*
1111
; Flow doesn't support platforms
1212
.*/Libraries/Utilities/LoadingView.js
1313

14+
.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$
15+
1416
[untyped]
1517
.*/node_modules/@react-native-community/cli/.*/.*
1618

@@ -50,7 +52,6 @@ nonstrict-import=warn
5052
deprecated-type=warn
5153
unsafe-getters-setters=warn
5254
unnecessary-invariant=warn
53-
signature-verification-failure=warn
5455

5556
[strict]
5657
deprecated-type
@@ -62,4 +63,4 @@ untyped-import
6263
untyped-type-import
6364

6465
[version]
65-
^0.170.0
66+
^0.182.0

Example/.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DerivedData
2020
*.hmap
2121
*.ipa
2222
*.xcuserstate
23+
ios/.xcode.env.local
2324

2425
# Android/IntelliJ
2526
#
@@ -49,9 +50,10 @@ buck-out/
4950
# For more information about the recommended setup visit:
5051
# https://docs.fastlane.tools/best-practices/source-control/
5152

52-
*/fastlane/report.xml
53-
*/fastlane/Preview.html
54-
*/fastlane/screenshots
53+
**/fastlane/report.xml
54+
**/fastlane/Preview.html
55+
**/fastlane/screenshots
56+
**/fastlane/test_output
5557

5658
# Bundle artifact
5759
*.jsbundle

Example/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4-
ruby '2.7.4'
4+
ruby '2.7.5'
55

66
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

Example/Gemfile.lock

Lines changed: 0 additions & 100 deletions
This file was deleted.

Example/_node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

Example/_ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.7.4
1+
2.7.5

Example/android/app/build.gradle

Lines changed: 52 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
apply plugin: "com.android.application"
22

33
import com.android.build.OutputFile
4+
import org.apache.tools.ant.taskdefs.condition.Os
45

56
/**
67
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -78,7 +79,7 @@ import com.android.build.OutputFile
7879
*/
7980

8081
project.ext.react = [
81-
enableHermes: false, // clean and rebuild if changing
82+
enableHermes: true, // clean and rebuild if changing
8283
]
8384

8485
apply from: "../../node_modules/react-native/react.gradle"
@@ -142,21 +143,19 @@ android {
142143
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
143144

144145
if (isNewArchitectureEnabled()) {
145-
// We configure the NDK build only if you decide to opt-in for the New Architecture.
146+
// We configure the CMake build only if you decide to opt-in for the New Architecture.
146147
externalNativeBuild {
147-
ndkBuild {
148-
arguments "APP_PLATFORM=android-21",
149-
"APP_STL=c++_shared",
150-
"NDK_TOOLCHAIN_VERSION=clang",
151-
"GENERATED_SRC_DIR=$buildDir/generated/source",
152-
"PROJECT_BUILD_DIR=$buildDir",
153-
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
154-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
155-
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
156-
cppFlags "-std=c++17"
157-
// Make sure this target name is the same you specify inside the
158-
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
159-
targets "example_appmodules"
148+
cmake {
149+
arguments "-DPROJECT_BUILD_DIR=$buildDir",
150+
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
151+
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
152+
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
153+
"-DANDROID_STL=c++_shared"
154+
}
155+
}
156+
if (!enableSeparateBuildPerCPUArchitecture) {
157+
ndk {
158+
abiFilters (*reactNativeArchitectures())
160159
}
161160
}
162161
}
@@ -165,8 +164,8 @@ android {
165164
if (isNewArchitectureEnabled()) {
166165
// We configure the NDK build only if you decide to opt-in for the New Architecture.
167166
externalNativeBuild {
168-
ndkBuild {
169-
path "$projectDir/src/main/jni/Android.mk"
167+
cmake {
168+
path "$projectDir/src/main/jni/CMakeLists.txt"
170169
}
171170
}
172171
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
@@ -186,6 +185,20 @@ android {
186185
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
187186
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
188187
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
188+
189+
// Due to a bug inside AGP, we have to explicitly set a dependency
190+
// between configureCMakeDebug* tasks and the preBuild tasks.
191+
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
192+
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
193+
configureCMakeDebug.dependsOn(preDebugBuild)
194+
reactNativeArchitectures().each { architecture ->
195+
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
196+
dependsOn("preDebugBuild")
197+
}
198+
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
199+
dependsOn("preReleaseBuild")
200+
}
201+
}
189202
}
190203
}
191204

@@ -238,14 +251,8 @@ android {
238251
dependencies {
239252
implementation fileTree(dir: "libs", include: ["*.jar"])
240253

241-
// If new architecture is enabled, we let you build RN from source
242-
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
243-
if (isNewArchitectureEnabled()) {
244-
implementation project(":ReactAndroid")
245-
} else {
246-
//noinspection GradleDynamicVersion
247-
implementation "com.facebook.react:react-native:+" // From node_modules
248-
}
254+
//noinspection GradleDynamicVersion
255+
implementation "com.facebook.react:react-native:+" // From node_modules
249256

250257
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
251258

@@ -263,14 +270,31 @@ dependencies {
263270
}
264271

265272
if (enableHermes) {
266-
def hermesPath = "../../node_modules/hermes-engine/android/";
267-
debugImplementation files(hermesPath + "hermes-debug.aar")
268-
releaseImplementation files(hermesPath + "hermes-release.aar")
273+
//noinspection GradleDynamicVersion
274+
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
275+
exclude group:'com.facebook.fbjni'
276+
}
269277
} else {
270278
implementation jscFlavor
271279
}
272280
}
273281

282+
if (isNewArchitectureEnabled()) {
283+
// If new architecture is enabled, we let you build RN from source
284+
// Otherwise we fallback to a prebuilt .aar bundled in the NPM package.
285+
// This will be applied to all the imported transtitive dependency.
286+
configurations.all {
287+
resolutionStrategy.dependencySubstitution {
288+
substitute(module("com.facebook.react:react-native"))
289+
.using(project(":ReactAndroid"))
290+
.because("On New Architecture we're building React Native from source")
291+
substitute(module("com.facebook.react:hermes-engine"))
292+
.using(project(":ReactAndroid:hermes-engine"))
293+
.because("On New Architecture we're building Hermes from source")
294+
}
295+
}
296+
}
297+
274298
// Run this once to be able to run the application with BUCK
275299
// puts all compile dependencies into folder libs for BUCK to use
276300
task copyDownloadableDepsToLibs(type: Copy) {

Example/android/app/src/main/java/com/example/MainActivity.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ protected String getMainComponentName() {
1717

1818
/**
1919
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
20-
* you can specify the rendered you wish to use (Fabric or the older renderer).
20+
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
21+
* (Paper).
2122
*/
2223
@Override
2324
protected ReactActivityDelegate createReactActivityDelegate() {
@@ -36,5 +37,12 @@ protected ReactRootView createRootView() {
3637
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
3738
return reactRootView;
3839
}
40+
41+
@Override
42+
protected boolean isConcurrentRootEnabled() {
43+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
44+
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
45+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
46+
}
3947
}
4048
}

0 commit comments

Comments
 (0)