Expose unstable_fuseboxEnabled API on iOS (#44860)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44860

- Enables an opt-in to the Fusebox stack on iOS for both architectures in open source.
- Templates use of this opt-in in RNTester.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D58364053

fbshipit-source-id: c604b1589174bf7cfd0fe1bfb5624c4edd0a125d
This commit is contained in:
Alex Hunt authored and Facebook GitHub Bot committed 2024-06-11 04:38:32 -07:00
1 parent 1d926d47ff
commit 812f155527
3 files changed
+40 -2

No files matched your search

@@ -160,6 +160,9 @@ NS_ASSUME_NONNULL_BEGIN
/// @return: `true` if the new initialization layer is enabled. Otherwise returns `false`.
- (BOOL)bridgelessEnabled;
/// Controls whether the new debugger stack (codename Fusebox) is enabled.
- (BOOL)unstable_fuseboxEnabled;
/// Return the bundle URL for the main bundle.
- (NSURL *__nullable)bundleURL;
@@ -151,6 +151,11 @@
return [self newArchEnabled];
}
- (BOOL)unstable_fuseboxEnabled
{
return [self unstable_fuseboxEnabled];
}
- (NSURL *)bundleURL
{
[NSException raise:@"RCTAppDelegate::bundleURL not implemented"
@@ -300,8 +305,26 @@
#pragma mark - Feature Flags
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
class RCTAppDelegateFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
public:
RCTAppDelegateFeatureFlags(bool fuseboxEnabled)
{
fuseboxEnabled_ = fuseboxEnabled;
}
bool fuseboxEnabledDebug() override
{
return fuseboxEnabled_;
}
private:
bool fuseboxEnabled_;
};
class RCTAppDelegateBridgelessFeatureFlags : public RCTAppDelegateFeatureFlags {
public:
RCTAppDelegateBridgelessFeatureFlags(bool fuseboxEnabled) : RCTAppDelegateFeatureFlags(fuseboxEnabled) {}
bool useModernRuntimeScheduler() override
{
return true;
@@ -319,7 +342,11 @@ class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNative
- (void)_setUpFeatureFlags
{
if ([self bridgelessEnabled]) {
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
facebook::react::ReactNativeFeatureFlags::override(
std::make_unique<RCTAppDelegateBridgelessFeatureFlags>([self unstable_fuseboxEnabled]));
} else {
facebook::react::ReactNativeFeatureFlags::override(
std::make_unique<RCTAppDelegateFeatureFlags>([self unstable_fuseboxEnabled]));
}
}
@@ -144,6 +144,14 @@ static NSString *kBundlePath = @"js/RNTesterApp.ios";
return [super bridgelessEnabled];
}
#pragma mark - Experimental settings
// [Experiment] Enable the new debugger stack (codename Fusebox)
- (BOOL)unstable_fuseboxEnabled
{
return false;
}
#pragma mark - RCTComponentViewFactoryComponentProvider
#ifndef RN_DISABLE_OSS_PLUGIN_HEADER