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

Make sure the Native RuntimeScheduler is initialized on Old Arch #37517

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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down