From 61ec1c1365c18b90e1c414f09d7d340161119e9b Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 9 Sep 2026 18:37:37 -0700 Subject: [PATCH 1/3] Remove `bridgelessEnabled` from `DefaultNewArchitectureEntryPoint` (#58415) 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 Reviewed By: rubennorte Differential Revision: D116317210 --- .../ReactAndroid/api/ReactAndroid.api | 3 - .../DefaultNewArchitectureEntryPoint.kt | 53 +++------------- .../DefaultNewArchitectureEntryPointTest.kt | 63 +++---------------- 3 files changed, 16 insertions(+), 103 deletions(-) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index f4386d1bd1c7..46eb3027ed5a 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1768,7 +1768,6 @@ public final class com/facebook/react/defaults/DefaultComponentsRegistry { public final class com/facebook/react/defaults/DefaultNewArchitectureEntryPoint { public static final field INSTANCE Lcom/facebook/react/defaults/DefaultNewArchitectureEntryPoint; - public static final fun getBridgelessEnabled ()Z public static final fun getConcurrentReactEnabled ()Z public static final fun getFabricEnabled ()Z public final fun getReleaseLevel ()Lcom/facebook/react/common/ReleaseLevel; @@ -1776,10 +1775,8 @@ public final class com/facebook/react/defaults/DefaultNewArchitectureEntryPoint public static final fun load ()V public static final fun load (Z)V public static final fun load (ZZ)V - public static final fun load (ZZZ)V public static synthetic fun load$default (ZILjava/lang/Object;)V public static synthetic fun load$default (ZZILjava/lang/Object;)V - public static synthetic fun load$default (ZZZILjava/lang/Object;)V public final fun setReleaseLevel (Lcom/facebook/react/common/ReleaseLevel;)V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index 27576a5f9908..5dcfd13f8b1b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -40,50 +40,34 @@ public object DefaultNewArchitectureEntryPoint { */ @JvmStatic public fun load() { - load(turboModulesEnabled = true, fabricEnabled = true, bridgelessEnabled = true) + load(turboModulesEnabled = true, fabricEnabled = true) } @JvmStatic @Deprecated( message = - "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + - "Please use load() instead when loading the New Architecture.", + "Loading the entry point with different flags for Fabric and TurboModule is deprecated." + + " Please use load() instead when loading the New Architecture.", replaceWith = ReplaceWith("load()"), ) public fun load( turboModulesEnabled: Boolean = true, ) { - load(turboModulesEnabled, fabricEnabled = true, bridgelessEnabled = true) + load(turboModulesEnabled, fabricEnabled = true) } @JvmStatic @Deprecated( message = - "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + - "Please use load() instead when loading the New Architecture.", + "Loading the entry point with different flags for Fabric and TurboModule is deprecated." + + " Please use load() instead when loading the New Architecture.", replaceWith = ReplaceWith("load()"), ) public fun load( turboModulesEnabled: Boolean = true, fabricEnabled: Boolean = true, ) { - load(turboModulesEnabled, fabricEnabled, bridgelessEnabled = true) - } - - @JvmStatic - @Deprecated( - message = - "Loading the entry point with different flags for Fabric, TurboModule and Bridgeless is deprecated." + - "Please use load() instead when loading the New Architecture.", - replaceWith = ReplaceWith("load()"), - ) - public fun load( - turboModulesEnabled: Boolean = true, - fabricEnabled: Boolean = true, - bridgelessEnabled: Boolean = true, - ) { - val (isValid, errorMessage) = - isConfigurationValid(turboModulesEnabled, fabricEnabled, bridgelessEnabled) + val (isValid, errorMessage) = isConfigurationValid(turboModulesEnabled, fabricEnabled) if (!isValid) { error(errorMessage) } @@ -103,7 +87,6 @@ public object DefaultNewArchitectureEntryPoint { } privateTurboModulesEnabled = turboModulesEnabled - privateBridgelessEnabled = bridgelessEnabled DefaultSoLoader.maybeLoadSoLibrary() } @@ -113,17 +96,6 @@ public object DefaultNewArchitectureEntryPoint { ReactNativeFeatureFlags.override(featureFlags) privateTurboModulesEnabled = true - privateBridgelessEnabled = featureFlags.enableBridgelessArchitecture() - - val (isValid, errorMessage) = - isConfigurationValid( - privateTurboModulesEnabled, - true, - privateBridgelessEnabled, - ) - if (!isValid) { - error(errorMessage) - } DefaultSoLoader.maybeLoadSoLibrary() } @@ -142,24 +114,17 @@ public object DefaultNewArchitectureEntryPoint { public val concurrentReactEnabled: Boolean get() = true - private var privateBridgelessEnabled: Boolean = false - - @JvmStatic - public val bridgelessEnabled: Boolean - get() = privateBridgelessEnabled - @VisibleForTesting public fun isConfigurationValid( turboModulesEnabled: Boolean, fabricEnabled: Boolean, - bridgelessEnabled: Boolean, ): Pair = - if (!turboModulesEnabled || !fabricEnabled || !bridgelessEnabled) { + if (!turboModulesEnabled || !fabricEnabled) { false to "You cannot load React Native with the New Architecture disabled. " + "Please use DefaultNewArchitectureEntryPoint.load() instead of " + "DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=$turboModulesEnabled, " + - "fabricEnabled=$fabricEnabled, bridgelessEnabled=$bridgelessEnabled)" + "fabricEnabled=$fabricEnabled)" } else { true to "" } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt index ffddae1fe173..176daa683734 100644 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt +++ b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt @@ -18,27 +18,11 @@ class DefaultNewArchitectureEntryPointTest { DefaultNewArchitectureEntryPoint.isConfigurationValid( turboModulesEnabled = false, fabricEnabled = false, - bridgelessEnabled = false, ) assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=false, bridgelessEnabled=false)", - ) - } - - @Test - fun isConfigurationValid_withNewArchOnlyOn_returnsFalse() { - val (isValid, errorMessage) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = true, - fabricEnabled = true, - bridgelessEnabled = false, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=true, bridgelessEnabled=false)", + "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=false)", ) } @@ -48,24 +32,12 @@ class DefaultNewArchitectureEntryPointTest { DefaultNewArchitectureEntryPoint.isConfigurationValid( turboModulesEnabled = true, fabricEnabled = false, - bridgelessEnabled = false, ) assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false, bridgelessEnabled=false)", - ) - } - - @Test - fun isConfigurationValid_withBridgelessOn_returnsTrue() { - val (isValid, _) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = true, - fabricEnabled = true, - bridgelessEnabled = true, + "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false)", ) - assertThat(isValid).isTrue() } @Test @@ -74,42 +46,21 @@ class DefaultNewArchitectureEntryPointTest { DefaultNewArchitectureEntryPoint.isConfigurationValid( turboModulesEnabled = false, fabricEnabled = true, - bridgelessEnabled = false, ) assertThat(isValid).isFalse() assertThat(errorMessage) .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true, bridgelessEnabled=false)", + "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true)", ) } @Test - fun isConfigurationValid_withBridgelessWithoutTurboModules_returnsFalse() { - val (isValid, errorMessage) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = false, - fabricEnabled = true, - bridgelessEnabled = true, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true, bridgelessEnabled=true)", - ) - } - - @Test - fun isConfigurationValid_withBridgelessWithoutFabric_returnsFalse() { - val (isValid, errorMessage) = + fun isConfigurationValid_withEverythingOn_returnsTrue() { + val (isValid, _) = DefaultNewArchitectureEntryPoint.isConfigurationValid( turboModulesEnabled = true, - fabricEnabled = false, - bridgelessEnabled = true, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false, bridgelessEnabled=true)", + fabricEnabled = true, ) + assertThat(isValid).isTrue() } } From 1874b0b045be2cf7f21be8cf0324a194f4fb2f6e Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 9 Sep 2026 18:37:37 -0700 Subject: [PATCH 2/3] Remove `bridgelessEnabled` from `RCTRootViewFactoryConfiguration` (#58416) Summary: Follow-up to the Android change in the previous diff, applying the same cleanup to iOS. Bridgeless is the only supported mode, so the `bridgelessEnabled` surface on `RCTRootViewFactoryConfiguration` was already deprecated and hardcoded: the property was assigned `YES` in every initializer, the two deprecated initializers ignored the argument entirely, and `RCTDefaultReactNativeFactoryDelegate` returned `YES` unconditionally. Nothing read the value. Changes: - Removed the `bridgelessEnabled` property from `RCTRootViewFactoryConfiguration`. - Removed the two deprecated initializers `initWithBundleURLBlock:newArchEnabled:turboModuleEnabled:bridgelessEnabled:` and `initWithBundleURL:newArchEnabled:turboModuleEnabled:bridgelessEnabled:`. Both were marked `__deprecated` and discarded all arguments except the bundle URL, delegating to the designated initializer. - Removed the `bridgelessEnabled` method from `RCTDefaultReactNativeFactoryDelegate`. It was not declared in any header or protocol. - Updated the one caller in `RCTReactNativeFactory` to use `initWithBundleURLBlock:newArchEnabled:`. Behavior is unchanged: bridgeless remains unconditionally enabled. Callers of the designated `initWithBundleURLBlock:newArchEnabled:` and `initWithBundleURL:newArchEnabled:` initializers are unaffected. Changelog: [iOS][Breaking] - Remove the deprecated `bridgelessEnabled` property and the deprecated `initWithBundleURLBlock:newArchEnabled:turboModuleEnabled:bridgelessEnabled:` / `initWithBundleURL:newArchEnabled:turboModuleEnabled:bridgelessEnabled:` initializers from `RCTRootViewFactoryConfiguration`; bridgeless is always enabled Reviewed By: rubennorte Differential Revision: D116318829 --- .../RCTDefaultReactNativeFactoryDelegate.mm | 5 ---- .../AppDelegate/RCTReactNativeFactory.mm | 5 +--- .../AppDelegate/RCTRootViewFactory.h | 13 ---------- .../AppDelegate/RCTRootViewFactory.mm | 25 ------------------- .../api-snapshots/ReactAppleDebugCxx.api | 3 --- .../api-snapshots/ReactAppleNewarchCxx.api | 3 --- .../api-snapshots/ReactAppleReleaseCxx.api | 3 --- 7 files changed, 1 insertion(+), 56 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index df121982cd3d..e502a42a0262 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -116,11 +116,6 @@ - (BOOL)newArchEnabled return YES; } -- (BOOL)bridgelessEnabled -{ - return YES; -} - - (BOOL)fabricEnabled { return YES; diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index 7f2a346bf849..e4ee18ccb518 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -289,10 +289,7 @@ - (RCTRootViewFactory *)createRCTRootViewFactory }; RCTRootViewFactoryConfiguration *configuration = - [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock - newArchEnabled:YES - turboModuleEnabled:YES - bridgelessEnabled:YES]; + [[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock newArchEnabled:YES]; configuration.customizeRootView = ^(UIView *_Nonnull rootView) { [weakSelf.delegate customizeRootView:(RCTRootView *)rootView]; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index c78844c6c334..67517de0700b 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -46,9 +46,6 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc /// This property controls whether the App will use the Fabric renderer of the New Architecture or not. @property (nonatomic, assign, readonly) BOOL fabricEnabled; -/// This property controls whether React Native's new initialization layer is enabled. -@property (nonatomic, assign, readonly) BOOL bridgelessEnabled; - /// This method controls whether the `turboModules` feature of the New Architecture is turned on or off @property (nonatomic, assign, readonly) BOOL turboModuleEnabled; @@ -64,16 +61,6 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc * pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`. * */ -- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock - newArchEnabled:(BOOL)newArchEnabled - turboModuleEnabled:(BOOL)turboModuleEnabled - bridgelessEnabled:(BOOL)bridgelessEnabled __deprecated; - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - newArchEnabled:(BOOL)newArchEnabled - turboModuleEnabled:(BOOL)turboModuleEnabled - bridgelessEnabled:(BOOL)bridgelessEnabled __deprecated; - - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm index 09f19e488262..0c15c230aacb 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm @@ -42,37 +42,12 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock newArch return [self initWithBundleURLBlock:bundleURLBlock]; } -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - newArchEnabled:(BOOL)newArchEnabled - turboModuleEnabled:(BOOL)turboModuleEnabled - bridgelessEnabled:(BOOL)bridgelessEnabled -{ - return [self initWithBundleURLBlock:^{ - return bundleURL; - }]; -} - -- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock - newArchEnabled:(BOOL)newArchEnabled - turboModuleEnabled:(BOOL)turboModuleEnabled - bridgelessEnabled:(BOOL)bridgelessEnabled -{ - if (self = [super init]) { - _bundleURLBlock = bundleURLBlock; - _fabricEnabled = YES; - _turboModuleEnabled = YES; - _bridgelessEnabled = YES; - } - return self; -} - - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock { if (self = [super init]) { _bundleURLBlock = bundleURLBlock; _fabricEnabled = YES; _turboModuleEnabled = YES; - _bridgelessEnabled = YES; } return self; } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 29a12a04d1d7..0bfea31d98e2 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -1697,14 +1697,11 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL bridgelessEnabled; public @property (assign, readonly) BOOL fabricEnabled; public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); - public virtual instancetype initWithBundleURL:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(NSURL* bundleURL, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); - public virtual instancetype initWithBundleURLBlock:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); } interface RCTSafeAreaViewComponentView : public RCTViewComponentView { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index c7108e0046a2..e8e978fc3f2a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -1696,14 +1696,11 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL bridgelessEnabled; public @property (assign, readonly) BOOL fabricEnabled; public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); - public virtual instancetype initWithBundleURL:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(NSURL* bundleURL, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); - public virtual instancetype initWithBundleURLBlock:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); } interface RCTSafeAreaViewComponentView : public RCTViewComponentView { diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 799d86650b9e..c554399f3f51 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -1697,14 +1697,11 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL bridgelessEnabled; public @property (assign, readonly) BOOL fabricEnabled; public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); - public virtual instancetype initWithBundleURL:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(NSURL* bundleURL, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); - public virtual instancetype initWithBundleURLBlock:newArchEnabled:turboModuleEnabled:bridgelessEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled, BOOL turboModuleEnabled, BOOL bridgelessEnabled); } interface RCTSafeAreaViewComponentView : public RCTViewComponentView { From 699dea8844f93cb7abed030a4a6da62729779793 Mon Sep 17 00:00:00 2001 From: Christoph Purrer Date: Wed, 9 Sep 2026 18:37:37 -0700 Subject: [PATCH 3/3] Remove Fabric and TurboModule dead config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Follow-up to D116318829, addressing rubennorte's review comment. Fabric and TurboModules shipped before bridgeless and are always on, so the toggles for them were hardcoded and read nowhere. Android, `DefaultNewArchitectureEntryPoint` — now only selects the release channel and loads the SO: - removed `fabricEnabled`, `turboModulesEnabled`, `concurrentReactEnabled` - removed the deprecated `load(turboModulesEnabled)` and `load(turboModulesEnabled, fabricEnabled)` overloads - removed `isConfigurationValid`, and with it `DefaultNewArchitectureEntryPointTest` (every test targeted it) - updated the 8 in-repo call sites that passed `fabricEnabled` into the deprecated 3-arg `DefaultReactActivityDelegate` constructor, which discarded it iOS: - removed `fabricEnabled` / `turboModuleEnabled` from `RCTRootViewFactoryConfiguration` - removed the corresponding `RCTDefaultReactNativeFactoryDelegate` stubs and the `RCTAppDelegate.h` doc references `ReactAndroid.api` and the `ReactApple*Cxx.api` snapshots are regenerated. One call site is not updated here: `users/zh/zhaogang/benchmarks/SimpleRN/android/app/src/main/java/com/simplern/MainActivity.kt` still imports `DefaultNewArchitectureEntryPoint.fabricEnabled`. It is a personal benchmark app under `users/` that is not materialized in this working copy, so it could not be edited. Changelog: [General][Breaking] - Remove the `fabricEnabled` / `turboModulesEnabled` / `concurrentReactEnabled` accessors and remaining deprecated `load` overloads from `DefaultNewArchitectureEntryPoint`, and the `fabricEnabled` / `turboModuleEnabled` properties from `RCTRootViewFactoryConfiguration`; Fabric and TurboModules are always enabled Differential Revision: D119380472 --- .../Libraries/AppDelegate/RCTAppDelegate.h | 2 - .../RCTDefaultReactNativeFactoryDelegate.mm | 10 --- .../AppDelegate/RCTRootViewFactory.h | 6 -- .../AppDelegate/RCTRootViewFactory.mm | 2 - .../ReactAndroid/api/ReactAndroid.api | 7 -- .../DefaultNewArchitectureEntryPoint.kt | 80 +------------------ .../DefaultNewArchitectureEntryPointTest.kt | 66 --------------- .../main/java/com/helloworld/MainActivity.kt | 8 +- .../api-snapshots/ReactAppleDebugCxx.api | 2 - .../api-snapshots/ReactAppleNewarchCxx.api | 2 - .../api-snapshots/ReactAppleReleaseCxx.api | 2 - 11 files changed, 5 insertions(+), 182 deletions(-) delete mode 100644 packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h index 4a4eb3fa1756..1dc6adb18c64 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h @@ -47,8 +47,6 @@ NS_ASSUME_NONNULL_BEGIN * - (UIViewController *)createRootViewController; * - (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController; * New Architecture: - * - (BOOL)turboModuleEnabled; - * - (BOOL)fabricEnabled; * - (NSDictionary *)prepareInitialProps * - (Class)getModuleClassFromName:(const char *)name * - (std::shared_ptr)getTurboModule:(const std::string &)name diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index e502a42a0262..d94631a23d82 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -116,16 +116,6 @@ - (BOOL)newArchEnabled return YES; } -- (BOOL)fabricEnabled -{ - return YES; -} - -- (BOOL)turboModuleEnabled -{ - return YES; -} - - (Class)getModuleClassFromName:(const char *)name { return nullptr; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index 67517de0700b..000963c81e1a 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -43,12 +43,6 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc #pragma mark - RCTRootViewFactory Configuration @interface RCTRootViewFactoryConfiguration : NSObject -/// This property controls whether the App will use the Fabric renderer of the New Architecture or not. -@property (nonatomic, assign, readonly) BOOL fabricEnabled; - -/// This method controls whether the `turboModules` feature of the New Architecture is turned on or off -@property (nonatomic, assign, readonly) BOOL turboModuleEnabled; - /// Return the bundle URL for the main bundle. @property (nonatomic, nonnull) RCTBundleURLBlock bundleURLBlock; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm index 0c15c230aacb..f6569b69ede3 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm @@ -46,8 +46,6 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock { if (self = [super init]) { _bundleURLBlock = bundleURLBlock; - _fabricEnabled = YES; - _turboModuleEnabled = YES; } return self; } diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 46eb3027ed5a..7f95f09ddc08 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -1768,15 +1768,8 @@ public final class com/facebook/react/defaults/DefaultComponentsRegistry { public final class com/facebook/react/defaults/DefaultNewArchitectureEntryPoint { public static final field INSTANCE Lcom/facebook/react/defaults/DefaultNewArchitectureEntryPoint; - public static final fun getConcurrentReactEnabled ()Z - public static final fun getFabricEnabled ()Z public final fun getReleaseLevel ()Lcom/facebook/react/common/ReleaseLevel; - public static final fun getTurboModulesEnabled ()Z public static final fun load ()V - public static final fun load (Z)V - public static final fun load (ZZ)V - public static synthetic fun load$default (ZILjava/lang/Object;)V - public static synthetic fun load$default (ZZILjava/lang/Object;)V public final fun setReleaseLevel (Lcom/facebook/react/common/ReleaseLevel;)V } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index 5dcfd13f8b1b..43f65bbc3751 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -5,12 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -@file:Suppress("DEPRECATION") // We want to use ReactFeatureFlags here specifically - package com.facebook.react.defaults import com.facebook.react.common.ReleaseLevel -import com.facebook.react.common.annotations.VisibleForTesting import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android @@ -20,58 +17,20 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsProvider /** * A utility class that serves as an entry point for users setup the New Architecture. * - * This class needs to be invoked as `DefaultNewArchitectureEntryPoint.load(...)` by passing a - * series of optional parameters. + * This class needs to be invoked as `DefaultNewArchitectureEntryPoint.load()`. * * By default it loads a library called `appmodules`. `appmodules` is a convention used to refer to * the application dynamic library. If changed here should be updated also inside the template. * - * By default it also enables both TurboModules, Fabric and Concurrent React (aka React 18), and - * Bridgeless + * The [releaseLevel] selects which feature flag release channel the app is loaded with. */ public object DefaultNewArchitectureEntryPoint { public var releaseLevel: ReleaseLevel = ReleaseLevel.STABLE - /** - * Loads the React Native New Architecture entry point with the default configuration. - * - * This will load the app with TurboModules, Fabric and Bridgeless by default. - */ + /** Loads the React Native New Architecture entry point. */ @JvmStatic public fun load() { - load(turboModulesEnabled = true, fabricEnabled = true) - } - - @JvmStatic - @Deprecated( - message = - "Loading the entry point with different flags for Fabric and TurboModule is deprecated." + - " Please use load() instead when loading the New Architecture.", - replaceWith = ReplaceWith("load()"), - ) - public fun load( - turboModulesEnabled: Boolean = true, - ) { - load(turboModulesEnabled, fabricEnabled = true) - } - - @JvmStatic - @Deprecated( - message = - "Loading the entry point with different flags for Fabric and TurboModule is deprecated." + - " Please use load() instead when loading the New Architecture.", - replaceWith = ReplaceWith("load()"), - ) - public fun load( - turboModulesEnabled: Boolean = true, - fabricEnabled: Boolean = true, - ) { - val (isValid, errorMessage) = isConfigurationValid(turboModulesEnabled, fabricEnabled) - if (!isValid) { - error(errorMessage) - } - when (releaseLevel) { ReleaseLevel.EXPERIMENTAL -> { ReactNativeFeatureFlags.override( @@ -86,8 +45,6 @@ public object DefaultNewArchitectureEntryPoint { } } - privateTurboModulesEnabled = turboModulesEnabled - DefaultSoLoader.maybeLoadSoLibrary() } @@ -95,37 +52,6 @@ public object DefaultNewArchitectureEntryPoint { internal fun loadWithFeatureFlags(featureFlags: ReactNativeFeatureFlagsProvider) { ReactNativeFeatureFlags.override(featureFlags) - privateTurboModulesEnabled = true - DefaultSoLoader.maybeLoadSoLibrary() } - - @JvmStatic - public val fabricEnabled: Boolean - get() = true - - private var privateTurboModulesEnabled: Boolean = false - - @JvmStatic - public val turboModulesEnabled: Boolean - get() = privateTurboModulesEnabled - - @JvmStatic - public val concurrentReactEnabled: Boolean - get() = true - - @VisibleForTesting - public fun isConfigurationValid( - turboModulesEnabled: Boolean, - fabricEnabled: Boolean, - ): Pair = - if (!turboModulesEnabled || !fabricEnabled) { - false to - "You cannot load React Native with the New Architecture disabled. " + - "Please use DefaultNewArchitectureEntryPoint.load() instead of " + - "DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=$turboModulesEnabled, " + - "fabricEnabled=$fabricEnabled)" - } else { - true to "" - } } diff --git a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt b/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt deleted file mode 100644 index 176daa683734..000000000000 --- a/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPointTest.kt +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -package com.facebook.react.defaults - -import org.assertj.core.api.Assertions.assertThat -import org.junit.Test - -class DefaultNewArchitectureEntryPointTest { - - @Test - fun isConfigurationValid_withEverythingOff_returnsFalse() { - val (isValid, errorMessage) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = false, - fabricEnabled = false, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=false)", - ) - } - - @Test - fun isConfigurationValid_withTurboModulesOnlyOn_returnsFalse() { - val (isValid, errorMessage) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = true, - fabricEnabled = false, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=true, fabricEnabled=false)", - ) - } - - @Test - fun isConfigurationValid_withFabricWithoutTurboModules_returnsFalse() { - val (isValid, errorMessage) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = false, - fabricEnabled = true, - ) - assertThat(isValid).isFalse() - assertThat(errorMessage) - .isEqualTo( - "You cannot load React Native with the New Architecture disabled. Please use DefaultNewArchitectureEntryPoint.load() instead of DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=false, fabricEnabled=true)", - ) - } - - @Test - fun isConfigurationValid_withEverythingOn_returnsTrue() { - val (isValid, _) = - DefaultNewArchitectureEntryPoint.isConfigurationValid( - turboModulesEnabled = true, - fabricEnabled = true, - ) - assertThat(isValid).isTrue() - } -} diff --git a/private/helloworld/android/app/src/main/java/com/helloworld/MainActivity.kt b/private/helloworld/android/app/src/main/java/com/helloworld/MainActivity.kt index 07c473700901..5515185dc46d 100644 --- a/private/helloworld/android/app/src/main/java/com/helloworld/MainActivity.kt +++ b/private/helloworld/android/app/src/main/java/com/helloworld/MainActivity.kt @@ -9,7 +9,6 @@ package com.helloworld import com.facebook.react.ReactActivity import com.facebook.react.ReactActivityDelegate -import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled import com.facebook.react.defaults.DefaultReactActivityDelegate class MainActivity : ReactActivity() { @@ -20,10 +19,7 @@ class MainActivity : ReactActivity() { */ override fun getMainComponentName(): String = "HelloWorld" - /** - * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] - * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] - */ + /** Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]. */ override fun createReactActivityDelegate(): ReactActivityDelegate = - DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) + DefaultReactActivityDelegate(this, mainComponentName) } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 0bfea31d98e2..fda0c0cbbbe6 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -1697,8 +1697,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL fabricEnabled; - public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index e8e978fc3f2a..c87582953e7e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -1696,8 +1696,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL fabricEnabled; - public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index c554399f3f51..0fc32f8a69f9 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -1697,8 +1697,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject { public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge; public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress; public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge; - public @property (assign, readonly) BOOL fabricEnabled; - public @property (assign, readonly) BOOL turboModuleEnabled; public @property (weak) id jsRuntimeConfiguratorDelegate; public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled); public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);