58
58
import com .facebook .react .bridge .ReactContext ;
59
59
import com .facebook .react .bridge .ReactMarker ;
60
60
import com .facebook .react .bridge .ReactMarkerConstants ;
61
+ import com .facebook .react .bridge .UIManager ;
61
62
import com .facebook .react .bridge .UiThreadUtil ;
62
63
import com .facebook .react .bridge .queue .ReactQueueConfigurationSpec ;
63
64
import com .facebook .react .common .LifecycleState ;
@@ -328,40 +329,6 @@ public void createReactContextInBackground() {
328
329
recreateReactContextInBackgroundInner ();
329
330
}
330
331
331
- @ ThreadConfined (UI )
332
- public void registerAdditionalPackages (List <ReactPackage > packages ) {
333
- if (packages == null || packages .isEmpty ()) {
334
- return ;
335
- }
336
-
337
- // CatalystInstance hasn't been created, so add packages for later evaluation
338
- if (!hasStartedCreatingInitialContext ()) {
339
- synchronized (mPackages ) {
340
- for (ReactPackage p : packages ) {
341
- if (!mPackages .contains (p )) {
342
- mPackages .add (p );
343
- }
344
- }
345
- }
346
- return ;
347
- }
348
-
349
- ReactContext context = getCurrentReactContext ();
350
- CatalystInstance catalystInstance = context != null ? context .getCatalystInstance () : null ;
351
-
352
- Assertions .assertNotNull (catalystInstance , "CatalystInstance null after hasStartedCreatingInitialContext true." );
353
-
354
- final ReactApplicationContext reactContext = getReactApplicationContext ();
355
-
356
- NativeModuleRegistry nativeModuleRegistry = processPackages (reactContext , packages , true );
357
- catalystInstance .extendNativeModules (nativeModuleRegistry );
358
- }
359
-
360
- @ VisibleForTesting
361
- public @ Nullable ReactApplicationContext getReactApplicationContext () {
362
- return new ReactApplicationContext (mApplicationContext );
363
- }
364
-
365
332
/**
366
333
* Recreate the react application and context. This should be called if configuration has changed
367
334
* or the developer has requested the app to be reloaded. It should only be called after an
@@ -1040,8 +1007,7 @@ private void attachRootViewToInstance(
1040
1007
CatalystInstance catalystInstance ) {
1041
1008
Log .d (ReactConstants .TAG , "ReactInstanceManager.attachRootViewToInstance()" );
1042
1009
Systrace .beginSection (TRACE_TAG_REACT_JAVA_BRIDGE , "attachRootViewToInstance" );
1043
- UIManagerModule uiManagerModule = catalystInstance .getNativeModule (UIManagerModule .class );
1044
- final int rootTag = uiManagerModule .addRootView (rootView );
1010
+ final int rootTag = catalystInstance .getNativeModule (UIManagerModule .class ).addRootView (rootView );
1045
1011
rootView .setRootViewTag (rootTag );
1046
1012
rootView .invokeJSEntryPoint ();
1047
1013
Systrace .beginAsyncSection (
@@ -1097,7 +1063,7 @@ private ReactApplicationContext createReactContext(
1097
1063
JSBundleLoader jsBundleLoader ) {
1098
1064
Log .d (ReactConstants .TAG , "ReactInstanceManager.createReactContext()" );
1099
1065
ReactMarker .logMarker (CREATE_REACT_CONTEXT_START );
1100
- final ReactApplicationContext reactContext = getReactApplicationContext ( );
1066
+ final ReactApplicationContext reactContext = new ReactApplicationContext ( mApplicationContext );
1101
1067
1102
1068
if (mUseDeveloperSupport ) {
1103
1069
reactContext .setNativeModuleCallExceptionHandler (mDevSupportManager );
@@ -1113,8 +1079,7 @@ private ReactApplicationContext createReactContext(
1113
1079
.setJSExecutor (jsExecutor )
1114
1080
.setRegistry (nativeModuleRegistry )
1115
1081
.setJSBundleLoader (jsBundleLoader )
1116
- .setNativeModuleCallExceptionHandler (exceptionHandler )
1117
- .setBridgeListener (mBridgeListener );
1082
+ .setNativeModuleCallExceptionHandler (exceptionHandler );
1118
1083
1119
1084
ReactMarker .logMarker (CREATE_CATALYST_INSTANCE_START );
1120
1085
// CREATE_CATALYST_INSTANCE_END is in JSCExecutor.cpp
@@ -1126,6 +1091,9 @@ private ReactApplicationContext createReactContext(
1126
1091
Systrace .endSection (TRACE_TAG_REACT_JAVA_BRIDGE );
1127
1092
ReactMarker .logMarker (CREATE_CATALYST_INSTANCE_END );
1128
1093
}
1094
+ if (mBridgeListener != null ) {
1095
+ mBridgeListener .onBridgeStarted (reactContext , catalystInstance );
1096
+ }
1129
1097
1130
1098
if (mBridgeIdleDebugListener != null ) {
1131
1099
catalystInstance .addBridgeIdleDebugListener (mBridgeIdleDebugListener );
0 commit comments