Browse Source

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 years ago
parent
commit
3710a3ec90
No account linked to committer's email address

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java View File

45
 	private void prepareReactApp() {
45
 	private void prepareReactApp() {
46
 		if (shouldCreateContext()) {
46
 		if (shouldCreateContext()) {
47
 			reactInstanceManager.createReactContextInBackground();
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
 	private boolean shouldCreateContext() {
58
 	private boolean shouldCreateContext() {
61
 
61
 
62
 	@Override
62
 	@Override
63
 	public void onReactContextInitialized(final ReactContext context) {
63
 	public void onReactContextInitialized(final ReactContext context) {
64
-		emitAppLaunched(context);
64
+		emitAppLaunched();
65
 	}
65
 	}
66
 }
66
 }