Bladeren bron

fixed init of EventEmitter

Daniel Zlotin 7 jaren geleden
bovenliggende
commit
1d579efccd

+ 5
- 1
android/app/src/main/java/com/reactnativenavigation/react/NavigationReactGateway.java Bestand weergeven

@@ -65,7 +65,6 @@ public class NavigationReactGateway implements ReactGateway {
65 65
     }
66 66
 
67 67
     public void onResumeActivity(Activity activity, DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler) {
68
-        reactEventEmitter = new NavigationReactEventEmitter(getReactContext());
69 68
         getReactInstanceManager().onHostResume(activity, defaultHardwareBackBtnHandler);
70 69
     }
71 70
 
@@ -77,6 +76,10 @@ public class NavigationReactGateway implements ReactGateway {
77 76
         return host;
78 77
     }
79 78
 
79
+    //TODO temp hack
80
+    void onReactContextInitialized() {
81
+        reactEventEmitter = new NavigationReactEventEmitter(getReactContext());
82
+    }
80 83
 
81 84
     private static class ReactNativeHostImpl extends ReactNativeHost implements ReactInstanceManager.ReactInstanceEventListener {
82 85
 
@@ -135,6 +138,7 @@ public class NavigationReactGateway implements ReactGateway {
135 138
 
136 139
         @Override
137 140
         public void onReactContextInitialized(ReactContext context) {
141
+            ((NavigationReactGateway) NavigationApplication.instance.getReactGateway()).onReactContextInitialized();
138 142
             NavigationApplication.instance.onReactInitialized(context);
139 143
         }
140 144