From abed02f979994e36f36baf57b7be36d7016f8d28 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Thu, 9 Feb 2023 10:50:54 +0100 Subject: [PATCH] Enable new arch in the example app --- example/android/build.gradle | 18 +++++++++++++++++- example/android/gradle.properties | 4 +++- .../contents.xcworkspacedata | 3 +++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/example/android/build.gradle b/example/android/build.gradle index a04a9d47..6cbf2182 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -28,6 +28,7 @@ task fetchDependencies() { buildscript { def androidTestAppDir = "../../node_modules/react-native-test-app/android" apply from: "$androidTestAppDir/dependencies.gradle" + apply from: "${androidTestAppDir}/test-app-util.gradle" // Mainly for Detox testing for using Next Storage // when building next, force using next storage @@ -43,11 +44,26 @@ buildscript { } dependencies { - classpath "com.android.tools.build:gradle:$androidPluginVersion" + getReactNativeDependencies().each { dependency -> + classpath(dependency) + } + + if (isNewArchitectureEnabled(project)) { + classpath("com.facebook.react:react-native-gradle-plugin") + classpath("de.undercouch:gradle-download-task:5.1.0") + } } } allprojects { + // TODO: remove when https://github.com/facebook/react-native/issues/35495 is fixed + project.pluginManager.withPlugin("com.facebook.react") { + react { + reactNativeDir = rootProject.file("../../node_modules/react-native/") + codegenDir = rootProject.file("../../node_modules/react-native-codegen/") + } + } + repositories { maven { url("$rootDir/../../node_modules/detox/Detox-android") diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 6b1dc5a2..00535e85 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -36,7 +36,7 @@ android.enableJetifier=true # Enable new architecture, i.e. Fabric + TurboModule - implies USE_FABRIC=1. # Note that this is incompatible with web debugging. -#newArchEnabled=true +newArchEnabled=true # Uncomment the line below if building react-native from source #ANDROID_NDK_VERSION=21.4.7075529 @@ -50,3 +50,5 @@ KOTLIN_VERSION=1.6.21 # Enable dedicated thread pool executor AsyncStorage_dedicatedExecutor=true AsyncStorage_useNextStorage=true + +REACT_NATIVE_NODE_MODULES_DIR=../node_modules/react-native diff --git a/example/ios/AsyncStorageExample.xcworkspace/contents.xcworkspacedata b/example/ios/AsyncStorageExample.xcworkspace/contents.xcworkspacedata index 7b3c0ff9..02c60077 100644 --- a/example/ios/AsyncStorageExample.xcworkspace/contents.xcworkspacedata +++ b/example/ios/AsyncStorageExample.xcworkspace/contents.xcworkspacedata @@ -7,4 +7,7 @@ + +