Browse Source

Check for reactContext before emitting appLaunched event

If ReactContext is null, the event is emitted when onReactContextInitialized is invoked. Closes #3392
Guy Carmeli 6 years ago
parent
commit
84c6ed2859

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

@@ -48,7 +48,9 @@ public class NavigationReactInitializer implements ReactInstanceManager.ReactIns
48 48
 		if (shouldCreateContext()) {
49 49
 			reactInstanceManager.createReactContextInBackground();
50 50
 		} else if (waitingForAppLaunchEvent) {
51
-			emitAppLaunched(reactInstanceManager.getCurrentReactContext());
51
+            if (reactInstanceManager.getCurrentReactContext() != null) {
52
+			    emitAppLaunched(reactInstanceManager.getCurrentReactContext());
53
+            }
52 54
 		}
53 55
 	}
54 56