Info:
This is documentation for Stream Chat React Native SDK v8, which is no longer actively maintained. For up-to-date documentation, see the latest version (v9).

MessagesContext

Best Practices

  • Use this context for message-level UI concerns, not global channel state.
  • Prefer the provided handlers (handleEdit, handleDelete, etc.) to keep behavior consistent.
  • Avoid heavy logic in handlers that can trigger list-wide re-renders.
  • Use removeMessage/updateMessage only for local UI state, not server-side mutations.
  • Keep messageActions and supportedReactions stable (memoized) for performance.

Value

additionalPressableProps

Extra props passed to the underlying Pressable used in message components like MessageContent.

Type
object

channelId

ID of the current channel.

Type
string

deletedMessagesVisibilityType

Controls visibility of deleted messages in the channel.

  • always: Visible to both sender and receiver.
  • never: Visible to no one.
  • sender: Visible only to the sender.
  • receiver: Visible only to the receiver.
Type Default
enum('always', 'never', 'receiver', 'sender') 'both'

disableTypingIndicator

Disable the typing indicator in MessageList.

Type Default
boolean false

dismissKeyboardOnMessageTouch

Dismiss the keyboard when the user touches a message in the list.

Type Default
boolean false

enableMessageGroupingByUser

Note: Available in SDK version >= v3.9.0.

If false, consecutive messages from the same user won’t be grouped.

Type Default
boolean true

enableSwipeToReply

If true, users can swipe to reply to a message.

Type Default
Boolean true

forceAlignMessages

Forces all messages to align left or right. By default, received messages are left and sent messages are right.

Type Default
'left' | 'right' | false false

formatDate

Format function for dates in message status and deleted message components.

Type
function
Parameter Description
date date to format provided as a string, Date, or number (Unix Timestamp)

handleBan

Called when the Ban User action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleCopy

Called when the Copy Message action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleDelete

Called when the Delete Message action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleDeleteForMe

Called when the Delete Message for me action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleEdit

Called when the Edit Message action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleFlag

Called when the Flag Message action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleMute

Called when the Mute User action is triggered from the message actions list. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleQuotedReply

Called when the Reply action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleReaction

Called when a reaction is selected in the message menu (add or remove). It does not override default behavior. See customize message actions.

Type
Function
Parameter Description
message Message the action is called on.
reactionType String designating the type of reaction.

handleRetry

Called when the Retry action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

handleThreadReply

Called when the Thread Reply action is triggered. It does not override default behavior. See customize message actions.

Type
function
Parameter Description
message message the action is called on

initialScrollToFirstUnreadMessage

Load the channel starting at the first unread message.

Type Default
boolean false

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

legacyImageViewerSwipeBehaviour

markdownRules

Rules for simple-markdown.

Type
object

messageActions

An array of actions, or a function returning an array, shown in the message menu. See customize message actions.

Type Default
Array | Function messageActions
Parameter Description
actionInfo An object containing the original actions and relevant message data

messageContentOrder

Order for rendering message content.

Type Default
array ['quoted_reply', 'gallery', 'files', 'text', 'attachments']

myMessageTheme

Theme applied to the current user’s messages.

Type
object
Warning:

Memoize this object or pass a stable reference.

messageSwipeToReplyHitSlop

Defines the hitSlop area for the message swipe-to-reply gesture.

Type Default
Object{ top: number, left: number, bottom: number, right: number } {left: screenWidth, right: screenWidth}

messageTextNumberOfLines

Number of lines for message text in the Message Overlay.

Type Default
number 5

onLongPressMessage

Called when a user long-presses a message. The default opens the message menu.

Type
function
Parameter Description
payload { actionHandlers, message }

onPressInMessage

Called on touch start, before onPressMessage.

Type
function
Parameter Description
payload { actionHandlers, message }

onPressMessage

Called when a user presses a message.

Warning:

The default handler behaves differently for reactions and attachments. Handle those cases if you override it.

Type
function
Parameter Description
payload { additionalInfo, actionHandlers, message }

additionalInfo provides extra data for certain emitters (for example, user details for textMention).

For example:

<Channel
      onPressMessage={({ additionalInfo, defaultHandler, emitter }) => {

          if (emitter === 'textMention') {
            console.log(additionalInfo?.user);
            return;
          }

          if (emitter === 'card' || emitter === 'textLink') {
            console.log(additionalInfo?.url);
            return;
          }

          if (emitter === 'fileAttachment') {
            console.log(additionalInfo?.attachment);
            return;
          }

          defaultHandler?.();
      }}
    >
Note:

additionalInfo may change as we add more emitter use cases.

reactionListPosition

Position of the reaction list in the message component. Default is above the message content.

Type Default value
top | bottom 'top'

removeMessage

Remove a message from local state only (does not call channel.deleteMessage).

Type
(message) => void

Reply

Renders a preview of the parent message for quoted replies.

Type Default
ComponentType Reply

retrySendMessage

Retry sending a failed message.

Type
(message) => void

selectReaction

Full override of the message reaction handler. It must return a function that accepts reactionType (string). See customize message actions.

Type
function | null
Parameter Description
message message the action is called on

setEditingState

Set editing state for a message.

Type
(message) => void

setQuotedMessageState

Set quoted-reply state for a message.

Type
(message) => void

shouldShowUnreadUnderlay

Enable/disable the unread underlay background in the message list.

Type Default
boolean|undefined true

supportedReactions

List of reactions users can add to messages. See customizing reactions.

Type Default
Array reactionData

targetedMessage

ID of the highlighted message. Defaults to undefined and resets after the highlight timeout.

Type
string

updateMessage

Upsert a message in local state. Does not call channel.sendMessage (used for optimistic updates).

Type
(message) => void

openPollCreationDialog

Called when the poll creation button is clicked in the attachment picker. Use it to override the default modal UI.

If overridden, a payload is passed with sendMessage from MessageInputContext for use in CreatePoll.

Type
function
Parameter Description
payload { sendMessage }

hasCreatePoll

Controls whether the poll creation button is visible.

Type
boolean

Attachment

Renders attachments in MessageList.

Available props:

  • attachment {object}
Type Default
ComponentType Attachment

AttachmentActions

Renders additional attachment actions (for example, Giphy send/shuffle/cancel).

Type Default
ComponentType AttachmentActions

AudioAttachment

Renders the audio attachment.

Type Default
ComponentType AudioAttachment

Card

Renders custom attachment types. See Custom Attachment.

Type Default
ComponentType Card

CardCover

Renders the main body of Card attachments. See Custom Attachment.

Type
ComponentType

CardFooter

Renders the footer for Card attachments. See Custom Attachment.

Type
ComponentType

CardHeader

Renders the header for Card attachments. See Custom Attachment.

Type
ComponentType

DateHeader

Renders the sticky date header in MessageList.

Type Default
ComponentType DateHeader

FileAttachment

Renders file attachments in MessageList.

Type Default
ComponentType FileAttachment

FileAttachmentGroup

Renders a group of file attachments when a message has multiple files.

Type Default
ComponentType FileAttachmentGroup

FileAttachmentIcon

Renders the file icon for file attachments.

Type Default
ComponentType FileIcon

FlatList

FlatList component used by MessageList.

Type Default
ComponentType flat-list-mvcp

Renders image attachments in MessageList.

Type Default
ComponentType Gallery

Giphy

Renders Giphy attachments in MessageList.

Type Default
ComponentType Giphy

giphyVersion

Giphy image version to render. See the Image Object keys for options.

Type Default
string 'fixed_height'

InlineDateSeparator

Renders inline date separators between messages more than a day apart.

Type Default
ComponentType InlineDateSeparator

InlineUnreadIndicator

Renders an inline separator in MessageList to mark the last read message.

Type Default
ComponentType InlineUnreadIndicator

MessageActionList

Renders the message action list in the message menu.

Type Default
ComponentType MessageActionList | undefined

MessageActionListItem

Renders a message action item within the action list.

Type Default
ComponentType MessageActionListItem | undefined

MessageAvatar

Renders the sender avatar in MessageList. Only shown for other users’ messages.

Type Default
ComponentType MessageAvatar

MessageBounce

Renders the bounce action handler for bounced messages in MessageList.

Type Default
ComponentType MessageBounce

MessageContent

Renders message content (status, attachments, reactions, etc.) in MessageList.

Type Default
ComponentType MessageContent

MessageDeleted

Renders a deleted message.

Type Default
ComponentType MessageDeleted

MessageEditedTimestamp

Renders the “edited” label in MessageList. Only shown for other users’ messages.

Type Default
ComponentType MessageEditedTimestamp

MessageError

Customize the message error component.

Type Default
ComponentType MessageError

MessageFooter

Renders the message footer in MessageList.

Type Default
ComponentType MessageFooter

MessageHeader

Renders the header for a message in MessageList.

Type
ComponentType

MessageMenu

Customize the message menu used for actions and reactions.

Type Default
ComponentType MessageMenu | undefined

MessageReplies

Shows thread reply count and avatars of users who replied.

Type Default
ComponentType MessageReplies

MessageRepliesAvatars

Renders avatars of users who replied in the thread.

Type Default
ComponentType MessageRepliesAvatars

MessageSimple

Renders a message in MessageList.

See Customizing Message UI.

Type Default
ComponentType MessageSimple

MessageStatus

Renders message status (time and read receipts).

Type Default
ComponentType MessageStatus

MessageSwipeContent

Renders content when the user swipes a message.

Type Default
ComponentType MessageSwipeContent | undefined

MessageSystem

Renders system messages that inform users about channel changes. System messages are part of history and have type: "system".

System messages appear when:

Type Default
ComponentType MessageSystem

MessageText

Renders message text. By default, the SDK uses Simple Markdown. If you override this, you must handle markdown rendering yourself.

Type Default
ComponentType renderText

MessageReactionPicker

Reaction selector shown in the message menu on long-press.

Type Default
ComponentType MessageReactionPicker | undefined

MessageUserReactionsAvatar

Renders an avatar in message user reactions within the message menu.

Type Default
ComponentType MessageUserReactionsAvatar | undefined

MessageUserReactionsItem

Customize an individual user reaction item in MessageMenu’s MessageUserReactions (avatar, reaction type, user name, etc.).

Type Default
ComponentType MessageUserReactionsItem | undefined

MessageUserReactions

Renders the reactions list in the message menu.

Type Default
ComponentType MessageUserReactions | undefined

MessageUserReactionsAvatar

Renders an avatar in message user reactions within the message menu.

Type Default
ComponentType MessageUserReactionsAvatar | undefined

MessageUserReactionsItem

Customize an individual user reaction item in MessageMenu’s MessageUserReactions (avatar, reaction type, user name, etc.).

Type Default
ComponentType MessageUserReactionsItem | undefined

MessageUserReactions

Renders the reactions list in the message menu.

Type Default
ComponentType MessageUserReactions | undefined

ReactionListBottom

Renders the reactions list below the message bubble.

Type Default
ComponentType ReactionListBottom

ReactionListTop

Renders the reactions list above the message bubble.

Type Default
ComponentType ReactionListTop

ScrollToBottomButton

Renders a button that scrolls the message list to the bottom.

Type Default
ComponentType ScrollToBottomButton

TypingIndicator

Renders the typing indicator in MessageList.

Type Default
ComponentType TypingIndicator

TypingIndicatorContainer

Renders the container for the typing indicator in MessageList.

Type Default
ComponentType TypingIndicatorContainer

UrlPreview

Renders URL previews in MessageList.

Type Default
ComponentType Card

VideoThumbnail

Renders video thumbnails for video attachments in MessageList.

Type Default
ComponentType VideoThumbnail

PollContent

A Component prop used to render the content of the Poll component in MessageList.

The component has full access to the entire Poll reactive state through the usePollState hook.

Type Default
ComponentType PollContent

Props

PollHeader

A Component prop used to render the header of the PollContent component.

Type Default
ComponentType PollHeader
PollButtons

A Component prop used to render the buttons of the PollContent component.

Type Default
ComponentType PollButtons
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Chat React Native v8: <Your Question>