Skip to content

Commit

Permalink
Do not use App node modules when runing in context of screens repo
Browse files Browse the repository at this point in the history
  • Loading branch information
kkafar committed Jun 17, 2024
1 parent 3549dd5 commit 2c418aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +35,7 @@ def isNewArchitectureEnabled() {
}

// spotless is only accessible within react-native-screens repo
if (project == rootProject) {
if (isRunningInContextOfScreensRepo()) {
apply from: 'spotless.gradle'
}

Expand All @@ -58,7 +62,7 @@ def resolveReactNativeDirectory() {
}

def reactNativeFromAppNodeModules = file("${projectDir}/../../react-native")
if (reactNativeFromAppNodeModules.exists()) {
if (!isRunningInContextOfScreensRepo() && reactNativeFromAppNodeModules.exists()) {
return reactNativeFromAppNodeModules
}

Expand All @@ -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."
)
}

Expand Down

0 comments on commit 2c418aa

Please sign in to comment.