MessageContent
Component to render content of a message within the MessageList
. Message avatar and reactions are not part of MessageContent
.
This is the default component provided to the prop MessageContent
on the Channel
component.
Props
additionalPressableProps
Additional props provided to the underlying Pressable used by components within a message such as MessageContent
.
Type |
---|
object |
alignment
Sets if the message should be aligned to right or left side of list.
Type | Default |
---|---|
enum(‘right’, ‘left’) | ‘right’ |
backgroundColor
Background color for the message content.
Type |
---|
string | undefined |
disabled
True if channel is frozen and disableIfFrozenChannel is true.
Type |
---|
Boolean |
goToMessage
A function that scrolls to a specific message in the chat. This function is useful when you want to scroll to a specific message in the chat.
Type | Default |
---|---|
(messageId: string) => void | undefined | undefined |
groupStyles
Position of message in the group. A message group is a group of consecutive messages from the same user. groupStyles
can be used to style the message as per their position in message group.
For example, user avatar (to which message belongs to) is only showed for last (bottom) message in group.
Type |
---|
array of enum(‘top’, ‘bottom’, ‘middle’, ‘single’) |
isAttachmentEqual
Function which returns true if passing nextAttachment
to render would return the same result as passing prevAttachment
to render, otherwise return false.
Type |
---|
function |
Parameter | Description |
---|---|
prevAttachment | previous message attachment to be compared |
nextAttachment | next message attachment to be compared |
isEditedMessageOpen
Boolean to check the message edited label is expanded or not.
Type | Default |
---|---|
Boolean | false |
isMyMessage
True if the message is sent by current user (connected to chat).
Type |
---|
boolean |
message
Message object.
Type |
---|
Message type |
messageContentOrder
Order of message content.
for example ['quoted_reply', 'attachments', 'file', 'gallery', 'text']
Type |
---|
array |
MyMessageTheme
Theme applied to messages of the current user.
Type |
---|
object |
Please make sure to memoize or pass static reference for this object.
noBorder
If true
, the message content will not have a border.
Type | Default |
---|---|
Boolean | undefined | false |
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 the attachments on the message except for types file
and image
.
Type |
---|
Array |
preventPress
threadList
True if current message is part of a message thread.
Type |
---|
Boolean |
UI Component Props
Attachment
Component for rendering attachments in MessageList.
Available props:
attachment
{object}
Type | Default |
---|---|
ComponentType | Attachment |
FileAttachmentGroup
Component to render group of file
type attachments, when there are multiple file
type attachments in message.
Type | Default |
---|---|
ComponentType | FileAttachmentGroup |
Gallery
Component to render ‘image’ type attachments in the MessageList
.
Type | Default |
---|---|
ComponentType | Gallery |
MessageError
Component to customize the message error component.
Type | Default |
---|---|
ComponentType | MessageError |
Reply
Component to render preview of parent of message for quoted reply.
Type | Default |
---|---|
ComponentType | Reply |