MessageContent

Renders message content inside MessageList. This is the default component for the MessageContent prop.

For lightweight decoration around the main content body, use MessageContentTopView, MessageContentBottomView, MessageContentLeadingView, and MessageContentTrailingView instead of replacing MessageContent entirely.

Best Practices

  • Keep content rendering lightweight to avoid list performance issues.
  • Prefer the MessageContent*View slot overrides for lightweight decoration around the body instead of replacing MessageContent.
  • Use useMessageContext() inside prop-less content slot overrides when you need message state such as alignment, message, or isMyMessage.
  • Respect messageContentOrder so attachments, polls, and text appear consistently.
  • Keep press handlers fast and side-effect free.
  • Keep padding overrides predictable across message types.

Props

Prop Description Type
additionalPressableProps Extra props passed to the underlying Pressable used in message components like MessageContent. object
enableMessageGroupingByUser Whether message grouping by user is enabled. boolean
backgroundColor Message content background color. ColorValue
goToMessage Scrolls to a specific message in the chat. Defaults to undefined. (messageId: string) => void | 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). array of enum('top', 'bottom', 'middle', 'single')
isMessageAIGenerated Whether a message should be treated as AI-generated. function
isMyMessage True if the message was sent by the current user. boolean
hasInteractiveAccessibilityContent Whether the message renders interactive children (poll options, attachment cells, quoted-reply navigator, shared location) so the row drops its single accessibility focus stop. boolean
isSingleFile Whether the message has a single file attachment. boolean
message Message object. Message type
messageContentOrder Order of message content. Example: ['quoted_reply', 'attachments', 'file', 'gallery', 'text']. array
messageGroupedSingleOrBottom Whether the message group style is single or bottom. boolean
myMessageTheme Theme applied to the current user's messages. Memoize this object or pass a stable reference. object
noBorder If true, the message content has no border. Defaults to false. boolean | undefined
isVeryLastMessage Whether the message is the very last item in the list. boolean
onLongPress Default long press handler for message UI. function
onPress Default press handler for message UI. function
onPressIn Default pressIn handler for message UI. function
otherAttachments All attachments except file and image. array
preventPress Disable press interactions for this message content. boolean
threadList True if the current message is part of a thread. boolean
hidePaddingTop Hide top padding in content container. boolean
hidePaddingHorizontal Hide horizontal padding in content container. boolean
hidePaddingBottom Hide bottom padding in content container. boolean

Slot Overrides

MessageContentTopView, MessageContentBottomView, MessageContentLeadingView, and MessageContentTrailingView are optional prop-less slots rendered around the main message content body.

If a slot is not provided, nothing is rendered for that position. MessageContent only creates the horizontal wrapper for Leading and Trailing when at least one of those overrides is provided, so the default render tree stays unchanged otherwise.

If your custom slot needs message state such as alignment, message, or isMyMessage, read it with useMessageContext() inside the component.

Example

import { Channel, useMessageContext } from "stream-chat-react-native";
import { Text, View } from "react-native";

const CustomContentTopView = () => {
  const { isMyMessage } = useMessageContext();

  return isMyMessage ? null : <Text>Incoming</Text>;
};

const CustomContentBottomView = () => {
  const { message } = useMessageContext();

  return message.pinned ? <Text>Pinned</Text> : null;
};

const CustomContentLeadingView = () => {
  const { alignment } = useMessageContext();

  return <View style={{ width: alignment === "left" ? 8 : 0 }} />;
};

const CustomContentTrailingView = () => {
  const { alignment } = useMessageContext();

  return <View style={{ width: alignment === "right" ? 8 : 0 }} />;
};

<Channel
  MessageContentTopView={CustomContentTopView}
  MessageContentBottomView={CustomContentBottomView}
  MessageContentLeadingView={CustomContentLeadingView}
  MessageContentTrailingView={CustomContentTrailingView}
/>;

UI Component Props

Prop Description Type
MessageContentTopView Renders an optional prop-less component above the main message content body. Defaults to undefined. ComponentType | undefined
MessageContentBottomView Renders an optional prop-less component below the main message content body. Defaults to undefined. ComponentType | undefined
MessageContentLeadingView Renders an optional prop-less component to the left of the main message content body. If neither MessageContentLeadingView nor MessageContentTrailingView is provided, MessageContent does not create the horizontal wrapper around the body. Defaults to undefined. ComponentType | undefined
MessageContentTrailingView Renders an optional prop-less component to the right of the main message content body. If neither MessageContentLeadingView nor MessageContentTrailingView is provided, MessageContent does not create the horizontal wrapper around the body. Defaults to undefined. ComponentType | undefined
Attachment Renders attachments in MessageList. Available props: attachment (object). Defaults to Attachment. ComponentType
FileAttachmentGroup Renders a group of file attachments when a message has multiple files. Defaults to FileAttachmentGroup. ComponentType
Gallery Renders image attachments in MessageList. Defaults to Gallery. ComponentType
MessageLocation Renders location content for messages with location attachments. ComponentType
Reply Renders a preview of the parent message for quoted replies. Defaults to Reply. ComponentType
StreamingMessageView Renders AI-streamed text when isMessageAIGenerated(message) is true. ComponentType
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 v9: <Your Question>