Skip to content

Commit f9ab469

Browse files
committed
Merge pull request #585 from leotm/rn-69.0-rc.0-react-18
Upgrade React Native 0.68.1 to 0.69.0-rc.0 and React 18 w New Arch Full details: #585 Including unofficially - React 18.0 -> 18.1+ - TypeScript 4.6 (next) to 4.7 beta - CMake 3.22.1 for NDK 23 on Ubuntu 20.04 - Dedupe yarn lockfile deps with overlapping ranges (TODO: CI) And fixing React 18 type errors since - React 17: interface FunctionComponent<P = {}> { (props: PropsWithChildren<P> - React 18: interface FunctionComponent<P = {}> { (props: P
1 parent 0eb431f commit f9ab469

File tree

136 files changed

+1145
-1371
lines changed

Some content is hidden

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

136 files changed

+1145
-1371
lines changed

β€Ž.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ module.exports = {
8585
* - class Atom extends Component<{ children: ReactNode, onPress: () => void }>
8686
* - const Atom = ({ children, onPress }: { children: ReactNode; onPress: () => void }) => <></> // Inferred JSX.Element
8787
* - const Atom: FC<{ onPress: () => void }>
88+
* React 17 PropsWithChildren, now removed for generic P in React 18
8889
*/
8990
'@typescript-eslint/no-unnecessary-type-arguments': 'off',
9091
'@typescript-eslint/no-unused-vars': [

β€Ž.flowconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ untyped-import
6464
untyped-type-import
6565

6666
[version]
67-
^0.170.0
67+
^0.176.3
68+

β€Ž.github/workflows/gradle.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ jobs:
5252

5353
- name: Install all project dependencies
5454
run: yarn
55+
56+
- name: Get and extract cmake-3.23.1-linux-x86_64.tar.gz to /usr/local/lib/android/sdk
57+
run: |
58+
wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz
59+
tar xzf cmake-3.23.1-linux-x86_64.tar.gz
60+
rm -rf cmake-3.23.1-linux-x86_64.tar.gz
61+
mkdir -p /usr/local/lib/android/sdk/cmake/3.22.1
62+
cp -rf cmake-3.23.1-linux-x86_64/* /usr/local/lib/android/sdk/cmake/3.22.1
63+
cd cmake-3.23.1-linux-x86_64
64+
./bin/cmake --version
5565
5666
# Avoid poisoned cache problems
5767
- name: Delete Android build pre-computed outputs

β€Ž.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
project.xcworkspace
2425

2526
# Android/IntelliJ
@@ -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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

β€ŽGemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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.7.5'
5+
6+
gem 'cocoapods', '~> 1.11', '>= 1.11.2'

β€ŽGemfile.lock

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

β€Žandroid/app/build.gradle

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

33
import com.android.build.OutputFile
4-
import org.apache.tools.ant.taskdefs.condition.Os
54

65
/**
76
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
@@ -153,18 +152,13 @@ android {
153152
"GENERATED_SRC_DIR=$buildDir/generated/source",
154153
"PROJECT_BUILD_DIR=$buildDir",
155154
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
156-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
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 "leotm_myapp_appmodules"
162-
163-
// Fix for windows limit on number of character in file paths and in command lines
164-
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
165-
arguments "NDK_OUT=${rootProject.projectDir.getParent()}\\.cxx",
166-
"NDK_APP_SHORT_COMMANDS=true"
167-
}
168162
}
169163
}
170164
if (!enableSeparateBuildPerCPUArchitecture) {
@@ -265,13 +259,10 @@ android {
265259
dependencies {
266260
implementation fileTree(dir: "libs", include: ["*.jar"])
267261

268-
implementation project(":ReactAndroid") // From node_modules
262+
//noinspection GradleDynamicVersion
263+
implementation "com.facebook.react:react-native:+" // From node_modules
269264

270-
// https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout
271-
// https://developer.android.com/reference/kotlin/androidx/swiperefreshlayout/widget/package-summary
272-
// https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-main/swiperefreshlayout/swiperefreshlayout
273-
// https://github.com/android/views-widgets-samples
274-
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
265+
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
275266

276267
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
277268
exclude group:'com.facebook.fbjni'
@@ -287,9 +278,10 @@ dependencies {
287278
}
288279

289280
if (enableHermes) {
290-
def hermesPath = "../../node_modules/hermes-engine/android/"
291-
debugImplementation files(hermesPath + "hermes-debug.aar")
292-
releaseImplementation files(hermesPath + "hermes-release.aar")
281+
//noinspection GradleDynamicVersion
282+
implementation("com.facebook.react:hermes-engine:+") { // From node_modules
283+
exclude group:'com.facebook.fbjni'
284+
}
293285
} else {
294286
implementation jscFlavor
295287
}
@@ -302,7 +294,11 @@ if (isNewArchitectureEnabled()) {
302294
configurations.all {
303295
resolutionStrategy.dependencySubstitution {
304296
substitute(module("com.facebook.react:react-native"))
305-
.using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source")
297+
.using(project(":ReactAndroid"))
298+
.because("On New Architecture we're building React Native from source")
299+
substitute(module("com.facebook.react:hermes-engine"))
300+
.using(project(":ReactAndroid:hermes-engine"))
301+
.because("On New Architecture we're building Hermes from source")
306302
}
307303
}
308304
}

β€Žandroid/app/src/main/java/com/leotm/myapp/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,12 @@ protected ReactRootView createRootView() {
3737
reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED);
3838
return reactRootView;
3939
}
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+
}
4047
}
4148
}

β€Žandroid/app/src/main/java/com/leotm/myapp/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.leotm.myapp.BuildConfig;
2323
import com.leotm.myapp.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/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
# https://services.gradle.org/distributions
44
# https://gradle.org/nightly
5-
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.5-20220331233901+0000-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
66
zipStoreBase=GRADLE_USER_HOME
77
zipStorePath=wrapper/dists

β€Ž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/MyApp.xcodeproj/project.pbxproj

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,15 @@
261261
files = (
262262
);
263263
inputPaths = (
264+
"$(SRCROOT)/.xcode.env.local",
265+
"$(SRCROOT)/.xcode.env",
264266
);
265267
name = "Bundle React Native code and images";
266268
outputPaths = (
267269
);
268270
runOnlyForDeploymentPostprocessing = 0;
269271
shellPath = /bin/sh;
270-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
272+
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
271273
};
272274
295DF23B7F8DCF5118F3DEC8 /* [CP] Embed Pods Frameworks */ = {
273275
isa = PBXShellScriptBuildPhase;
@@ -457,7 +459,7 @@
457459
"$(inherited)",
458460
);
459461
INFOPLIST_FILE = MyAppTests/Info.plist;
460-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
462+
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
461463
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
462464
OTHER_CFLAGS = (
463465
"$(inherited)",
@@ -481,7 +483,7 @@
481483
BUNDLE_LOADER = "$(TEST_HOST)";
482484
COPY_PHASE_STRIP = NO;
483485
INFOPLIST_FILE = MyAppTests/Info.plist;
484-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
486+
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
485487
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
486488
OTHER_CFLAGS = (
487489
"$(inherited)",
@@ -604,7 +606,7 @@
604606
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
605607
GCC_WARN_UNUSED_FUNCTION = YES;
606608
GCC_WARN_UNUSED_VARIABLE = YES;
607-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
609+
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
608610
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
609611
LIBRARY_SEARCH_PATHS = (
610612
"$(SDKROOT)/usr/lib/swift",
@@ -613,6 +615,13 @@
613615
);
614616
MTL_ENABLE_DEBUG_INFO = YES;
615617
ONLY_ACTIVE_ARCH = YES;
618+
OTHER_CPLUSPLUSFLAGS = (
619+
"$(OTHER_CFLAGS)",
620+
"-DFOLLY_NO_CONFIG",
621+
"-DFOLLY_MOBILE=1",
622+
"-DFOLLY_USE_LIBCPP=1",
623+
);
624+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
616625
SDKROOT = iphoneos;
617626
};
618627
name = Debug;
@@ -658,14 +667,21 @@
658667
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
659668
GCC_WARN_UNUSED_FUNCTION = YES;
660669
GCC_WARN_UNUSED_VARIABLE = YES;
661-
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
670+
IPHONEOS_DEPLOYMENT_TARGET = 12.4;
662671
LD_RUNPATH_SEARCH_PATHS = "/usr/lib/swift $(inherited)";
663672
LIBRARY_SEARCH_PATHS = (
664673
"$(SDKROOT)/usr/lib/swift",
665674
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
666675
"\"$(inherited)\"",
667676
);
668677
MTL_ENABLE_DEBUG_INFO = NO;
678+
OTHER_CPLUSPLUSFLAGS = (
679+
"$(OTHER_CFLAGS)",
680+
"-DFOLLY_NO_CONFIG",
681+
"-DFOLLY_MOBILE=1",
682+
"-DFOLLY_USE_LIBCPP=1",
683+
);
684+
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
669685
SDKROOT = iphoneos;
670686
VALIDATE_PRODUCT = YES;
671687
};

0 commit comments

Comments
Β (0)