From 35946ef266c413a92db530ee282a749293ebef93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Tue, 4 Jun 2024 16:21:44 -0700 Subject: [PATCH] Re-enable event loop in OSS (#44788) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44788 We disabled the event loop in RN on the main branch after we found some issues in the implementation. Those have been resolved already so we can re-enable it again. For context, it's already enabled in the latest branch so this is just for main. Changelog: [internal] Reviewed By: cortinico Differential Revision: D58146393 fbshipit-source-id: ab908ecbd507d7087137a36cad5cc917eb7b1311 --- .../Libraries/AppDelegate/RCTAppDelegate.mm | 16 +++++++++++++++- .../defaults/DefaultNewArchitectureEntryPoint.kt | 8 +++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index da4f793c6cd0b4..1a93e7d409bc41 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -297,7 +297,21 @@ - (RCTRootViewFactory *)createRCTRootViewFactory #pragma mark - Feature Flags -class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults {}; +class RCTAppDelegateBridgelessFeatureFlags : public facebook::react::ReactNativeFeatureFlagsDefaults { + public: + bool useModernRuntimeScheduler() override + { + return true; + } + bool enableMicrotasks() override + { + return true; + } + bool batchRenderingUpdatesInEventLoop() override + { + return true; + } +}; - (void)_setUpFeatureFlags { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index 553c4f75f5bb13..ceabbe7392ab5b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -48,7 +48,13 @@ public object DefaultNewArchitectureEntryPoint { if (bridgelessEnabled) { ReactNativeFeatureFlags.override( object : ReactNativeFeatureFlagsDefaults() { - override fun useNativeViewConfigsInBridgelessMode(): Boolean = fabricEnabled + override fun useModernRuntimeScheduler(): Boolean = true + + override fun enableMicrotasks(): Boolean = true + + override fun batchRenderingUpdatesInEventLoop(): Boolean = true + + override fun useNativeViewConfigsInBridgelessMode(): Boolean = true }) }