소스 검색

Check for reactContext before emitting appLaunched event

If ReactContext is null, the event is emitted when onReactContextInitialized is invoked. Closes #3392
Guy Carmeli 6 년 전
부모
커밋
84c6ed2859
1개의 변경된 파일3개의 추가작업 그리고 1개의 파일을 삭제
  1. 3
    1
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java

+ 3
- 1
lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java 파일 보기

@@ -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