Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<facebook::react::TurboModule>)getTurboModule:(const std::string &)name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,6 @@ - (BOOL)newArchEnabled
return YES;
}

- (BOOL)fabricEnabled
{
return YES;
}

- (BOOL)turboModuleEnabled
{
return YES;
}

- (Class)getModuleClassFromName:(const char *)name
{
return nullptr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
{
if (self = [super init]) {
_bundleURLBlock = bundleURLBlock;
_fabricEnabled = YES;
_turboModuleEnabled = YES;
}
return self;
}
Expand Down
6,448 changes: 0 additions & 6,448 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,71 +17,28 @@ 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()`, optionally after
* setting [releaseLevel] to pick the set of feature flags to apply.
*
* 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
*/
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 for the configured [releaseLevel]. */
@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)
}

ReactNativeFeatureFlags.override(getDefaultFeatureFlagsProvider())

privateTurboModulesEnabled = turboModulesEnabled

DefaultSoLoader.maybeLoadSoLibrary()
}

@JvmStatic
internal fun loadWithFeatureFlags(featureFlags: ReactNativeFeatureFlagsProvider) {
ReactNativeFeatureFlags.override(featureFlags)

privateTurboModulesEnabled = true

DefaultSoLoader.maybeLoadSoLibrary()
}

Expand All @@ -94,33 +48,4 @@ public object DefaultNewArchitectureEntryPoint {
ReleaseLevel.CANARY -> ReactNativeFeatureFlagsOverrides_RNOSS_Canary_Android()
ReleaseLevel.STABLE -> ReactNativeFeatureFlagsOverrides_RNOSS_Stable_Android()
}

@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<Boolean, String> =
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 ""
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)
}
2 changes: 0 additions & 2 deletions scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,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<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);
Expand Down
2 changes: 0 additions & 2 deletions scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -1692,8 +1692,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<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);
Expand Down
2 changes: 0 additions & 2 deletions scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -1693,8 +1693,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<RCTJSRuntimeConfiguratorProtocol> jsRuntimeConfiguratorDelegate;
public virtual instancetype initWithBundleURL:newArchEnabled:(NSURL* bundleURL, BOOL newArchEnabled);
public virtual instancetype initWithBundleURLBlock:newArchEnabled:(RCTBundleURLBlock bundleURLBlock, BOOL newArchEnabled);
Expand Down
Loading