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 MessageInput.
Best Practices
- Render
ThreadwithinChanneland passthread/threadListcorrectly. - Use
closeThreadOnDismountto keep channel state in sync. - Avoid heavy customization; override
MessageList/MessageInputonly when needed. - Keep thread input focused only when appropriate (
autoFocus). - Use
reloadThread/loadMoreThreadinstead of manual pagination.
General Usage
Props
additionalMessageInputProps
Additional props for underlying MessageInput component.
| Type |
|---|
| Object |
additionalMessageListProps
Additional props for underlying MessageList component.
| Type |
|---|
| Object |
autoFocus
When true, the input auto-focuses on mount.
| Type | Default |
|---|---|
| Boolean | true |
closeThreadOnDismount
Closes thread on dismount, defaults to true.
| Type | Default |
|---|---|
| Boolean | true |
client
Stream Chat client instance.
| Type |
|---|
StreamChat |
closeThread
Unsets the thread and thread messages in the Channel state.
| Type |
|---|
| Function |
disabled
When true, the underlying input box will be disabled.
| Type | Default |
|---|---|
| Boolean | false |
loadMoreThread
Loads more messages for the thread. Returns a promise.
| Type |
|---|
() => Promise<void> |
onThreadDismount
Called when Thread unmounts.
| Type |
|---|
| Function |
parentMessagePreventPress
Boolean to enable/disable parent message press.
| Type | Default |
|---|---|
| Boolean | true |
reloadThread
Reloads the thread and thread messages.
| Type |
|---|
| function |
thread
Can be a LocalMessage or ThreadType. Setting it indicates a thread is open. Both types are interchangeable.
With Thread, this displays the thread. With the standard MessageList, it keeps singleton components in OverlayProvider in sync.
Set thread on all Channel components when a thread is open.
| Type |
|---|
| object |
UI Component Props
MessageList
| Type | Default |
|---|---|
| ComponentType | MessageList |
MessageInput
| Type | Default |
|---|---|
| ComponentType | MessageInput |