mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Enable event loop by default when bridgeless is enabled (#43396)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43396 Changelog: [General][Changed] Enabled new event loop behavior when bridgeless (new architecture) is enabled. Reviewed By: rshest Differential Revision: D54682678 fbshipit-source-id: ff8c45bc1caae0e9182aa94d915d7b6f9427caf9
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a1c752cd87
commit
87b73a0bad
@@ -12,6 +12,8 @@
|
||||
#import <React/RCTSurfacePresenterBridgeAdapter.h>
|
||||
#import <React/RCTUtils.h>
|
||||
#import <objc/runtime.h>
|
||||
#import <react/featureflags/ReactNativeFeatureFlags.h>
|
||||
#import <react/featureflags/ReactNativeFeatureFlagsDefaults.h>
|
||||
#import <react/renderer/graphics/ColorComponents.h>
|
||||
#import "RCTAppDelegate+Protected.h"
|
||||
#import "RCTAppSetupUtils.h"
|
||||
@@ -38,6 +40,8 @@
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
[self _setUpFeatureFlags];
|
||||
|
||||
RCTSetNewArchEnabled([self newArchEnabled]);
|
||||
[RCTColorSpaceUtils applyDefaultColorSpace:self.defaultColorSpace];
|
||||
RCTAppSetupPrepareApp(application, self.turboModuleEnabled);
|
||||
@@ -259,4 +263,29 @@
|
||||
return [[RCTRootViewFactory alloc] initWithConfiguration:configuration andTurboModuleManagerDelegate:self];
|
||||
}
|
||||
|
||||
#pragma mark - Feature Flags
|
||||
|
||||
class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {
|
||||
public:
|
||||
bool useModernRuntimeScheduler() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool enableMicrotasks() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool batchRenderingUpdatesInEventLoop() override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
- (void)_setUpFeatureFlags
|
||||
{
|
||||
if ([self bridgelessEnabled]) {
|
||||
facebook::react::ReactNativeFeatureFlags::override(std::make_unique<RCTAppDelegateBridgelessFeatureFlags>());
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -91,6 +91,7 @@ Pod::Spec.new do |s|
|
||||
add_dependency(s, "React-utils")
|
||||
add_dependency(s, "React-debug")
|
||||
add_dependency(s, "React-rendererdebug")
|
||||
add_dependency(s, "React-featureflags")
|
||||
|
||||
if use_hermes
|
||||
s.dependency "React-hermes"
|
||||
|
||||
+13
@@ -11,6 +11,8 @@ package com.facebook.react.defaults
|
||||
|
||||
import com.facebook.react.common.annotations.VisibleForTesting
|
||||
import com.facebook.react.config.ReactFeatureFlags
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
|
||||
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlagsDefaults
|
||||
|
||||
/**
|
||||
* A utility class that serves as an entry point for users setup the New Architecture.
|
||||
@@ -45,6 +47,17 @@ public object DefaultNewArchitectureEntryPoint {
|
||||
ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled
|
||||
ReactFeatureFlags.enableFabricPendingEventQueue = fabricEnabled
|
||||
|
||||
if (bridgelessEnabled) {
|
||||
ReactNativeFeatureFlags.override(
|
||||
object : ReactNativeFeatureFlagsDefaults() {
|
||||
override fun useModernRuntimeScheduler(): Boolean = true
|
||||
|
||||
override fun enableMicrotasks(): Boolean = true
|
||||
|
||||
override fun batchRenderingUpdatesInEventLoop(): Boolean = true
|
||||
})
|
||||
}
|
||||
|
||||
privateFabricEnabled = fabricEnabled
|
||||
privateTurboModulesEnabled = turboModulesEnabled
|
||||
privateConcurrentReactEnabled = fabricEnabled
|
||||
|
||||
Reference in New Issue
Block a user