import { StreamChat } from "stream-chat";
import { ChannelList, Chat, OverlayProvider } from "stream-chat-react-native";
const client = StreamChat.getInstance("api_key");
export const App = () => (
<OverlayProvider>
<Chat client={client}>
<ChannelList />
</Chat>
</OverlayProvider>
);OverlayProvider
OverlayProvider is the top-level Stream Chat React Native component. It wraps all other SDK components and enables long-press message actions and the full-screen image viewer.
Best Practices
- Wrap your entire app (or top navigation tree) to avoid context mismatches.
- Keep
OverlayProviderstable; avoid re-mounting it on screen changes. - Use the provided hooks instead of prop drilling for overlay contexts.
- Customize image gallery subcomponents via dedicated component props (
ImageGalleryHeader,ImageGalleryFooter,ImageGalleryGrid,ImageGalleryVideoControls) rather than replacing the full image viewer. - Pass theming via
value.styleto keep UI consistent across screens.
General Usage
Wrap all Stream Chat components with OverlayProvider (usually the whole app).
Note: For navigation details, see the Navigation guide.
Context Providers
OverlayProvider provides ImageGalleryContext, OverlayContext, ThemeContext, and TranslationContext. Use the corresponding hooks to access them.
| Context | Hook |
|---|---|
ImageGalleryContext | useImageGalleryContext |
OverlayContext | useOverlayContext |
ThemeContext | useTheme |
TranslationContext | useTranslationContext |
Props
autoPlayVideo
Enable or disable autoplay for overlay videos.
| Type | Default |
|---|---|
| Boolean | false |
giphyVersion
Giphy image rendition to use in the Image Gallery. See the Image Object keys for options.
| Type | Default |
|---|---|
| String | 'fixed_height' |
i18nInstance
Streami18n instance used for internationalization. See the translations docs for setup and customization.
| Type |
|---|
Streami18n |
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> |
MessageOverlayBackground
Custom backdrop component rendered behind overlay content in MessageOverlayHostLayer.
| Type |
|---|
React.ComponentType |
numberOfImageGalleryGridColumns
Number of columns to render within the image gallery grid.
| Type | Default |
|---|---|
| Number | 3 |
value
Partially overrides the value provided to the OverlayContext. This prop can be used to set the theme via the style key.
const theme = {
messageSimple: {
file: {
container: {
backgroundColor: "red",
},
},
},
};
<OverlayProvider value={{ style: theme }}>...</OverlayProvider>;| Type |
|---|
| Object |