Skip to content

Commit 699dea8

Browse files
Remove Fabric and TurboModule dead config
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
1 parent 1874b0b commit 699dea8

11 files changed

Lines changed: 5 additions & 182 deletions

File tree

‎packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ NS_ASSUME_NONNULL_BEGIN
4747
* - (UIViewController *)createRootViewController;
4848
* - (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController;
4949
* New Architecture:
50-
* - (BOOL)turboModuleEnabled;
51-
* - (BOOL)fabricEnabled;
5250
* - (NSDictionary *)prepareInitialProps
5351
* - (Class)getModuleClassFromName:(const char *)name
5452
* - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const std::string &)name

‎packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,6 @@ - (BOOL)newArchEnabled
116116
return YES;
117117
}
118118

119-
- (BOOL)fabricEnabled
120-
{
121-
return YES;
122-
}
123-
124-
- (BOOL)turboModuleEnabled
125-
{
126-
return YES;
127-
}
128-
129119
- (Class)getModuleClassFromName:(const char *)name
130120
{
131121
return nullptr;

‎packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
4343
#pragma mark - RCTRootViewFactory Configuration
4444
@interface RCTRootViewFactoryConfiguration : NSObject
4545

46-
/// This property controls whether the App will use the Fabric renderer of the New Architecture or not.
47-
@property (nonatomic, assign, readonly) BOOL fabricEnabled;
48-
49-
/// This method controls whether the `turboModules` feature of the New Architecture is turned on or off
50-
@property (nonatomic, assign, readonly) BOOL turboModuleEnabled;
51-
5246
/// Return the bundle URL for the main bundle.
5347
@property (nonatomic, nonnull) RCTBundleURLBlock bundleURLBlock;
5448

‎packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
4646
{
4747
if (self = [super init]) {
4848
_bundleURLBlock = bundleURLBlock;
49-
_fabricEnabled = YES;
50-
_turboModuleEnabled = YES;
5149
}
5250
return self;
5351
}

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,15 +1768,8 @@ 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 getConcurrentReactEnabled ()Z
1772-
public static final fun getFabricEnabled ()Z
17731771
public final fun getReleaseLevel ()Lcom/facebook/react/common/ReleaseLevel;
1774-
public static final fun getTurboModulesEnabled ()Z
17751772
public static final fun load ()V
1776-
public static final fun load (Z)V
1777-
public static final fun load (ZZ)V
1778-
public static synthetic fun load$default (ZILjava/lang/Object;)V
1779-
public static synthetic fun load$default (ZZILjava/lang/Object;)V
17801773
public final fun setReleaseLevel (Lcom/facebook/react/common/ReleaseLevel;)V
17811774
}
17821775

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

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
@file:Suppress("DEPRECATION") // We want to use ReactFeatureFlags here specifically
9-
108
package com.facebook.react.defaults
119

1210
import com.facebook.react.common.ReleaseLevel
13-
import com.facebook.react.common.annotations.VisibleForTesting
1411
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
1512
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android
1613
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsOverrides_RNOSS_Experimental_Android
@@ -20,58 +17,20 @@ import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsProvider
2017
/**
2118
* A utility class that serves as an entry point for users setup the New Architecture.
2219
*
23-
* This class needs to be invoked as `DefaultNewArchitectureEntryPoint.load(...)` by passing a
24-
* series of optional parameters.
20+
* This class needs to be invoked as `DefaultNewArchitectureEntryPoint.load()`.
2521
*
2622
* By default it loads a library called `appmodules`. `appmodules` is a convention used to refer to
2723
* the application dynamic library. If changed here should be updated also inside the template.
2824
*
29-
* By default it also enables both TurboModules, Fabric and Concurrent React (aka React 18), and
30-
* Bridgeless
25+
* The [releaseLevel] selects which feature flag release channel the app is loaded with.
3126
*/
3227
public object DefaultNewArchitectureEntryPoint {
3328

3429
public var releaseLevel: ReleaseLevel = ReleaseLevel.STABLE
3530

36-
/**
37-
* Loads the React Native New Architecture entry point with the default configuration.
38-
*
39-
* This will load the app with TurboModules, Fabric and Bridgeless by default.
40-
*/
31+
/** Loads the React Native New Architecture entry point. */
4132
@JvmStatic
4233
public fun load() {
43-
load(turboModulesEnabled = true, fabricEnabled = true)
44-
}
45-
46-
@JvmStatic
47-
@Deprecated(
48-
message =
49-
"Loading the entry point with different flags for Fabric and TurboModule is deprecated." +
50-
" Please use load() instead when loading the New Architecture.",
51-
replaceWith = ReplaceWith("load()"),
52-
)
53-
public fun load(
54-
turboModulesEnabled: Boolean = true,
55-
) {
56-
load(turboModulesEnabled, fabricEnabled = true)
57-
}
58-
59-
@JvmStatic
60-
@Deprecated(
61-
message =
62-
"Loading the entry point with different flags for Fabric and TurboModule is deprecated." +
63-
" Please use load() instead when loading the New Architecture.",
64-
replaceWith = ReplaceWith("load()"),
65-
)
66-
public fun load(
67-
turboModulesEnabled: Boolean = true,
68-
fabricEnabled: Boolean = true,
69-
) {
70-
val (isValid, errorMessage) = isConfigurationValid(turboModulesEnabled, fabricEnabled)
71-
if (!isValid) {
72-
error(errorMessage)
73-
}
74-
7534
when (releaseLevel) {
7635
ReleaseLevel.EXPERIMENTAL -> {
7736
ReactNativeFeatureFlags.override(
@@ -86,46 +45,13 @@ public object DefaultNewArchitectureEntryPoint {
8645
}
8746
}
8847

89-
privateTurboModulesEnabled = turboModulesEnabled
90-
9148
DefaultSoLoader.maybeLoadSoLibrary()
9249
}
9350

9451
@JvmStatic
9552
internal fun loadWithFeatureFlags(featureFlags: ReactNativeFeatureFlagsProvider) {
9653
ReactNativeFeatureFlags.override(featureFlags)
9754

98-
privateTurboModulesEnabled = true
99-
10055
DefaultSoLoader.maybeLoadSoLibrary()
10156
}
102-
103-
@JvmStatic
104-
public val fabricEnabled: Boolean
105-
get() = true
106-
107-
private var privateTurboModulesEnabled: Boolean = false
108-
109-
@JvmStatic
110-
public val turboModulesEnabled: Boolean
111-
get() = privateTurboModulesEnabled
112-
113-
@JvmStatic
114-
public val concurrentReactEnabled: Boolean
115-
get() = true
116-
117-
@VisibleForTesting
118-
public fun isConfigurationValid(
119-
turboModulesEnabled: Boolean,
120-
fabricEnabled: Boolean,
121-
): Pair<Boolean, String> =
122-
if (!turboModulesEnabled || !fabricEnabled) {
123-
false to
124-
"You cannot load React Native with the New Architecture disabled. " +
125-
"Please use DefaultNewArchitectureEntryPoint.load() instead of " +
126-
"DefaultNewArchitectureEntryPoint.load(turboModulesEnabled=$turboModulesEnabled, " +
127-
"fabricEnabled=$fabricEnabled)"
128-
} else {
129-
true to ""
130-
}
13157
}

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

Lines changed: 0 additions & 66 deletions
This file was deleted.

‎private/helloworld/android/app/src/main/java/com/helloworld/MainActivity.kt‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ package com.helloworld
99

1010
import com.facebook.react.ReactActivity
1111
import com.facebook.react.ReactActivityDelegate
12-
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
1312
import com.facebook.react.defaults.DefaultReactActivityDelegate
1413

1514
class MainActivity : ReactActivity() {
@@ -20,10 +19,7 @@ class MainActivity : ReactActivity() {
2019
*/
2120
override fun getMainComponentName(): String = "HelloWorld"
2221

23-
/**
24-
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
25-
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
26-
*/
22+
/** Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]. */
2723
override fun createReactActivityDelegate(): ReactActivityDelegate =
28-
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
24+
DefaultReactActivityDelegate(this, mainComponentName)
2925
}

‎scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
16971697
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
16981698
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
16991699
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
1700-
public @property (assign, readonly) BOOL fabricEnabled;
1701-
public @property (assign, readonly) BOOL turboModuleEnabled;
17021700
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
17031701
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
17041702
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);

‎scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,8 +1696,6 @@ interface RCTRootViewFactoryConfiguration : public NSObject {
16961696
public @property (assign) RCTLoadSourceForBridgeBlock loadSourceForBridge;
16971697
public @property (assign) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;
16981698
public @property (assign) RCTSourceURLForBridgeBlock sourceURLForBridge;
1699-
public @property (assign, readonly) BOOL fabricEnabled;
1700-
public @property (assign, readonly) BOOL turboModuleEnabled;
17011699
public @property (weak) id<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
17021700
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
17031701
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);

0 commit comments

Comments
 (0)