MessageContent
Renders message content inside MessageList. This is the default component for the MessageContent prop.
Best Practices
- Keep content rendering lightweight to avoid list performance issues.
- Respect
messageContentOrderso attachments, polls, and text appear consistently. - Use
isAttachmentEqualfor attachment-heavy channels. - Keep press handlers fast and side-effect free.
- Keep padding overrides predictable across message types.
Props
additionalPressableProps
Extra props passed to the underlying Pressable used in message components like MessageContent.
| Type |
|---|
| object |
enableMessageGroupingByUser
Whether message grouping by user is enabled.
| Type |
|---|
| boolean |
backgroundColor
Message content background color.
| Type |
|---|
ColorValue |
goToMessage
Scrolls to a specific message in the chat.
| Type | Default |
|---|---|
(messageId: string) => void| undefined | undefined |
groupStyles
Position of the message within a group of consecutive messages from the same user. Use groupStyles to style messages based on position (for example, avatars show only on the last message).
| Type |
|---|
| array of enum('top', 'bottom', 'middle', 'single') |
isAttachmentEqual
Returns true if rendering nextAttachment would produce the same result as prevAttachment, otherwise false.
| Type |
|---|
| function |
| Parameter | Description |
|---|---|
| prevAttachment | previous message attachment to be compared |
| nextAttachment | next message attachment to be compared |
isMessageAIGenerated
Whether a message should be treated as AI-generated.
| Type |
|---|
| function |
isMyMessage
True if the message was sent by the current user.
| Type |
|---|
| boolean |
isMessageReceivedOrErrorType
Whether the message is incoming or in an error state.
| Type |
|---|
| boolean |
message
Message object.
| Type |
|---|
Message type |
messageContentOrder
Order of message content.
Example: ['quoted_reply', 'attachments', 'file', 'gallery', 'text']
| Type |
|---|
| array |
messageGroupedSingleOrBottom
Whether the message group style is single or bottom.
| Type |
|---|
| boolean |
myMessageTheme
Theme applied to the current user’s messages.
| Type |
|---|
| object |
Memoize this object or pass a stable reference.
noBorder
If true, the message content has no border.
| Type | Default |
|---|---|
Boolean| undefined | false |
isVeryLastMessage
Whether the message is the very last item in the list.
| Type |
|---|
| boolean |
setMessageContentWidth
Setter for measured message content width.
| Type |
|---|
Dispatch<SetStateAction<number>> |
onLongPress
Default long press handler for message UI.
| Type |
|---|
| function |
onPress
Default press handler for message UI.
| Type |
|---|
| function |
onPressIn
Default pressIn handler for message UI.
| Type |
|---|
| function |
otherAttachments
All attachments except file and image.
| Type |
|---|
| Array |
preventPress
Disable press interactions for this message content.
| Type |
|---|
| boolean |
threadList
True if the current message is part of a thread.
| Type |
|---|
| Boolean |
hidePaddingTop
Hide top padding in content container.
| Type |
|---|
| boolean |
hidePaddingHorizontal
Hide horizontal padding in content container.
| Type |
|---|
| boolean |
hidePaddingBottom
Hide bottom padding in content container.
| Type |
|---|
| boolean |
UI Component Props
Attachment
Renders attachments in MessageList.
Available props:
attachment{object}
| Type | Default |
|---|---|
| ComponentType | Attachment |
FileAttachmentGroup
Renders a group of file attachments when a message has multiple files.
| Type | Default |
|---|---|
| ComponentType | FileAttachmentGroup |
Gallery
Renders image attachments in MessageList.
| Type | Default |
|---|---|
| ComponentType | Gallery |
MessageLocation
Renders location content for messages with location attachments.
| Type |
|---|
| ComponentType |
Reply
Renders a preview of the parent message for quoted replies.
| Type | Default |
|---|---|
| ComponentType | Reply |
StreamingMessageView
Renders AI-streamed text when isMessageAIGenerated(message) is true.
| Type |
|---|
| ComponentType |
- Best Practices
- Props
- additionalPressableProps
- enableMessageGroupingByUser
- backgroundColor
- goToMessage
- groupStyles
- isAttachmentEqual
- isMessageAIGenerated
- isMyMessage
- isMessageReceivedOrErrorType
- message
- messageContentOrder
- messageGroupedSingleOrBottom
- myMessageTheme
- noBorder
- isVeryLastMessage
- setMessageContentWidth
- onLongPress
- onPress
- onPressIn
- otherAttachments
- preventPress
- threadList
- hidePaddingTop
- hidePaddingHorizontal
- hidePaddingBottom
- UI Component Props