Bläddra i källkod

Revert "Fixes NPE when initializing twice" (#3135)

* Revert "Fix custom top bar from disappearing after a push (#3109)"

This reverts commit 0e11b95f85.

* Revert "Fixes NPE when initializing twice (#3128)"

This reverts commit 0bf0751f5d.
Guy Carmeli 6 år sedan
förälder
incheckning
3710a3ec90
No account linked to committer's email address

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java Visa fil

@@ -45,14 +45,14 @@ public class NavigationReactInitializer implements ReactInstanceManager.ReactIns
45 45
 	private void prepareReactApp() {
46 46
 		if (shouldCreateContext()) {
47 47
 			reactInstanceManager.createReactContextInBackground();
48
+		} else if (waitingForAppLaunchEvent) {
49
+			emitAppLaunched();
48 50
 		}
49 51
 	}
50 52
 
51
-	private void emitAppLaunched(final ReactContext context) {
52
-		if (waitingForAppLaunchEvent) {
53
-			waitingForAppLaunchEvent = false;
54
-			new NavigationEvent(context).appLaunched();
55
-		}
53
+	private void emitAppLaunched() {
54
+		waitingForAppLaunchEvent = false;
55
+		new NavigationEvent(reactInstanceManager.getCurrentReactContext()).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(context);
64
+		emitAppLaunched();
65 65
 	}
66 66
 }