-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathNavigationReactNativeHost.java
More file actions
42 lines (35 loc) · 1.46 KB
/
NavigationReactNativeHost.java
File metadata and controls
42 lines (35 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.reactnativenavigation.react;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactInstanceManagerBuilder;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.common.LifecycleState;
import com.facebook.react.defaults.DefaultReactNativeHost;
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
import com.reactnativenavigation.NavigationApplication;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
public abstract class NavigationReactNativeHost extends DefaultReactNativeHost implements BundleDownloadListenerProvider {
private @Nullable NavigationDevBundleDownloadListener bundleListener;
private final DevBundleDownloadListener bundleListenerMediator = new DevBundleDownloadListenerAdapter() {
@Override
public void onSuccess() {
if (bundleListener != null) {
bundleListener.onSuccess();
}
}
};
public NavigationReactNativeHost(NavigationApplication application) {
super(application);
}
@Override
public void setBundleLoaderListener(NavigationDevBundleDownloadListener listener) {
bundleListener = listener;
}
@SuppressWarnings("WeakerAccess")
@NonNull
protected DevBundleDownloadListener getDevBundleDownloadListener() {
return bundleListenerMediator;
}
}