mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-05 09:29:07 +08:00
Add dev bundle download listener on Android
Summary: This exposes a way to listen to JS bundle download events when creating a ReactInstanceManager. This can be used to display a custom native UI while the JS bundle is loading. It is a pretty specific use case but Expo will need this to display loading progress on the app loading splash screen. **Test plan** Tested by adding a listener to the ReactInstanceManager in the Expo app and checked that it gets called when the bundle is loading. Closes https://github.com/facebook/react-native/pull/12984 Reviewed By: devknoll Differential Revision: D4797638 Pulled By: hramos fbshipit-source-id: 04d7cd4071535670c1bcb121566748e495197c80
This commit is contained in:
committed by
Facebook Github Bot
parent
c848c3820b
commit
960e5db0ed
@@ -15,6 +15,7 @@ import com.facebook.react.bridge.NativeModuleCallExceptionHandler;
|
||||
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
|
||||
import com.facebook.react.bridge.JSBundleLoader;
|
||||
import com.facebook.react.common.LifecycleState;
|
||||
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
||||
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
||||
import com.facebook.react.devsupport.RedBoxHandler;
|
||||
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
||||
@@ -42,6 +43,7 @@ public class ReactInstanceManagerBuilder {
|
||||
protected @Nullable RedBoxHandler mRedBoxHandler;
|
||||
protected boolean mLazyNativeModulesEnabled;
|
||||
protected boolean mLazyViewManagersEnabled;
|
||||
protected @Nullable DevBundleDownloadListener mDevBundleDownloadListener;
|
||||
protected boolean mSetupReactContextInBackground;
|
||||
protected boolean mUseSeparateUIBackgroundThread;
|
||||
protected int mMinNumShakes = 1;
|
||||
@@ -189,6 +191,11 @@ public class ReactInstanceManagerBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setDevBundleDownloadListener(@Nullable DevBundleDownloadListener listener) {
|
||||
mDevBundleDownloadListener = listener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReactInstanceManagerBuilder setSetupReactContextInBackgroundEnabled(
|
||||
boolean setupReactContextInBackground) {
|
||||
mSetupReactContextInBackground = setupReactContextInBackground;
|
||||
@@ -252,6 +259,7 @@ public class ReactInstanceManagerBuilder {
|
||||
mRedBoxHandler,
|
||||
mLazyNativeModulesEnabled,
|
||||
mLazyViewManagersEnabled,
|
||||
mDevBundleDownloadListener,
|
||||
mSetupReactContextInBackground,
|
||||
mUseSeparateUIBackgroundThread,
|
||||
mMinNumShakes);
|
||||
|
||||
Reference in New Issue
Block a user