UI Components
StreamingMessageView
StreamingMessageView is integrated into the SDK. It replaces MessageText when isMessageAIGenerated marks a message as AI-generated.
It renders the message with a typewriter animation and manages the UI for you.
To override it, provide your own component through WithComponents:
import { WithComponents } from "stream-chat-react-native";
<WithComponents overrides={{ StreamingMessageView: MyStreamingMessageView }}>
<Channel channel={channel}>{/* ... */}</Channel>
</WithComponents>;Best Practices
- Use
isMessageAIGeneratedto gate AI rendering explicitly. - Keep AI UI components in predictable locations to avoid layout jumps.
- Render
AITypingIndicatorViewonly when AI is active. - Provide a stop action (
StopMessageStreamingButton) for long generations. - Use
nullforStopMessageStreamingButtononly if you also provide another stop control.
Example usage
const isMessageAIGenerated = (message) => !!message.ai_generated;
const App = ({ children }) => (
<Chat client={client} isMessageAIGenerated={isMessageAIGenerated}>
{children}
</Chat>
);This renders any message with ai_generated: true using StreamingMessageView.
AITypingIndicatorView
AITypingIndicatorView is not rendered automatically. Import and render it as a child of Channel. It shows when AI state is:
AI_STATE_GENERATINGAI_STATE_THINKING
Example usage
const isMessageAIGenerated = (message) => !!message.ai_generated;
const App = () => (
<Chat client={client} isMessageAIGenerated={isMessageAIGenerated}>
<Channel channel={channel}>
<MessageList />
<AITypingIndicatorView />
<MessageComposer />
</Channel>
</Chat>
);This shows the indicator above MessageComposer when the AI state matches.
Props
| Prop | Description | Type |
|---|---|---|
channel |
Channel to read AI state from. Optional; defaults to the channel from the surrounding Channel context. |
Channel |
StopMessageStreamingButton
StopMessageStreamingButton lets users stop AI generation. It replaces the SendMessage button when AI state is:
AI_STATE_GENERATINGAI_STATE_THINKING
To override it, provide your own component through WithComponents:
import { WithComponents } from "stream-chat-react-native";
<WithComponents overrides={{ StopMessageStreamingButton: MyStopButton }}>
<Channel channel={channel}>{/* ... */}</Channel>
</WithComponents>;To hide it entirely, set StopMessageStreamingButton to null in the same WithComponents overrides.