JavaScript Module
Besides native components, we are exposing JavaScript functions to control the behavior of those components from React Native app.
Usage
To use the module, import it:
Methods
setNativeBackGestureAndButtonEnabled
A method used to toggle iOS native back gesture and Android hardware back button.
Parameters:
Example:
popToNative
A method to pop to native screen used to push React Native experience.
Parameters:
Example:
postMessage
Send a JSON-serializable message to the native host application. This resembles the web window.postMessage API.
Parameters:
This method is available both on the New Architecture and the Old Architecture.
Example:
onMessage
Subscribe to messages sent from the native host application. Returns a subscription object with a remove() method for cleanup.
Parameters:
The MessageEvent object has a data property containing the deserialized message payload.
Returns: { remove: () => void } - call remove() to unsubscribe.
Example:
Full example with React hooks:
These methods work only with native components provided by this library.
