Gallery

Renders image attachments inside MessageList.

Best Practices

  • Keep gallery layouts compact to avoid oversized rows.
  • Use setOverlay and gallery context helpers instead of custom image viewers.
  • Handle mixed image/video attachments gracefully.
  • Respect preventPress when you need to disable full-screen viewing.
  • Avoid heavy image processing in render; rely on caching or native components.

Basic Usage

Replace the default UI via WithComponents.

import { WithComponents, Gallery } from "stream-chat-react-native";

<WithComponents overrides={{ Gallery: () => <Gallery preventPress /> }}>
  <Channel channel={channel}>
    <MessageList />
    <MessageComposer />
  </Channel>
</WithComponents>;

Props

PropDescriptionType
additionalPressablePropsExtra props passed to the underlying Pressable used in message components like MessageContent.object
alignmentSets whether the message aligns left or right in the list. Defaults to 'right'.enum('right', 'left')
channelIdID of the channel the message belongs to. Used to resolve image CDN hosts and the gallery viewer.string | undefined
imagesArray of image attachments on the message.array
imageGalleryStateStoreState store backing the full-screen image gallery viewer.object
messageMessage object the attachments belong to.Message type
messageContentOrderOrder of message content. Example: ['quoted_reply', 'attachments', 'file', 'gallery', 'text'].array
messageHasOnlyOneMediaTrue when the message contains exactly one media attachment. Used for sizing. Defaults to false.boolean
myMessageThemeTheme applied to the current user's messages. Memoize this object or pass a stable reference.object
onLongPressDefault long press handler for message UI.function
onPressDefault press handler for message UI.function
onPressInDefault pressIn handler for message UI.function
preventPressIf true, disables onPress. Defaults to false.boolean
setOverlaySetter for overlay. You can use this setter to show the overlay.(overlay) => void
videosArray of video attachments.array

UI Component Props

PropDescriptionType
AttachmentUploadIndicatorRenders pending upload progress over local image and video thumbnails. Defaults to AttachmentUploadIndicator.ComponentType
MediaUploadProgressOverlayRenders the full-cover upload overlay used by AttachmentUploadIndicator in overlay mode. Defaults to MediaUploadProgressOverlay.ComponentType
VideoThumbnailRenders video thumbnails for video attachments in MessageList. Defaults to VideoThumbnail.ComponentType