public static class ReactInstanceManager.Builder
extends java.lang.Object
ReactInstanceManagerImpl
Modifier and Type | Field and Description |
---|---|
protected android.app.Application |
mApplication |
protected NotThreadSafeBridgeIdleDebugListener |
mBridgeIdleDebugListener |
protected android.app.Activity |
mCurrentActivity |
protected DefaultHardwareBackBtnHandler |
mDefaultHardwareBackBtnHandler |
protected LifecycleState |
mInitialLifecycleState |
protected java.lang.String |
mJSBundleAssetUrl |
protected JSBundleLoader |
mJSBundleLoader |
protected JSCConfig |
mJSCConfig |
protected java.lang.String |
mJSMainModuleName |
protected NativeModuleCallExceptionHandler |
mNativeModuleCallExceptionHandler |
protected java.util.List<ReactPackage> |
mPackages |
protected RedBoxHandler |
mRedBoxHandler |
protected UIImplementationProvider |
mUIImplementationProvider |
protected boolean |
mUseDeveloperSupport |
Modifier | Constructor and Description |
---|---|
protected |
ReactInstanceManager.Builder() |
Modifier and Type | Method and Description |
---|---|
ReactInstanceManager.Builder |
addPackage(ReactPackage reactPackage) |
ReactInstanceManager |
build()
Instantiates a new
ReactInstanceManagerImpl . |
ReactInstanceManager.Builder |
setApplication(android.app.Application application)
Required.
|
ReactInstanceManager.Builder |
setBridgeIdleDebugListener(NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener) |
ReactInstanceManager.Builder |
setBundleAssetName(java.lang.String bundleAssetName)
Name of the JS bundle file to be loaded from application's raw assets.
|
ReactInstanceManager.Builder |
setCurrentActivity(android.app.Activity activity) |
ReactInstanceManager.Builder |
setDefaultHardwareBackBtnHandler(DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler) |
ReactInstanceManager.Builder |
setInitialLifecycleState(LifecycleState initialLifecycleState)
Sets the initial lifecycle state of the host.
|
ReactInstanceManager.Builder |
setJSBundleFile(java.lang.String jsBundleFile)
Path to the JS bundle file to be loaded from the file system.
|
ReactInstanceManager.Builder |
setJSBundleLoader(JSBundleLoader jsBundleLoader)
Bundle loader to use when setting up JS environment.
|
ReactInstanceManager.Builder |
setJSCConfig(JSCConfig jscConfig) |
ReactInstanceManager.Builder |
setJSMainModuleName(java.lang.String jsMainModuleName)
Path to your app's main module on the packager server.
|
ReactInstanceManager.Builder |
setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler)
Set the exception handler for all native module calls.
|
ReactInstanceManager.Builder |
setRedBoxHandler(RedBoxHandler redBoxHandler) |
ReactInstanceManager.Builder |
setUIImplementationProvider(UIImplementationProvider uiImplementationProvider)
Sets a provider of
UIImplementation . |
ReactInstanceManager.Builder |
setUseDeveloperSupport(boolean useDeveloperSupport)
When
true , developer options such as JS reloading and debugging are enabled. |
protected final java.util.List<ReactPackage> mPackages
@Nullable protected java.lang.String mJSBundleAssetUrl
@Nullable protected JSBundleLoader mJSBundleLoader
@Nullable protected java.lang.String mJSMainModuleName
@Nullable protected NotThreadSafeBridgeIdleDebugListener mBridgeIdleDebugListener
@Nullable protected android.app.Application mApplication
protected boolean mUseDeveloperSupport
@Nullable protected LifecycleState mInitialLifecycleState
@Nullable protected UIImplementationProvider mUIImplementationProvider
@Nullable protected NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler
protected JSCConfig mJSCConfig
@Nullable protected android.app.Activity mCurrentActivity
@Nullable protected DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler
@Nullable protected RedBoxHandler mRedBoxHandler
public ReactInstanceManager.Builder setUIImplementationProvider(@Nullable UIImplementationProvider uiImplementationProvider)
UIImplementation
.
Uses default provider if null is passed.public ReactInstanceManager.Builder setBundleAssetName(java.lang.String bundleAssetName)
"index.android.js"
public ReactInstanceManager.Builder setJSBundleFile(java.lang.String jsBundleFile)
"assets://index.android.js" or "/sdcard/main.jsbundle"
public ReactInstanceManager.Builder setJSBundleLoader(JSBundleLoader jsBundleLoader)
setJSBundleFile
and setBundleAssetName
.
Example: JSBundleLoader.createFileLoader(application, bundleFile)
public ReactInstanceManager.Builder setJSMainModuleName(java.lang.String jsMainModuleName)
"index.android"
or
"subdirectory/index.android"
public ReactInstanceManager.Builder addPackage(ReactPackage reactPackage)
public ReactInstanceManager.Builder setBridgeIdleDebugListener(NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener)
public ReactInstanceManager.Builder setApplication(android.app.Application application)
Application
instance.public ReactInstanceManager.Builder setCurrentActivity(android.app.Activity activity)
public ReactInstanceManager.Builder setDefaultHardwareBackBtnHandler(DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler)
public ReactInstanceManager.Builder setUseDeveloperSupport(boolean useDeveloperSupport)
true
, developer options such as JS reloading and debugging are enabled.
Note you still have to call ReactInstanceManager.showDevOptionsDialog()
to show the dev menu,
e.g. when the device Menu button is pressed.public ReactInstanceManager.Builder setInitialLifecycleState(LifecycleState initialLifecycleState)
public ReactInstanceManager.Builder setNativeModuleCallExceptionHandler(NativeModuleCallExceptionHandler handler)
DevSupportManager
will be used, which shows a redbox in dev mode and rethrows
(crashes the app) in prod mode.public ReactInstanceManager.Builder setJSCConfig(JSCConfig jscConfig)
public ReactInstanceManager.Builder setRedBoxHandler(@Nullable RedBoxHandler redBoxHandler)
public ReactInstanceManager build()
ReactInstanceManagerImpl
.
Before calling build
, the following must be called:
setApplication(android.app.Application)
setCurrentActivity(android.app.Activity)
if the activity has already resumed
setDefaultHardwareBackBtnHandler(com.facebook.react.modules.core.DefaultHardwareBackBtnHandler)
if the activity has already resumed
setJSBundleFile(java.lang.String)
or setJSMainModuleName(java.lang.String)