diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index ebe012492b2e3b..fc0e891a289e65 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -44,6 +44,7 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.annotations.VisibleForTesting; +import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.modules.appregistry.AppRegistry; import com.facebook.react.modules.core.DeviceEventManagerModule; import com.facebook.react.modules.deviceinfo.DeviceInfoModule; @@ -439,7 +440,11 @@ public void startReactApplication( mInitialUITemplate = initialUITemplate; mReactInstanceManager.createReactContextInBackground(); - + // if in this experiment, we initialize the root earlier in startReactApplication + // instead of waiting for the initial measure + if (ReactFeatureFlags.enableEagerRootViewAttachment) { + attachToReactInstanceManager(); + } } finally { Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index c42be6e1d4effc..7e3a430e366d1a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -80,6 +80,9 @@ public class ReactFeatureFlags { /** Feature flag to configure eager initialization of MapBuffer So file */ public static boolean enableEagerInitializeMapBufferSoFile = false; + /** Feature flag to configure eager attachment of the root view/initialisation of the JS code */ + public static boolean enableEagerRootViewAttachment = false; + private static boolean mapBufferSerializationEnabled = false; /** Enables or disables MapBuffer Serialization */