|
@@ -1,18 +1,13 @@
|
1
|
1
|
package com.reactnativenavigation.react;
|
2
|
2
|
|
3
|
|
-import com.facebook.react.devsupport.DevSupportManager;
|
4
|
|
-import com.facebook.react.devsupport.DevSupportManagerImpl;
|
5
|
|
-import com.facebook.react.devsupport.ReactInstanceDevCommandsHandler;
|
6
|
|
-import com.facebook.react.devsupport.RedBoxHandler;
|
7
|
3
|
import com.reactnativenavigation.NavigationActivity;
|
8
|
4
|
import com.reactnativenavigation.NavigationApplication;
|
9
|
|
-import com.reactnativenavigation.utils.ReflectionUtils;
|
10
|
5
|
|
11
|
6
|
public class ReactGateway {
|
12
|
7
|
|
13
|
|
- public interface JsReloadListener {
|
14
|
|
- void onJsReload();
|
15
|
|
- }
|
|
8
|
+// public interface JsReloadListener {
|
|
9
|
+// void onJsReload();
|
|
10
|
+// }
|
16
|
11
|
|
17
|
12
|
private final NavigationReactNativeHost reactNativeHost;
|
18
|
13
|
private final NavigationReactInitializer initializer;
|
|
@@ -21,21 +16,28 @@ public class ReactGateway {
|
21
|
16
|
public ReactGateway(final NavigationApplication application, final boolean isDebug) {
|
22
|
17
|
reactNativeHost = new NavigationReactNativeHost(application, isDebug);
|
23
|
18
|
|
24
|
|
- DevSupportManager devSupportManager = reactNativeHost.getReactInstanceManager().getDevSupportManager();
|
25
|
|
- ReactInstanceDevCommandsHandler reactInstanceCommandsHandler = (ReactInstanceDevCommandsHandler) ReflectionUtils.getDeclaredField(devSupportManager, "mReactInstanceCommandsHandler");
|
26
|
|
- String packagerPathForJsBundle = reactNativeHost.getJSMainModuleName();
|
27
|
|
- boolean enableOnCreate = reactNativeHost.getUseDeveloperSupport();
|
28
|
|
- RedBoxHandler redBoxHandler = reactNativeHost.getRedBoxHandler();
|
29
|
|
- DevSupportManagerImpl proxy = new DevSupportManagerImpl(application, reactInstanceCommandsHandler, packagerPathForJsBundle, enableOnCreate, redBoxHandler) {
|
30
|
|
- @Override
|
31
|
|
- public void handleReloadJS() {
|
32
|
|
- super.handleReloadJS();
|
33
|
|
- // onJsReload
|
|
19
|
+// DevSupportManager devSupportManager = reactNativeHost.getReactInstanceManager().getDevSupportManager();
|
|
20
|
+// ReactInstanceDevCommandsHandler reactInstanceCommandsHandler = (ReactInstanceDevCommandsHandler) ReflectionUtils.getDeclaredField(devSupportManager, "mReactInstanceCommandsHandler");
|
|
21
|
+// String packagerPathForJsBundle = reactNativeHost.getJSMainModuleName();
|
|
22
|
+// boolean enableOnCreate = reactNativeHost.getUseDeveloperSupport();
|
|
23
|
+// RedBoxHandler redBoxHandler = reactNativeHost.getRedBoxHandler();
|
|
24
|
+// DevSupportManagerImpl proxy = new DevSupportManagerImpl(application, reactInstanceCommandsHandler, packagerPathForJsBundle, enableOnCreate, redBoxHandler) {
|
|
25
|
+// @Override
|
|
26
|
+// public void handleReloadJS() {
|
|
27
|
+// super.handleReloadJS();
|
|
28
|
+//
|
|
29
|
+//
|
|
30
|
+// // onJsReload
|
34
|
31
|
// ReactContext currentReactContext = reactNativeHost.getReactInstanceManager().getCurrentReactContext();
|
35
|
|
-// ((NavigationActivity) currentReactContext.getCurrentActivity()).getNavigator().onDestroy();
|
36
|
|
- }
|
37
|
|
- };
|
38
|
|
- ReflectionUtils.setField(reactNativeHost.getReactInstanceManager(), "mDevSupportManager", proxy);
|
|
32
|
+// if (currentReactContext != null) {
|
|
33
|
+// NavigationActivity activity = (NavigationActivity) currentReactContext.getCurrentActivity();
|
|
34
|
+// if (activity != null) {
|
|
35
|
+// activity.reset();
|
|
36
|
+// }
|
|
37
|
+// }
|
|
38
|
+// }
|
|
39
|
+// };
|
|
40
|
+// ReflectionUtils.setField(reactNativeHost.getReactInstanceManager(), "mDevSupportManager", proxy);
|
39
|
41
|
|
40
|
42
|
initializer = new NavigationReactInitializer(reactNativeHost.getReactInstanceManager(), isDebug);
|
41
|
43
|
jsDevReloadHandler = new JsDevReloadHandler(reactNativeHost.getReactInstanceManager());
|