|
@@ -8,6 +8,7 @@ import com.facebook.react.ReactNativeHost;
|
8
|
8
|
import com.facebook.react.ReactPackage;
|
9
|
9
|
import com.facebook.soloader.SoLoader;
|
10
|
10
|
import com.reactnativenavigation.NavigationActivity;
|
|
11
|
+import com.reactnativenavigation.utils.Functions.FuncR;
|
11
|
12
|
|
12
|
13
|
import java.util.List;
|
13
|
14
|
|
|
@@ -22,15 +23,20 @@ public class ReactGateway {
|
22
|
23
|
this(application, isDebug, new NavigationReactNativeHost(application, isDebug, additionalReactPackages));
|
23
|
24
|
}
|
24
|
25
|
|
25
|
|
- public ReactGateway(final Application application, final boolean isDebug, final ReactNativeHost host) {
|
|
26
|
+ @SuppressWarnings("WeakerAccess")
|
|
27
|
+ public ReactGateway(final Application application, final boolean isDebug, final ReactNativeHost host) {
|
|
28
|
+ this(application, isDebug, () -> host);
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ public ReactGateway(final Application application, final boolean isDebug, FuncR<ReactNativeHost> hostCreator) {
|
26
|
32
|
SoLoader.init(application, false);
|
27
|
|
- this.host = host;
|
28
|
|
- initializer = new NavigationReactInitializer(host.getReactInstanceManager(), isDebug);
|
29
|
|
- jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager());
|
|
33
|
+ this.host = hostCreator.run();
|
|
34
|
+ initializer = new NavigationReactInitializer(host.getReactInstanceManager(), isDebug);
|
|
35
|
+ jsDevReloadHandler = new JsDevReloadHandler(host.getReactInstanceManager().getDevSupportManager());
|
30
|
36
|
if (host instanceof BundleDownloadListenerProvider) {
|
31
|
37
|
((BundleDownloadListenerProvider) host).setBundleLoaderListener(jsDevReloadHandler);
|
32
|
38
|
}
|
33
|
|
- }
|
|
39
|
+ }
|
34
|
40
|
|
35
|
41
|
public ReactNativeHost getReactNativeHost() {
|
36
|
42
|
return host;
|