|
@@ -3,7 +3,6 @@ package com.reactnativenavigation.react;
|
3
|
3
|
import android.app.Activity;
|
4
|
4
|
import android.content.Intent;
|
5
|
5
|
|
6
|
|
-import com.facebook.react.LifecycleState;
|
7
|
6
|
import com.facebook.react.ReactInstanceManager;
|
8
|
7
|
import com.facebook.react.ReactPackage;
|
9
|
8
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -16,13 +15,14 @@ import com.reactnativenavigation.bridge.NavigationReactPackage;
|
16
|
15
|
import java.util.ArrayList;
|
17
|
16
|
import java.util.List;
|
18
|
17
|
|
19
|
|
-public class NavigationReactGateway implements ReactGateway, ReactInstanceManager.ReactInstanceEventListener {
|
|
18
|
+public class NavigationReactGateway extends ReactGatewayHost implements ReactInstanceManager.ReactInstanceEventListener {
|
20
|
19
|
|
21
|
20
|
private OnJsDevReloadListener onJsDevReloadListener;
|
22
|
21
|
private ReactInstanceManager reactInstanceManager;
|
23
|
22
|
private NavigationReactEventEmitter reactEventEmitter;
|
24
|
23
|
|
25
|
24
|
public NavigationReactGateway() {
|
|
25
|
+ super(NavigationApplication.instance);
|
26
|
26
|
reactInstanceManager = createReactInstanceManager();
|
27
|
27
|
}
|
28
|
28
|
|
|
@@ -88,29 +88,26 @@ public class NavigationReactGateway implements ReactGateway, ReactInstanceManage
|
88
|
88
|
}).replace();
|
89
|
89
|
}
|
90
|
90
|
|
91
|
|
- private ReactInstanceManager createReactInstanceManager() {
|
92
|
|
- ReactInstanceManager.Builder builder = ReactInstanceManager.builder()
|
93
|
|
- .setApplication(NavigationApplication.instance)
|
94
|
|
- .setJSMainModuleName(NavigationApplication.instance.getJsEntryFileName())
|
95
|
|
- .setBundleAssetName(NavigationApplication.instance.getBundleAssetName())
|
96
|
|
- .setUseDeveloperSupport(NavigationApplication.instance.isDebug())
|
97
|
|
- .setInitialLifecycleState(LifecycleState.BEFORE_RESUME);
|
98
|
|
-
|
99
|
|
- for (ReactPackage reactPackage : createReactPackages()) {
|
100
|
|
- builder.addPackage(reactPackage);
|
101
|
|
- }
|
102
|
|
-
|
103
|
|
- ReactInstanceManager manager = builder.build();
|
104
|
|
-
|
|
91
|
+ @Override
|
|
92
|
+ protected ReactInstanceManager createReactInstanceManager() {
|
|
93
|
+ ReactInstanceManager manager = super.createReactInstanceManager();
|
105
|
94
|
if (NavigationApplication.instance.isDebug()) {
|
106
|
95
|
replaceJsDevReloadListener(manager);
|
107
|
96
|
}
|
108
|
|
-
|
109
|
97
|
manager.addReactInstanceEventListener(this);
|
110
|
|
-
|
111
|
98
|
return manager;
|
112
|
99
|
}
|
113
|
100
|
|
|
101
|
+ @Override
|
|
102
|
+ protected boolean getUseDeveloperSupport() {
|
|
103
|
+ return NavigationApplication.instance.isDebug();
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ @Override
|
|
107
|
+ protected List<ReactPackage> getPackages() {
|
|
108
|
+ return createReactPackages();
|
|
109
|
+ }
|
|
110
|
+
|
114
|
111
|
private List<ReactPackage> createReactPackages() {
|
115
|
112
|
List<ReactPackage> list = new ArrayList<>();
|
116
|
113
|
list.add(new MainReactPackage());
|