SDKsReact Native
Update input states
OpenIM React Native SDK guide for update input states.
Use changeInputStates() to update the current account's input state in a conversation. Pass focus: true while typing, and false after sending, losing focus, or leaving the conversation.
await OpenIMSDK.changeInputStates({
conversationID,
focus: true,
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | string | Yes | Conversation whose input state is updated. |
focus | boolean | Yes | true means the user is typing; false means typing has stopped. |
Avoid reporting the same state on every keyboard event. When the state changes, OnInputStatusChanged is emitted with conversationID, userID, and platformIDs.
function handleInputStatusChanged(inputStatus) {
// ...
}
// Set the listener
OpenIMSDK.on(OpenIMEvent.OnInputStatusChanged, handleInputStatusChanged);
// Remove the listener
OpenIMSDK.off(OpenIMEvent.OnInputStatusChanged, handleInputStatusChanged);Remove the listener when the component is destroyed, the account signs out, or the account changes.
Was this page helpful?