From 2c418aa866685e7470677ed73588e19f235d127a Mon Sep 17 00:00:00 2001 From: Kacper Kafara Date: Mon, 17 Jun 2024 11:14:38 +0200 Subject: [PATCH] Do not use App node modules when runing in context of screens repo --- android/build.gradle | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 89ea486f6d..b2a4b88a15 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -22,6 +22,10 @@ buildscript { } } +def isRunningInContextOfScreensRepo() { + return project == rootProject +} + def isNewArchitectureEnabled() { // To opt-in for the New Architecture, you can either: // - Set `newArchEnabled` to true inside the `gradle.properties` file @@ -31,7 +35,7 @@ def isNewArchitectureEnabled() { } // spotless is only accessible within react-native-screens repo -if (project == rootProject) { +if (isRunningInContextOfScreensRepo()) { apply from: 'spotless.gradle' } @@ -58,7 +62,7 @@ def resolveReactNativeDirectory() { } def reactNativeFromAppNodeModules = file("${projectDir}/../../react-native") - if (reactNativeFromAppNodeModules.exists()) { + if (!isRunningInContextOfScreensRepo() && reactNativeFromAppNodeModules.exists()) { return reactNativeFromAppNodeModules } @@ -68,7 +72,7 @@ def resolveReactNativeDirectory() { } throw new GradleException( - "[RNScreens] Unable to resolve react-native location in node_modules. You should project extension property (in `app/build.gradle`) `REACT_NATIVE_NODE_MODULES_DIR` with path to react-native." + "[RNScreens] Unable to resolve react-native location in node_modules. You should add project extension property (in `app/build.gradle`) `REACT_NATIVE_NODE_MODULES_DIR` with path to react-native." ) }