Преглед изворни кода

Pass newly created ReactContext from ReactInstanceEventListener

Guy Carmeli пре 6 година
родитељ
комит
350f48aee1

+ 4
- 4
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java Прегледај датотеку

@@ -46,13 +46,13 @@ public class NavigationReactInitializer implements ReactInstanceManager.ReactIns
46 46
 		if (shouldCreateContext()) {
47 47
 			reactInstanceManager.createReactContextInBackground();
48 48
 		} else if (waitingForAppLaunchEvent) {
49
-			emitAppLaunched();
49
+			emitAppLaunched(reactInstanceManager.getCurrentReactContext());
50 50
 		}
51 51
 	}
52 52
 
53
-	private void emitAppLaunched() {
53
+	private void emitAppLaunched(ReactContext context) {
54 54
 		waitingForAppLaunchEvent = false;
55
-		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).appLaunched();
55
+		new NavigationEvent(context).appLaunched();
56 56
 	}
57 57
 
58 58
 	private boolean shouldCreateContext() {
@@ -61,6 +61,6 @@ public class NavigationReactInitializer implements ReactInstanceManager.ReactIns
61 61
 
62 62
 	@Override
63 63
 	public void onReactContextInitialized(final ReactContext context) {
64
-		emitAppLaunched();
64
+        emitAppLaunched(context);
65 65
 	}
66 66
 }