This is beta documentation for Stream Chat React Native SDK v9. For the latest stable version, see the latest version (v8) .

ImageGalleryContext

ImageGalleryContext is provided by OverlayProvider. If you are not familiar with the React Context API, see the React docs.

Best Practices

  • Use useImageGalleryContext only within OverlayProvider.
  • Use the imageGalleryStateStore to manage gallery state (messages, selected message, etc.).
  • Pass only messages with image attachments to keep the gallery focused.
  • Avoid heavy preprocessing before updating the state store.

Basic Usage

Consume ImageGalleryContext in any child of OverlayProvider:

import { useContext } from "react";
import { ImageGalleryContext } from "stream-chat-react-native";

const { imageGalleryStateStore } = useContext(ImageGalleryContext);

Alternatively, use the useImageGalleryContext hook.

import { useImageGalleryContext } from "stream-chat-react-native";

const { imageGalleryStateStore } = useImageGalleryContext();

Value

autoPlayVideo

Enable or disable autoplay for videos in the image gallery.

Type
boolean

giphyVersion

The Giphy image rendition to render. See the Image Object keys for possible values.

TypeDefault
string'fixed_height'

ImageGalleryFooter

Custom component to render as the image gallery footer. Receives ImageGalleryFooterProps.

Type
React.ComponentType<ImageGalleryFooterProps>

ImageGalleryGrid

Custom component to render the image gallery grid. Receives ImageGalleryGridProps.

Type
React.ComponentType<ImageGalleryGridProps>

ImageGalleryHeader

Custom component to render as the image gallery header. Receives ImageGalleryHeaderProps.

Type
React.ComponentType<ImageGalleryHeaderProps>

ImageGalleryVideoControls

Custom component to render the video controls within the image gallery. Receives ImageGalleryVideoControlProps.

Type
React.ComponentType<ImageGalleryVideoControlProps>

imageGalleryStateStore

State store instance that manages gallery state such as selected message, messages with images, and navigation. Use this store to programmatically control the image gallery.

Type
ImageGalleryStateStore

numberOfImageGalleryGridColumns

Number of columns to render within the image gallery grid.

TypeDefault
number3