CatalystInstance

Deprecated

This class is deprecated, please to migrate to new architecture using [com.facebook.react.defaults.DefaultReactHost] instead.

A higher level API on top of the asynchronous JSC bridge. This provides an environment allowing the invocation of JavaScript methods and lets a set of Java APIs be invocable from JavaScript as well.

Inheritors

Properties

Link copied to clipboard
abstract val isDestroyed: Boolean
Link copied to clipboard

Do not use this anymore. Use getRuntimeExecutor instead. Get the C pointer (as a long) to the JavaScriptCore context associated with this instance.

Link copied to clipboard
@get:JvmName(name = "getJSCallInvokerHolder")
abstract val jsCallInvokerHolder: CallInvokerHolder

Returns a hybrid object that contains a pointer to a JS CallInvoker, which is used to schedule work on the JS Thread. Required for TurboModuleManager initialization.

Link copied to clipboard

Returns a hybrid object that contains a pointer to a NativeMethodCallInvoker, which is used to schedule work on the NativeModules thread. Required for TurboModuleManager initialization.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val sourceURL: String?

Return the source URL of the JS Bundle that was run, or null if no JS bundle has been run yet.

Functions

Link copied to clipboard

Adds a idle listener for this Catalyst instance. The listener will receive notifications whenever the bridge transitions from idle to busy and vice-versa, where the busy state is defined as there being some non-zero number of calls to JS that haven't resolved via a onBatchCompleted call. The listener should be purely passive and not affect application logic.

Link copied to clipboard
abstract fun callFunction(module: String, method: String, arguments: NativeArray?)
Link copied to clipboard
abstract fun destroy()

Destroys this catalyst instance, waiting for any other threads in ReactQueueConfiguration (besides the UI thread) to finish running. Must be called from the UI thread so that we can fully shut down other threads.

Link copied to clipboard

This method permits a CatalystInstance to extend the known Native modules. This provided registry contains only the new modules to load.

Link copied to clipboard
abstract fun getFabricUIManager(): UIManager?
Link copied to clipboard
abstract fun <T : JavaScriptModule> getJSModule(jsInterface: Class<T>): T?
Link copied to clipboard
abstract fun <T : NativeModule> getNativeModule(nativeModuleInterface: Class<T>): T?
abstract fun getNativeModule(moduleName: String): NativeModule?
Link copied to clipboard
abstract fun handleMemoryPressure(level: Int)

Called when the system generates a memory warning.

Link copied to clipboard
abstract fun <T : NativeModule> hasNativeModule(nativeModuleInterface: Class<T>): Boolean
Link copied to clipboard
abstract fun hasRunJSBundle(): Boolean
Link copied to clipboard
abstract fun initialize()

Initialize all the native modules

Link copied to clipboard
abstract override fun invokeCallback(callbackID: Int, arguments: NativeArrayInterface)
Link copied to clipboard
abstract fun loadScriptFromAssets(assetManager: AssetManager, assetURL: String, loadSynchronously: Boolean)

Load a JS bundle from Android assets. See JSBundleLoader.createAssetLoader

Link copied to clipboard
abstract fun loadScriptFromFile(fileName: String, sourceURL: String, loadSynchronously: Boolean)

Load a JS bundle from the filesystem. See JSBundleLoader.createFileLoader and JSBundleLoader.createCachedBundleFromNetworkLoader

Link copied to clipboard
abstract fun loadSplitBundleFromFile(fileName: String, sourceURL: String)

Load a split JS bundle from the filesystem. See JSBundleLoader.createCachedSplitBundleFromNetworkLoader.

Link copied to clipboard
abstract fun registerSegment(segmentId: Int, path: String)

This method registers the file path of an additional JS segment by its ID.

Link copied to clipboard

Removes a NotThreadSafeBridgeIdleDebugListener previously added with .addBridgeIdleDebugListener

Link copied to clipboard
abstract fun runJSBundle()
Link copied to clipboard
abstract fun setFabricUIManager(fabricUIManager: UIManager)
Link copied to clipboard
abstract fun setGlobalVariable(propName: String, jsonValue: String)
Link copied to clipboard
abstract fun setSourceURLs(deviceURL: String, remoteURL: String)

This API is used in situations where the JS bundle is being executed not on the device, but on a host machine. In that case, we must provide two source URLs for the JS bundle: One to be used on the device, and one to be used on the remote debugging machine.

Link copied to clipboard
abstract fun setTurboModuleRegistry(turboModuleRegistry: TurboModuleRegistry)