소스 검색

Pass newly created ReactContext from ReactInstanceEventListener

Guy Carmeli 6 년 전
부모
커밋
350f48aee1
1개의 변경된 파일4개의 추가작업 그리고 4개의 파일을 삭제
  1. 4
    4
      lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java

+ 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
 }