public abstract class ReactNativeHost
extends java.lang.Object
ReactInstanceManager
. This can be used in your
class
(see ReactApplication
), or as a static field.Modifier | Constructor and Description |
---|---|
protected |
ReactNativeHost(android.app.Application application) |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Destroy the current instance and release the internal reference to it, allowing it to be GCed.
|
protected ReactInstanceManager |
createReactInstanceManager() |
protected android.app.Application |
getApplication() |
protected java.lang.String |
getBundleAssetName()
Returns the name of the bundle in assets.
|
protected java.lang.String |
getJSBundleFile()
Returns a custom path of the bundle file.
|
protected java.lang.String |
getJSMainModuleName()
Returns the name of the main module.
|
protected abstract java.util.List<ReactPackage> |
getPackages()
Returns a list of
ReactPackage used by the app. |
ReactInstanceManager |
getReactInstanceManager()
Get the current
ReactInstanceManager instance, or create one. |
protected RedBoxHandler |
getRedBoxHandler()
Get the
RedBoxHandler to send RedBox-related callbacks to. |
protected UIImplementationProvider |
getUIImplementationProvider()
Get the
UIImplementationProvider to use. |
protected abstract boolean |
getUseDeveloperSupport()
Returns whether dev mode should be enabled.
|
boolean |
hasInstance()
Get whether this holder contains a
ReactInstanceManager instance, or not. |
public ReactInstanceManager getReactInstanceManager()
ReactInstanceManager
instance, or create one.public boolean hasInstance()
ReactInstanceManager
instance, or not. I.e. if
getReactInstanceManager()
has been called at least once since this object was created
or clear()
was called.public void clear()
protected ReactInstanceManager createReactInstanceManager()
@Nullable protected RedBoxHandler getRedBoxHandler()
RedBoxHandler
to send RedBox-related callbacks to.protected final android.app.Application getApplication()
protected UIImplementationProvider getUIImplementationProvider()
UIImplementationProvider
to use. Override this method if you want to use a
custom UI implementation.
Note: this is very advanced functionality, in 99% of cases you don't need to override this.protected java.lang.String getJSMainModuleName()
ReactInstanceManager
is created.
e.g. "index.android"@Nullable protected java.lang.String getJSBundleFile()
getBundleAssetName
.
e.g. "file://sdcard/myapp_cache/index.android.bundle"@Nullable protected java.lang.String getBundleAssetName()
getUseDeveloperSupport
enabled and will
always try to load the JS bundle from the packager server.
e.g. "index.android.bundle"protected abstract boolean getUseDeveloperSupport()
protected abstract java.util.List<ReactPackage> getPackages()
ReactPackage
used by the app.
You'll most likely want to return at least the MainReactPackage
.
If your app uses additional views or modules besides the default ones,
you'll want to include more packages here.