Events in React Native SDK
Events sent through onMessageReceived
The SDK offers a mechanism to communicate events occuring in the native module or in the Experience so your app can maintain control of its operations. This is achieved through a property onMessageReceived
in the MonterosaSdkExperienceView
.
The messages received will always contain a type
string to act as a discriminator between event types, and a payload.
For instances, the following code prints the type and payload of events:
Message catalog
This section outlines the potential messages you'll receive.
Debug messages
These messages are helpful to understand what's happening in the native module and the Experience itself.
Experience messages:
These messages originate from the Experience itself. They can be used for a range of scenarios, such as reporting the size of the Experience, or responding to requests for data sent from the app.
Identify Events
These messages are sent when an event has been triggered in Identify, an API service Monterosa offers to facilitate SSO between the parent app and the Experience.
There's multiple types of events being emitted here, looking like so:
Did update credentials
Called when the credentials are updated by either you or the Experience.
Did update user data
Called when the Experience requests the user data. This value will be expired in 10 seconds, the call will be repeated then with a null signature.
Did update session signature
Received when the user is logged in by the Experience and a signature is generated. This value will be expired in 10 seconds, the call will be repeated then with a null signature.
Did request login
Requested by the Experience when the user interacts with gated content to drive sign ups.
Did fail to validate credentials
Called when there was a problem while validating the credentials or logging in the user.
Experience Events
Did start loading
Called when the Experience starts loading
Did end loading
Called when the Experience finishes loading
Did fail loading
Called when the Experience fails to load
Did change intrinsic size
Called when the Experience content changes, requiring a new size to avoid using internal scroll bars.
Did become ready
Called when the Experience has completed parsing the HTML & JSS code used, and is ready to start sending and receiving messages.
Errors
Sent when an error occurs in the SDK, for instance when a request is sent to the Experience and no response is received.
Was this helpful?