Skip to content

Commit d3138e9

Browse files
authored
fix(android): force enable New Architecture from 0.77 (#2314)
As of 0.77, New Architecture is assumed on and doesn't build otherwise.
1 parent 51df7f1 commit d3138e9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

android/react-native.gradle

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,13 @@ ext.isFabricEnabled = { Project project ->
3636
}
3737

3838
ext.isNewArchitectureEnabled = { Project project ->
39-
def newArchEnabled = project.findProperty("react.newArchEnabled")
40-
?: project.findProperty("newArchEnabled")
39+
def NEW_ARCH_ENABLED = "newArchEnabled"
40+
def SCOPED_NEW_ARCH_ENABLED = "react.newArchEnabled"
41+
42+
def newArchEnabled = project.findProperty(SCOPED_NEW_ARCH_ENABLED)
43+
?: project.findProperty(NEW_ARCH_ENABLED)
44+
def version = getPackageVersionNumber("react-native", project.rootDir)
4145
if (newArchEnabled == "true") {
42-
def version = getPackageVersionNumber("react-native", project.rootDir)
4346
def isSupported = version == 0 || version >= v(0, 71, 0)
4447
if (!isSupported) {
4548
throw new GradleException([
@@ -50,5 +53,13 @@ ext.isNewArchitectureEnabled = { Project project ->
5053
}
5154
return isSupported
5255
}
53-
return false
56+
57+
if (version < v(0, 77, 0)) {
58+
return false
59+
}
60+
61+
// As of 0.77, New Architecture is assumed on and doesn't build otherwise
62+
project.ext[NEW_ARCH_ENABLED] = "true"
63+
project.ext[SCOPED_NEW_ARCH_ENABLED] = "true"
64+
return true
5465
}

0 commit comments

Comments
 (0)