diff --git a/package.json b/package.json index 0789cf8c1eb44..ea7760607b59e 100644 --- a/package.json +++ b/package.json @@ -183,7 +183,7 @@ "license-webpack-plugin": "^4.0.2", "loader-utils": "1.2.3", "memfs": "^3.0.1", - "metro-resolver": "^0.71.1", + "metro-resolver": "^0.71.2", "mime": "2.4.4", "mini-css-extract-plugin": "~2.4.7", "minimatch": "3.0.5", diff --git a/packages/react-native/migrations.json b/packages/react-native/migrations.json index 5b5e1dd73f4f4..a86fd08b63880 100644 --- a/packages/react-native/migrations.json +++ b/packages/react-native/migrations.json @@ -675,6 +675,63 @@ "alwaysAddToPackageJson": false } } + }, + "14.4.3": { + "version": "14.4.3-beta.0", + "packages": { + "metro": { + "version": "0.71.2", + "alwaysAddToPackageJson": false + }, + "metro-resolver": { + "version": "0.71.2", + "alwaysAddToPackageJson": false + }, + "metro-babel-register": { + "version": "0.71.2", + "alwaysAddToPackageJson": false + }, + "metro-config": { + "version": "0.71.2", + "alwaysAddToPackageJson": false + }, + "metro-react-native-babel-preset": { + "version": "0.71.2", + "alwaysAddToPackageJson": false + }, + "@react-native-community/cli": { + "version": "8.0.2", + "alwaysAddToPackageJson": false + }, + "@react-native-community/cli-platform-android": { + "version": "8.0.2", + "alwaysAddToPackageJson": false + }, + "@react-native-community/cli-platform-ios": { + "version": "8.0.2", + "alwaysAddToPackageJson": false + }, + "react-native": { + "version": "0.69.1", + "alwaysAddToPackageJson": false + }, + "@types/react-native": { + "version": "0.69.2", + "alwaysAddToPackageJson": false + }, + "@react-native-async-storage/async-storage": { + "version": "1.17.7", + "alwaysAddToPackageJson": false + }, + "@testing-library/react-native": { + "version": "7.2.0", + "alwaysAddToPackageJson": false + }, + "@babel/runtime": { + "version": "7.18.6", + "alwaysAddToPackageJson": false + } + } } } } diff --git a/packages/react-native/package.json b/packages/react-native/package.json index 25dc0e745929c..980390ec487c9 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -35,12 +35,12 @@ "enhanced-resolve": "^5.8.3", "fs-extra": "^10.1.0", "ignore": "^5.0.4", - "metro-resolver": "^0.71.1", + "metro-resolver": "^0.71.2", "node-fetch": "^2.6.7", "tsconfig-paths": "^3.9.0" }, "peerDependencies": { - "react-native": "^0.68.2" + "react-native": "^0.69.1" }, "builders": "./executors.json", "ng-update": { diff --git a/packages/react-native/src/generators/application/files/app/android/app/build.gradle.template b/packages/react-native/src/generators/application/files/app/android/app/build.gradle.template index f208e83ba5aa0..6c1457766df57 100644 --- a/packages/react-native/src/generators/application/files/app/android/app/build.gradle.template +++ b/packages/react-native/src/generators/application/files/app/android/app/build.gradle.template @@ -2,7 +2,6 @@ apply plugin: "com.android.application" apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" import com.android.build.OutputFile -import org.apache.tools.ant.taskdefs.condition.Os /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets @@ -160,16 +159,13 @@ android { "GENERATED_SRC_DIR=$buildDir/generated/source", "PROJECT_BUILD_DIR=$buildDir", "REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", - "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build" + "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", + "NODE_MODULES_DIR=$rootDir/../node_modules" cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1" cppFlags "-std=c++17" // Make sure this target name is the same you specify inside the // src/main/jni/Android.mk file for the `LOCAL_MODULE` variable. targets "<%= lowerCaseName %>_appmodules" - // Fix for windows limit on number of character in file paths and in command lines - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - arguments "NDK_APP_SHORT_COMMANDS=true" - } } } if (!enableSeparateBuildPerCPUArchitecture) { @@ -246,8 +242,7 @@ android { // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds - // Typical pro-guard definitions - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" <% if (e2eTestRunner === 'detox') { %> // Detox-specific additions to pro-guard proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro" @@ -295,9 +290,10 @@ dependencies { } if (enableHermes) { - def hermesPath = "../../node_modules/hermes-engine/android/"; - debugImplementation files(hermesPath + "hermes-debug.aar") - releaseImplementation files(hermesPath + "hermes-release.aar") + //noinspection GradleDynamicVersion + implementation("com.facebook.react:hermes-engine:+") { // From node_modules + exclude group:'com.facebook.fbjni' + } } else { implementation jscFlavor } @@ -314,7 +310,11 @@ if (isNewArchitectureEnabled()) { configurations.all { resolutionStrategy.dependencySubstitution { substitute(module("com.facebook.react:react-native")) - .using(project(":ReactAndroid")).because("On New Architecture we're building React Native from source") + .using(project(":ReactAndroid")) + .because("On New Architecture we're building React Native from source") + substitute(module("com.facebook.react:hermes-engine")) + .using(project(":ReactAndroid:hermes-engine")) + .because("On New Architecture we're building Hermes from source") } } } diff --git a/packages/react-native/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template b/packages/react-native/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template index f3801bcafd9fc..2a750fbcf2080 100644 --- a/packages/react-native/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +++ b/packages/react-native/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template @@ -9,8 +9,7 @@ android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" - android:theme="@style/AppTheme" - android:networkSecurityConfig="@xml/network_security_config"> + android:theme="@style/AppTheme"> .BuildConfig; import com.<%= lowerCaseName %>.newarchitecture.components.MainComponentsRegistry; @@ -105,7 +105,7 @@ public class MainApplicationReactNativeHost extends ReactNativeHost { return new FabricJSIModuleProvider( reactApplicationContext, componentFactory, - new EmptyReactNativeConfig(), + ReactNativeConfig.DEFAULT_CONFIG, viewManagerRegistry); } }); diff --git a/packages/react-native/src/generators/application/files/app/android/app/src/main/jni/Android.mk.template b/packages/react-native/src/generators/application/files/app/android/app/src/main/jni/Android.mk.template index 3547cd40b7362..3d2e7203f3afe 100644 --- a/packages/react-native/src/generators/application/files/app/android/app/src/main/jni/Android.mk.template +++ b/packages/react-native/src/generators/application/files/app/android/app/src/main/jni/Android.mk.template @@ -17,7 +17,7 @@ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) # If you wish to add a custom TurboModule or Fabric component in your app you -# will have to uncomment those lines to include the generated source +# will have to uncomment those lines to include the generated source # files from the codegen (placed in $(GENERATED_SRC_DIR)/codegen/jni) # # LOCAL_C_INCLUDES += $(GENERATED_SRC_DIR)/codegen/jni @@ -28,8 +28,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_SHARED_LIBRARIES := \ libfabricjni \ libfbjni \ - libfolly_futures \ - libfolly_json \ + libfolly_runtime \ libglog \ libjsi \ libreact_codegen_rncore \ diff --git a/packages/react-native/src/generators/application/files/app/android/build.gradle.template b/packages/react-native/src/generators/application/files/app/android/build.gradle.template index ef33f2c6d8b48..96401f27c62ec 100644 --- a/packages/react-native/src/generators/application/files/app/android/build.gradle.template +++ b/packages/react-native/src/generators/application/files/app/android/build.gradle.template @@ -9,7 +9,7 @@ buildscript { compileSdkVersion = 31 targetSdkVersion = 31 <% if (e2eTestRunner === 'detox') { %> - kotlinVersion = '1.6.21' + kotlinVersion = '1.7.0' <% } %> if (System.properties['os.arch'] == "aarch64") { @@ -25,9 +25,9 @@ buildscript { mavenCentral() } dependencies { - classpath("com.android.tools.build:gradle:7.0.4") + classpath("com.android.tools.build:gradle:7.1.1") classpath("com.facebook.react:react-native-gradle-plugin") - classpath("de.undercouch:gradle-download-task:4.1.2") + classpath("de.undercouch:gradle-download-task:5.0.1") <% if (e2eTestRunner === 'detox') { %> classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" <% } %> diff --git a/packages/react-native/src/generators/application/files/app/android/settings.gradle.template b/packages/react-native/src/generators/application/files/app/android/settings.gradle.template index e1644ef15c704..8fcce31e02357 100644 --- a/packages/react-native/src/generators/application/files/app/android/settings.gradle.template +++ b/packages/react-native/src/generators/application/files/app/android/settings.gradle.template @@ -17,4 +17,6 @@ includeBuild('../node_modules/react-native-gradle-plugin') if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { include(":ReactAndroid") project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid') + include(":ReactAndroid:hermes-engine") + project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine') } diff --git a/packages/react-native/src/generators/application/files/app/ios/.xcode.env.template b/packages/react-native/src/generators/application/files/app/ios/.xcode.env.template new file mode 100644 index 0000000000000..87bd401bc80f7 --- /dev/null +++ b/packages/react-native/src/generators/application/files/app/ios/.xcode.env.template @@ -0,0 +1,12 @@ +# This `.xcode.env` file is versioned and is used to source the environment +# used when running script phases inside Xcode. +# To customize your local environment, you can create an `.xcode.env.local` +# file that is not versioned. + +# NODE_BINARY variable contains the PATH to the node executable. +# +# Customize the NODE_BINARY variable here. +# For example, to use nvm with brew, add the following line +# . "$(brew --prefix nvm)/nvm.sh" --no-use +export NODE_BINARY=$(command -v node) +export ENTRY_FILE=$(PROJECT_DIR)/../<%= entryFile %> diff --git a/packages/react-native/src/generators/application/files/app/ios/Podfile.template b/packages/react-native/src/generators/application/files/app/ios/Podfile.template index 10ef39d98ec83..d6dc1cd1218fd 100644 --- a/packages/react-native/src/generators/application/files/app/ios/Podfile.template +++ b/packages/react-native/src/generators/application/files/app/ios/Podfile.template @@ -2,7 +2,7 @@ require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/@nrwl/react-native/nx_post_install' -platform :ios, '11.0' +platform :ios, '12.4' install! 'cocoapods', :deterministic_uuids => false target '<%= className %>' do diff --git a/packages/react-native/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template b/packages/react-native/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template index 5afd94e9409a2..806cd7bda102e 100644 --- a/packages/react-native/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +++ b/packages/react-native/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template @@ -256,13 +256,15 @@ files = ( ); inputPaths = ( + "$(SRCROOT)/.xcode.env.local", + "$(SRCROOT)/.xcode.env", ); name = "Bundle React Native code and images"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "set -e\n\nexport NODE_BINARY=node\nexport ENTRY_FILE=${PROJECT_DIR}/../<%= entryFile %>\n../node_modules/react-native/scripts/react-native-xcode.sh\n"; + 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"; }; 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; @@ -436,7 +438,7 @@ "$(inherited)", ); INFOPLIST_FILE = <%= className %>Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -460,7 +462,7 @@ BUNDLE_LOADER = "$(TEST_HOST)"; COPY_PHASE_STRIP = NO; INFOPLIST_FILE = <%= className %>Tests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -576,7 +578,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", @@ -594,6 +596,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; name = Debug; @@ -640,7 +643,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( /usr/lib/swift, "$(inherited)", @@ -657,6 +660,7 @@ "-DFOLLY_MOBILE=1", "-DFOLLY_USE_LIBCPP=1", ); + REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; diff --git a/packages/react-native/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template b/packages/react-native/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template index a20b9942bd5d8..3ffcb6f42b2a7 100644 --- a/packages/react-native/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +++ b/packages/react-native/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template @@ -16,6 +16,8 @@ #import +static NSString *const kRNConcurrentRoot = @"concurrentRoot"; + @interface AppDelegate () { RCTTurboModuleManager *_turboModuleManager; RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; @@ -41,7 +43,8 @@ bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; #endif - UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"<%= className %>", nil); + NSDictionary *initProps = [self prepareInitialProps]; + UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"<%= className %>", initProps); if (@available(iOS 13.0, *)) { rootView.backgroundColor = [UIColor systemBackgroundColor]; @@ -57,6 +60,28 @@ return YES; } +/// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. +/// +/// @see: https://reactjs.org/blog/2022/03/29/react-v18.html +/// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). +/// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`. +- (BOOL)concurrentRootEnabled +{ + // Switch this bool to turn on and off the concurrent root + return true; +} + +- (NSDictionary *)prepareInitialProps +{ + NSMutableDictionary *initProps = [NSMutableDictionary new]; + +#ifdef RCT_NEW_ARCH_ENABLED + initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); +#endif + + return initProps; +} + - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG diff --git a/packages/react-native/src/generators/init/lib/gitignore-entries.ts b/packages/react-native/src/generators/init/lib/gitignore-entries.ts index d85f4cb77abac..a68ef0f0dacd2 100644 --- a/packages/react-native/src/generators/init/lib/gitignore-entries.ts +++ b/packages/react-native/src/generators/init/lib/gitignore-entries.ts @@ -19,6 +19,7 @@ DerivedData *.hmap *.ipa *.xcuserstate +**/ios/.xcode.env.local # Android/IntelliJ # @@ -48,9 +49,10 @@ buck-out/ # For more information about the recommended setup visit: # https://docs.fastlane.tools/best-practices/source-control/ -*/fastlane/report.xml -*/fastlane/Preview.html -*/fastlane/screenshots +**/fastlane/report.xml +**/fastlane/Preview.html +**/fastlane/screenshots +**/fastlane/test_output # Bundle artifact *.jsbundle diff --git a/packages/react-native/src/utils/versions.ts b/packages/react-native/src/utils/versions.ts index e654f463646ef..b6ec50043fad9 100644 --- a/packages/react-native/src/utils/versions.ts +++ b/packages/react-native/src/utils/versions.ts @@ -1,20 +1,20 @@ export const nxVersion = require('../../package.json').version; -export const reactNativeVersion = '0.68.2'; -export const typesReactNativeVersion = '0.67.8'; +export const reactNativeVersion = '0.69.1'; +export const typesReactNativeVersion = '0.69.2'; export const typesNodeVersion = '16.11.7'; -export const metroVersion = '0.71.1'; +export const metroVersion = '0.71.2'; -export const reactNativeCommunityCli = '7.0.3'; -export const reactNativeCommunityCliIos = '7.0.1'; -export const reactNativeCommunityCliAndroid = '7.0.1'; +export const reactNativeCommunityCli = '8.0.2'; +export const reactNativeCommunityCliIos = '8.0.2'; +export const reactNativeCommunityCliAndroid = '8.0.2'; export const reactNativeConfigVersion = '1.4.6'; -export const reactNativeAsyncStorageAsyncStorageVersion = '1.17.6'; +export const reactNativeAsyncStorageAsyncStorageVersion = '1.17.7'; -export const testingLibraryReactNativeVersion = '9.1.0'; +export const testingLibraryReactNativeVersion = '10.1.1'; export const testingLibraryJestNativeVersion = '4.0.5'; export const jestReactNativeVersion = '18.0.0'; @@ -22,4 +22,4 @@ export const jestReactNativeVersion = '18.0.0'; export const reactNativeSvgTransformerVersion = '1.0.0'; export const reactNativeSvgVersion = '12.3.0'; -export const babelRuntimeVersion = '7.18.3'; +export const babelRuntimeVersion = '7.18.6'; diff --git a/yarn.lock b/yarn.lock index 9ad921d7fe0ac..d97edc34c619c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17469,10 +17469,10 @@ methods@~1.1.2: resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" integrity sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4= -metro-resolver@^0.71.1: - version "0.71.1" - resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.71.1.tgz#50fa4eabf1e2cd51e13967eeff7a3ec15f6bbd94" - integrity sha512-5pW5p/Kt54Z4YJ7s1VyxSbXOvU4ikjjIqD+2wkdzngTVm7pYxKQfauApe22ep7oxTFU55HeAwbjmjiM/ngFN2g== +metro-resolver@^0.71.2: + version "0.71.2" + resolved "https://registry.yarnpkg.com/metro-resolver/-/metro-resolver-0.71.2.tgz#4b136ef112656e75c268b880a436c30a20e7c1e9" + integrity sha512-kqP8hXUSyjfNtMlWw/E5m80KAerqRBlhO/Pc4EBORPlJXZz7b/OdzWrpJKclO6bTg7i/IHO/ThIH+jSjh1K5Cg== dependencies: absolute-path "^0.0.0"