Skip to content

Commit cd11f31

Browse files
Remove bridgelessEnabled from DefaultNewArchitectureEntryPoint
Summary: Bridgeless is the only supported mode in the New Architecture, so the `bridgelessEnabled` flag on `DefaultNewArchitectureEntryPoint` was dead configuration: every `load(...)` path passed `true`, and `isConfigurationValid` raised an error when it was `false`. The entry point advertised a toggle that could only ever hold the one value that is already mandatory. This removes that surface from `ReactAndroid`: - Removed the public `bridgelessEnabled` getter and its backing field. - Removed the deprecated three-argument `load(turboModulesEnabled, fabricEnabled, bridgelessEnabled)` overload. Its implementation body moved into the two-argument overload, since dropping the parameter alone would have collided with the existing `load(Boolean, Boolean)` signature. - Removed the `bridgelessEnabled` parameter from `isConfigurationValid`, reducing the guard to `!turboModulesEnabled || !fabricEnabled` and shortening the resulting error message. - `loadWithFeatureFlags` no longer reads `enableBridgelessArchitecture()`. Behavior note: `loadWithFeatureFlags` previously raised an error when a feature flags provider returned `enableBridgelessArchitecture() == false`. That check is gone. It was unreachable in practice because bridgeless is not optional, but it is a removed validation rather than a pure no-op cleanup. Bridgeless remains unconditionally enabled. Callers using the no-argument `load()` are unaffected. The regenerated `ReactAndroid.api` drops exactly `getBridgelessEnabled ()Z`, `load (ZZZ)V`, and `load$default (ZZZILjava/lang/Object;)V`. The equivalent iOS cleanup is intentionally left to a follow-up change. Changelog: [Android][Breaking] - Remove `DefaultNewArchitectureEntryPoint.bridgelessEnabled` and the deprecated three-argument `load(turboModulesEnabled, fabricEnabled, bridgelessEnabled)` overload; bridgeless is always enabled in the New Architecture Differential Revision: D116317210
1 parent b830082 commit cd11f31

3 files changed

Lines changed: 16 additions & 103 deletions

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,18 +1768,15 @@ public final class com/facebook/react/defaults/DefaultComponentsRegistry {
17681768

17691769
public final class com/facebook/react/defaults/DefaultNewArchitectureEntryPoint {
17701770
public static final field INSTANCE Lcom/facebook/react/defaults/DefaultNewArchitectureEntryPoint;
1771-
public static final fun getBridgelessEnabled ()Z
17721771
public static final fun getConcurrentReactEnabled ()Z
17731772
public static final fun getFabricEnabled ()Z
17741773
public final fun getReleaseLevel ()Lcom/facebook/react/common/ReleaseLevel;
17751774
public static final fun getTurboModulesEnabled ()Z
17761775
public static final fun load ()V
17771776
public static final fun load (Z)V
17781777
public static final fun load (ZZ)V
1779-
public static final fun load (ZZZ)V
17801778
public static synthetic fun load$default (ZILjava/lang/Object;)V
17811779
public static synthetic fun load$default (ZZILjava/lang/Object;)V
1782-
public static synthetic fun load$default (ZZZILjava/lang/Object;)V
17831780
public final fun setReleaseLevel (Lcom/facebook/react/common/ReleaseLevel;)V
17841781
}
17851782

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt

Lines changed: 9 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -40,50 +40,34 @@ public object DefaultNewArchitectureEntryPoint {
4040
*/
4141
@JvmStatic
4242
public fun load() {
43-
load(turboModulesEnabled = true, fabricEnabled = true, bridgelessEnabled = true)
43+
load(turboModulesEnabled = true, fabricEnabled = true)
4444
}
4545

4646
@JvmStatic
4747
@Deprecated(
4848
message =
49-
"Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." +
50-
"Please use load() instead when loading the New Architecture.",
49+
"Loading the entry point with different flags for Fabric and TurboModule is deprecated." +
50+
" Please use load() instead when loading the New Architecture.",
5151
replaceWith = ReplaceWith("load()"),
5252
)
5353
public fun load(
5454
turboModulesEnabled: Boolean = true,
5555
) {
56-
load(turboModulesEnabled, fabricEnabled = true, bridgelessEnabled = true)
56+
load(turboModulesEnabled, fabricEnabled = true)
5757
}
5858

5959
@JvmStatic
6060
@Deprecated(
6161
message =
62-
"Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." +
63-
"Please use load() instead when loading the New Architecture.",
62+
"Loading the entry point with different flags for Fabric and TurboModule is deprecated." +
63+
" Please use load() instead when loading the New Architecture.",
6464
replaceWith = ReplaceWith("load()"),
6565
)
6666
public fun load(
6767
turboModulesEnabled: Boolean = true,
6868
fabricEnabled: Boolean = true,
6969
) {
70-
load(turboModulesEnabled, fabricEnabled, bridgelessEnabled = true)
71-
}
72-
73-
@JvmStatic
74-
@Deprecated(
75-
message =
76-
"Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." +
77-
"Please use load() instead when loading the New Architecture.",
78-
replaceWith = ReplaceWith("load()"),
79-
)
80-
public fun load(
81-
turboModulesEnabled: Boolean = true,
82-
fabricEnabled: Boolean = true,
83-
bridgelessEnabled: Boolean = true,
84-
) {
85-
val (isValid, errorMessage) =
86-
isConfigurationValid(turboModulesEnabled, fabricEnabled, bridgelessEnabled)
70+
val (isValid, errorMessage) = isConfigurationValid(turboModulesEnabled, fabricEnabled)
8771
if (!isValid) {
8872
error(errorMessage)
8973
}
@@ -103,7 +87,6 @@ public object DefaultNewArchitectureEntryPoint {
10387
}
10488

10589
privateTurboModulesEnabled = turboModulesEnabled
106-
privateBridgelessEnabled = bridgelessEnabled
10790

10891
DefaultSoLoader.maybeLoadSoLibrary()
10992
}
@@ -113,17 +96,6 @@ public object DefaultNewArchitectureEntryPoint {
11396
ReactNativeFeatureFlags.override(featureFlags)
11497

11598
privateTurboModulesEnabled = true
116-
privateBridgelessEnabled = featureFlags.enableBridgelessArchitecture()
117-
118-
val (isValid, errorMessage) =
119-
isConfigurationValid(
120-
privateTurboModulesEnabled,
121-
true,
122-
privateBridgelessEnabled,
123-
)
124-
if (!isValid) {
125-
error(errorMessage)
126-
}
12799

128100
DefaultSoLoader.maybeLoadSoLibrary()
129101
}
@@ -142,24 +114,17 @@ public object DefaultNewArchitectureEntryPoint {
142114
public val concurrentReactEnabled: Boolean
143115
get() = true
144116

145-
private var privateBridgelessEnabled: Boolean = false
146-
147-
@JvmStatic
148-
public val bridgelessEnabled: Boolean
149-
get() = privateBridgelessEnabled
150-
151117
@VisibleForTesting
152118
public fun isConfigurationValid(
153119
turboModulesEnabled: Boolean,
154120
fabricEnabled: Boolean,
155-
bridgelessEnabled: Boolean,
156121
): Pair<Boolean, String> =
157-
if (!turboModulesEnabled || !fabricEnabled || !bridgelessEnabled) {
122+
if (!turboModulesEnabled || !fabricEnabled) {
158123
false to
159124
"You cannot load React Native with the New Architecture disabled. " +
160125
"Please use DefaultNewArchitectureEntryPoint.load() instead of " +
161126
"DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=$turboModulesEnabled, " +
162-
"fabricEnabled=$fabricEnabled, bridgelessEnabled=$bridgelessEnabled)"
127+
"fabricEnabled=$fabricEnabled)"
163128
} else {
164129
true to ""
165130
}

packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,11 @@ class DefaultNewArchitectureEntryPointTest {
1818
DefaultNewArchitectureEntryPoint.isConfigurationValid(
1919
turboModulesEnabled = false,
2020
fabricEnabled = false,
21-
bridgelessEnabled = false,
2221
)
2322
assertThat(isValid).isFalse()
2423
assertThat(errorMessage)
2524
.isEqualTo(
26-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=false, bridgelessEnabled=false)",
27-
)
28-
}
29-
30-
@Test
31-
fun isConfigurationValid_withNewArchOnlyOn_returnsFalse() {
32-
val (isValid, errorMessage) =
33-
DefaultNewArchitectureEntryPoint.isConfigurationValid(
34-
turboModulesEnabled = true,
35-
fabricEnabled = true,
36-
bridgelessEnabled = false,
37-
)
38-
assertThat(isValid).isFalse()
39-
assertThat(errorMessage)
40-
.isEqualTo(
41-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=true, bridgelessEnabled=false)",
25+
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=false)",
4226
)
4327
}
4428

@@ -48,24 +32,12 @@ class DefaultNewArchitectureEntryPointTest {
4832
DefaultNewArchitectureEntryPoint.isConfigurationValid(
4933
turboModulesEnabled = true,
5034
fabricEnabled = false,
51-
bridgelessEnabled = false,
5235
)
5336
assertThat(isValid).isFalse()
5437
assertThat(errorMessage)
5538
.isEqualTo(
56-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false, bridgelessEnabled=false)",
57-
)
58-
}
59-
60-
@Test
61-
fun isConfigurationValid_withBridgelessOn_returnsTrue() {
62-
val (isValid, _) =
63-
DefaultNewArchitectureEntryPoint.isConfigurationValid(
64-
turboModulesEnabled = true,
65-
fabricEnabled = true,
66-
bridgelessEnabled = true,
39+
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false)",
6740
)
68-
assertThat(isValid).isTrue()
6941
}
7042

7143
@Test
@@ -74,42 +46,21 @@ class DefaultNewArchitectureEntryPointTest {
7446
DefaultNewArchitectureEntryPoint.isConfigurationValid(
7547
turboModulesEnabled = false,
7648
fabricEnabled = true,
77-
bridgelessEnabled = false,
7849
)
7950
assertThat(isValid).isFalse()
8051
assertThat(errorMessage)
8152
.isEqualTo(
82-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true, bridgelessEnabled=false)",
53+
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true)",
8354
)
8455
}
8556

8657
@Test
87-
fun isConfigurationValid_withBridgelessWithoutTurboModules_returnsFalse() {
88-
val (isValid, errorMessage) =
89-
DefaultNewArchitectureEntryPoint.isConfigurationValid(
90-
turboModulesEnabled = false,
91-
fabricEnabled = true,
92-
bridgelessEnabled = true,
93-
)
94-
assertThat(isValid).isFalse()
95-
assertThat(errorMessage)
96-
.isEqualTo(
97-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true, bridgelessEnabled=true)",
98-
)
99-
}
100-
101-
@Test
102-
fun isConfigurationValid_withBridgelessWithoutFabric_returnsFalse() {
103-
val (isValid, errorMessage) =
58+
fun isConfigurationValid_withEverythingOn_returnsTrue() {
59+
val (isValid, _) =
10460
DefaultNewArchitectureEntryPoint.isConfigurationValid(
10561
turboModulesEnabled = true,
106-
fabricEnabled = false,
107-
bridgelessEnabled = true,
108-
)
109-
assertThat(isValid).isFalse()
110-
assertThat(errorMessage)
111-
.isEqualTo(
112-
"You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false, bridgelessEnabled=true)",
62+
fabricEnabled = true,
11363
)
64+
assertThat(isValid).isTrue()
11465
}
11566
}

0 commit comments

Comments
 (0)