ReactInstanceManager

This class is managing instances of CatalystInstance. It exposes a way to configure catalyst instance using ReactPackage and keeps track of the lifecycle of that instance. It also sets up connection between the instance and developers support functionality of the framework.

An instance of this manager is required to start JS application in ReactRootView (see startReactApplication for more info).

The lifecycle of the instance of ReactInstanceManager should be bound to the activity that owns the ReactRootView that is used to render react application using this instance manager (see startReactApplication). It's required to pass owning activity's lifecycle events to the instance manager (see onHostPause, onHostDestroy and onHostResume).

To instantiate an instance of this class use builder.

Types

Link copied to clipboard
Listener interface for react instance events.

Functions

Link copied to clipboard
Add a listener to be notified of react instance events.
Link copied to clipboard
open fun attachRootView(reactRoot: ReactRoot)
Attach given {@param reactRoot} to a catalyst instance manager and start JS application using JS module provided by getJSModuleName.
Link copied to clipboard
Creates a builder that is capable of creating an instance of ReactInstanceManager.
Link copied to clipboard
Trigger react context initialization asynchronously in a background async task.
Link copied to clipboard
open fun createViewManager(viewManagerName: String): ViewManager
Link copied to clipboard
open fun destroy()
Destroy this React instance and the attached JS context.
Link copied to clipboard
open fun detachRootView(reactRoot: ReactRoot)
Detach given {@param reactRoot} from current catalyst instance.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getOrCreateViewManagers(catalystApplicationContext: ReactApplicationContext): List<ViewManager>
Uses configured ReactPackage instances to create all view managers.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun invalidate()
Permanently destroys the ReactInstanceManager, including the CatalystInstance (if any).
Link copied to clipboard
open fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, @Nullable data: Intent)
Link copied to clipboard
open fun onBackPressed()
This method will give JS the opportunity to consume the back button event.
Link copied to clipboard
open fun onConfigurationChanged(updatedContext: Context, @Nullable newConfig: Configuration)
Call this from onConfigurationChanged.
Link copied to clipboard
open fun onHostDestroy()
open fun onHostDestroy(@Nullable activity: Activity)
Call this from onDestroy.
Link copied to clipboard
open fun onHostPause()
open fun onHostPause(@Nullable activity: Activity)
Call this from onPause.
Link copied to clipboard
open fun onHostResume(@Nullable activity: Activity)
Use this method when the activity resumes.
open fun onHostResume(@Nullable activity: Activity, defaultBackButtonImpl: DefaultHardwareBackBtnHandler)
Use this method when the activity resumes to enable invoking the back button directly from JS.
Link copied to clipboard
open fun onNewIntent(intent: Intent)
This method will give JS the opportunity to receive intents via Linking.
Link copied to clipboard
open fun onUserLeaveHint(@Nullable activity: Activity)
This method should be called from onUserLeaveHint.
Link copied to clipboard
open fun onWindowFocusChange(hasFocus: Boolean)
Link copied to clipboard
Recreate the react application and context.
Link copied to clipboard
Remove a listener previously added with addReactInstanceEventListener.
Link copied to clipboard
open fun setUseFallbackBundle(useFallbackBundle: Boolean)
Link copied to clipboard