Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose unstable_fuseboxEnabled API on iOS #44860

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 3 additions & 0 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
31 changes: 29 additions & 2 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ - (BOOL)bridgelessEnabled
return [self newArchEnabled];
}

- (BOOL)unstable_fuseboxEnabled
{
return [self unstable_fuseboxEnabled];
}

- (NSURL *)bundleURL
{
[NSException raise:@"RCTAppDelegate::bundleURL not implemented"
Expand Down Expand Up @@ -300,8 +305,26 @@ - (RCTRootViewFactory *)createRCTRootViewFactory

#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;
Expand All @@ -319,7 +342,11 @@ bool batchRenderingUpdatesInEventLoop() override
- (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]));
}
}

Expand Down
8 changes: 8 additions & 0 deletions packages/rn-tester/RNTester/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ - (BOOL)bridgelessEnabled
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
Expand Down
Loading