MessageComposerAPIContext

MessageComposerAPIContext is provided by Channel. If you are not familiar with the React Context API, see the React docs.

Best Practices

  • Use this context only for editing/quoting state changes.
  • Read editedMessage and quotedMessage from useMessageComposer for state.
  • Clear edit/quote state promptly to avoid stale UI.
  • Keep handlers stable to avoid re-renders in the input.
  • Avoid using this context deep in the message list.

Basic Usage

Consume MessageComposerAPIContext in any child of Channel:

import { useMessageComposerAPIContext } from "stream-chat-react-native";

const { setEditingState, clearEditingState } = useMessageComposerAPIContext();
Note:

To read editing and quotedMessage state, use the useMessageComposer hook.

import { useMessageComposer } from "stream-chat-react-native";

const { editedMessage, quotedMessage } = useMessageComposer();

Values

Value Description Type
setEditingState Sets the editing state of the message composer. (message: LocalMessage | undefined) => void
clearEditingState Clears the editing state of the message composer. () => void
setQuotedMessage Sets the quoted message in the message composer. (message: LocalMessage | undefined) => void
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Chat React Native v9: <Your Question>