import {
OverlayProvider,
Chat,
Channel,
Thread,
} from "stream-chat-react-native";
const App = () => {
return (
<OverlayProvider>
<Chat client={client}>
<Channel channel={channel} thread={message} threadList>
<Thread />
</Channel>
</Chat>
</OverlayProvider>
);
};Thread
Renders thread replies for a message, with an input for new replies. Internally uses MessageList and MessageComposer.
Best Practices
- Render
ThreadwithinChanneland passthread/threadListcorrectly. - Use
closeThreadOnDismountto keep channel state in sync. - Avoid heavy customization; override
MessageList/MessageComposeronly when needed. - Keep thread input focused only when appropriate (
autoFocus). - Use
reloadThread/loadMoreThreadinstead of manual pagination.
General Usage
Props
| Prop | Description | Type |
|---|---|---|
additionalMessageComposerProps | Additional props for underlying MessageComposer component. | object |
additionalMessageListProps | Additional props for underlying MessageList component. | object |
additionalMessageFlashListProps | Additional props for underlying MessageFlashList component. | object |
autoFocus | When true, the input auto-focuses on mount. Defaults to true. | boolean |
client | Stream Chat client instance. | StreamChat |
closeThreadOnDismount | Closes thread on dismount. Defaults to true. | boolean |
disabled | When true, the underlying input box will be disabled. Defaults to false. | boolean |
onThreadDismount | Called when Thread unmounts. | function |
closeThread | Unsets the thread and thread messages in the Channel state. | function |
loadMoreThread | Loads more messages for the thread. Returns a promise. | () => Promise<void> |
parentMessagePreventPress | Boolean to enable/disable parent message press. Defaults to true. | boolean |
reloadThread | Reloads the thread and thread messages. | function |
thread | Can be a LocalMessage or ThreadType. Setting it indicates a thread is open. Set thread on all Channel components when a thread is open. | object |
threadInstance | Instance of Thread used to read more data or pass to onThreadSelect. | Thread |
UI Component Props
| Prop | Description | Type |
|---|---|---|
MessageList | Custom message list component. Defaults to MessageList. | ComponentType |
MessageComposer | Custom message composer component. Defaults to MessageComposer. | ComponentType |