Skip to content

Commit 308cd7c

Browse files
committed
Update to React Native 0.69, fix Kotlin deps.
@react-native-picker/picker is breaking peer deps.
1 parent 3a0d6e6 commit 308cd7c

17 files changed

Lines changed: 4069 additions & 4356 deletions

File tree

.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
#
@@ -53,9 +54,10 @@ buck-out/
5354
# For more information about the recommended setup visit:
5455
# https://docs.fastlane.tools/best-practices/source-control/
5556

56-
*/fastlane/report.xml
57-
*/fastlane/Preview.html
58-
*/fastlane/screenshots
57+
**/fastlane/report.xml
58+
**/fastlane/Preview.html
59+
**/fastlane/screenshots
60+
**/fastlane/test_output
5961

6062
# Bundle artifact
6163
*.jsbundle

.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

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'

android/app/build.gradle

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apply plugin: "com.android.application"
22
apply plugin: "kotlin-android"
33

44
import com.android.build.OutputFile
5-
import org.apache.tools.ant.taskdefs.condition.Os
65

76
/**
87
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -148,21 +147,18 @@ android {
148147
externalNativeBuild {
149148
ndkBuild {
150149
arguments "APP_PLATFORM=android-21",
151-
"APP_STL=c++_shared",
152-
"NDK_TOOLCHAIN_VERSION=clang",
153-
"GENERATED_SRC_DIR=$buildDir/generated/source",
154-
"PROJECT_BUILD_DIR=$buildDir",
155-
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
156-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
150+
"APP_STL=c++_shared",
151+
"NDK_TOOLCHAIN_VERSION=clang",
152+
"GENERATED_SRC_DIR=$buildDir/generated/source",
153+
"PROJECT_BUILD_DIR=$buildDir",
154+
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
155+
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
156+
"NODE_MODULES_DIR=$rootDir/../node_modules"
157157
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
158158
cppFlags "-std=c++17"
159159
// Make sure this target name is the same you specify inside the
160160
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
161161
targets "enderchat_appmodules"
162-
// Fix for windows limit on number of character in file paths and in command lines
163-
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
164-
arguments "NDK_APP_SHORT_COMMANDS=true"
165-
}
166162
}
167163
}
168164
if (!enableSeparateBuildPerCPUArchitecture) {
@@ -261,7 +257,8 @@ android {
261257

262258
dependencies {
263259
implementation fileTree(dir: "libs", include: ["*.jar"])
264-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
260+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
261+
implementation "androidx.core:core-ktx:1.5.0"
265262

266263
//noinspection GradleDynamicVersion
267264
implementation "com.facebook.react:react-native:+" // From node_modules
@@ -282,9 +279,10 @@ dependencies {
282279
}
283280

284281
if (enableHermes) {
285-
def hermesPath = "../../node_modules/hermes-engine/android/";
286-
debugImplementation files(hermesPath + "hermes-debug.aar")
287-
releaseImplementation files(hermesPath + "hermes-release.aar")
282+
//noinspection GradleDynamicVersion
283+
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
284+
exclude group:'com.facebook.fbjni'
285+
}
288286
} else {
289287
implementation jscFlavor
290288
}
@@ -297,7 +295,11 @@ if (isNewArchitectureEnabled()) {
297295
configurations.all {
298296
resolutionStrategy.dependencySubstitution {
299297
substitute(module("com.facebook.react:react-native"))
300-
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
298+
.using(project(":ReactAndroid"))
299+
.because("On New Architecture we're building React Native from source")
300+
substitute(module("com.facebook.react:hermes-engine"))
301+
.using(project(":ReactAndroid:hermes-engine"))
302+
.because("On New Architecture we're building Hermes from source")
301303
}
302304
}
303305
}

android/app/src/main/java/com/enderchat/MainActivity.java

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

2424
/**
2525
* Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and
26-
* you can specify the rendered you wish to use (Fabric or the older renderer).
26+
* you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer
27+
* (Paper).
2728
*/
2829
@Override
2930
protected ReactActivityDelegate createReactActivityDelegate() {
@@ -42,6 +43,13 @@ protected ReactRootView createRootView() {
4243
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
4344
return reactRootView;
4445
}
46+
47+
@Override
48+
protected boolean isConcurrentRootEnabled() {
49+
// If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18).
50+
// More on this on https://reactjs.org/blog/2022/03/29/react-v18.html
51+
return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
52+
}
4553
}
4654

4755
@Override

android/app/src/main/java/com/enderchat/newarchitecture/MainApplicationReactNativeHost.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import com.facebook.react.bridge.UIManager;
1717
import com.facebook.react.fabric.ComponentFactory;
1818
import com.facebook.react.fabric.CoreComponentsRegistry;
19-
import com.facebook.react.fabric.EmptyReactNativeConfig;
2019
import com.facebook.react.fabric.FabricJSIModuleProvider;
20+
import com.facebook.react.fabric.ReactNativeConfig;
2121
import com.facebook.react.uimanager.ViewManagerRegistry;
2222
import com.enderchat.BuildConfig;
2323
import com.enderchat.newarchitecture.components.MainComponentsRegistry;
@@ -105,7 +105,7 @@ public JSIModuleProvider<UIManager> getJSIModuleProvider() {
105105
return new FabricJSIModuleProvider(
106106
reactApplicationContext,
107107
componentFactory,
108-
new EmptyReactNativeConfig(),
108+
ReactNativeConfig.DEFAULT_CONFIG,
109109
viewManagerRegistry);
110110
}
111111
});

android/app/src/main/jni/Android.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
2828
LOCAL_SHARED_LIBRARIES := \
2929
libfabricjni \
3030
libfbjni \
31-
libfolly_futures \
32-
libfolly_json \
31+
libfolly_runtime \
3332
libglog \
3433
libjsi \
3534
libreact_codegen_rncore \

android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import org.apache.tools.ant.taskdefs.condition.Os
44

55
buildscript {
66
ext {
7-
kotlinVersion = '1.6.20'
7+
kotlinVersion = "1.6.21"
88
buildToolsVersion = "31.0.0"
99
minSdkVersion = 21
1010
compileSdkVersion = 31
@@ -23,9 +23,9 @@ buildscript {
2323
mavenCentral()
2424
}
2525
dependencies {
26-
classpath("com.android.tools.build:gradle:7.0.4")
26+
classpath("com.android.tools.build:gradle:7.1.1")
2727
classpath("com.facebook.react:react-native-gradle-plugin")
28-
classpath("de.undercouch:gradle-download-task:4.1.2")
28+
classpath("de.undercouch:gradle-download-task:5.0.1")
2929
// NOTE: Do not place your application dependencies here; they belong
3030
// in the individual module build.gradle files
3131
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${project.ext.kotlinVersion}")

android/settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ includeBuild('../node_modules/react-native-gradle-plugin')
66
if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") {
77
include(":ReactAndroid")
88
project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid')
9+
include(":ReactAndroid:hermes-engine")
10+
project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine')
911
}

ios/.xcode.env

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This `.xcode.env` file is versioned and is used to source the environment
2+
# used when running script phases inside Xcode.
3+
# To customize your local environment, you can create an `.xcode.env.local`
4+
# file that is not versioned.
5+
# NODE_BINARY variable contains the PATH to the node executable.
6+
#
7+
# Customize the NODE_BINARY variable here.
8+
# For example, to use nvm with brew, add the following line
9+
# . "$(brew --prefix nvm)/nvm.sh" --no-use
10+
export NODE_BINARY=$(command -v node)

0 commit comments

Comments
 (0)