diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index 53b8e507d4a79c..42e815bc6d8b5a 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -1358,6 +1358,15 @@ private ReactApplicationContext createReactContext( reactContext.initializeWithInstance(catalystInstance); + if (ReactFeatureFlags.unstable_useRuntimeSchedulerAlways) { + // On Old Architecture, we need to initialize the Native Runtime Scheduler so that + // the `nativeRuntimeScheduler` object is registered on JS. + // On New Architecture, this is normally triggered by instantiate a TurboModuleManager. + // Here we invoke getRuntimeScheduler() to trigger the creation of it regardless of the + // architecture so it will always be there. + catalystInstance.getRuntimeScheduler(); + } + if (ReactFeatureFlags.useTurboModules && mTMMDelegateBuilder != null) { TurboModuleManagerDelegate tmmDelegate = mTMMDelegateBuilder diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 3ee102049179f2..c4f7ef5248cb2b 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -50,6 +50,13 @@ public class ReactFeatureFlags { */ public static volatile boolean unstable_useFabricInterop = false; + /** + * Should this application always use the Native RuntimeScheduler? If yes, we'll be instantiating + * it over all the architectures (both Old and New). This is intentionally set to true as we want + * to use it more as a kill-switch to turn off this feature to potentially debug issues. + */ + public static volatile boolean unstable_useRuntimeSchedulerAlways = true; + /** * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable * the following flags: `useTurboModules` & `enableFabricRenderer`.