Initialize "rninstance" at ReactInstance class loading time (#38026)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38026

In this diff I'm moving the initialization of "rninstance" so as soon as the class is loaded

The goal is to ensure so is loaded earlier and prevent issues like T156403678

changelog: [internal] internal

Reviewed By: luluwu2032

Differential Revision: D46945464

fbshipit-source-id: f4d68574030ca3bda5d55fe3a9c1630a4879f3ab
This commit is contained in:
David Vacca
2023-06-22 16:38:28 -07:00
committed by Facebook GitHub Bot
parent 0a9284a242
commit 95847fcd7e
@@ -88,6 +88,10 @@ final class ReactInstance {
@DoNotStrip @Nullable private ComponentNameResolverManager mComponentNameResolverManager;
static {
loadLibraryIfNeeded();
}
private static volatile boolean sIsLibraryLoaded;
/* package */ ReactInstance(
@@ -100,7 +104,6 @@ final class ReactInstance {
boolean useDevSupport) {
mBridgelessReactContext = bridgelessReactContext;
mDelegate = delegate;
loadLibraryIfNeeded();
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstance.initialize");