Skip to main content
Version: v5

OverlayProvider

The OverlayProvider is the top-level Stream Chat for React Native component and wraps all other components provided by the SDK. The OverlayProvider allows users to interact with messages on long press above the underlying views, use the full screen image viewer, and use the AttachmentPicker alongside the keyboard.

General Usage

The OverlayProvider should wrap all other Stream Chat for React Native components and in most cases the majority of your application.

Note: For detailed implementation instructions of the OverlayProvider with navigation please refer to the Navigation guide.

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>
);

Context Providers

OverlayProvider contains providers for the AttachmentPickerContextImageGalleryContextMessageOverlayContextOverlayContextThemeContext, and TranslationContext. These can be accessed using the corresponding hooks.

ContextHook
AttachmentPickerContextuseAttachmentPickerContext
ImageGalleryContextuseImageGalleryContext
MessageOverlayContextuseMessageOverlayContext
OverlayContextuseOverlayContext
ThemeContextuseTheme
TranslationContextuseTranslationContext

Props

attachmentPickerBottomSheetHandleHeight

Height of the image picker bottom sheet handle.

TypeDefault
Number20

attachmentPickerBottomSheetHeight

Height of the image picker bottom sheet when closed.

TypeDefault
Number308

attachmentPickerErrorButtonText

Text for the button within AttachmentPickerError that opens the apps OS level settings.

TypeDefault
String"Allow access to your Gallery"

attachmentPickerErrorText

Error text for AttachmentPickerError.

TypeDefault
String"Please enable access to your photos and videos so you can share them."

attachmentSelectionBarHeight

Height of the attachment selection bar displayed above the image picker.

TypeDefault
Number52

bottomInset

Height of items located below the MessageInput when present. This inset determines the underlying shift to the MessageList when it is opened.

success

This can also be set via the setBottomInset function provided by the useAttachmentPickerContext hook.

TypeDefault
Number0

autoPlayVideo

Enables or disables auto play of videos in the overlay.

TypeDefault
Booleanfalse

giphyVersion

The Giphy version to render when viewing a Giphy in the Image Gallery. Check the keys of the Image Object for possible values.

TypeDefault
String'fixed_height'

i18nInstance

Instance of Streami18n class used for internationalization. Please read more in the translation's docs for details on creation and customization.

Type
Streami18n

imageGalleryCustomComponents

ImageGallery component is used to render the image viewer. This component handler all the gestures for zooming and swiping on images within gallery.

Its not possible to replace this component, given the complexity of it. But you can use imageGalleryCustomComponents prop on OverlayProvider to replace sub-parts of image gallery.

The following object for providing custom components. Each key in the object is spread as props onto its respective component. Each component has a number of sub-components it can receive in this manner.

Type
Object

imageGalleryGridHandleHeight

Height of the image gallery grid bottom sheet handle.

TypeDefault
Number40

imageGalleryGridSnapPoints

The SnapPoints for the image gallery grid bottom sheet.

TypeDefault
Array[0, (screenHeight * 9) / 10]

messageTextNumberOfLines

Number of lines for the message text in the Message Overlay.

TypeDefault
Number5

numberOfAttachmentImagesToLoadPerCall

Number of images to load per call to CameraRoll.getPhotos.

TypeDefault
Number60

numberOfAttachmentPickerImageColumns

Number of columns to render within the image picker.

TypeDefault
Number3

numberOfImageGalleryGridColumns

Number of columns to render within the image gallery grid.

TypeDefault
Number3

topInset

Distance from the top of the screen the attachment picker should open to when expanded. This is often set to the header height.

success

This can also be set via the setTopInset function provided by the useAttachmentPickerContext hook.

TypeDefault
Number0

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

UI Component Props

AttachmentPickerBottomSheetHandle

Bottom sheet handle component for image picker.

TypeDefault
ComponentTypeundefined | AttachmentPickerBottomSheetHandle

AttachmentPickerError

Error component displayed when the app doesn't have permissions to access photos on the device.

TypeDefault
ComponentTypeundefined | AttachmentPickerError

AttachmentPickerErrorImage

Image component within AttachmentPickerError.

TypeDefault
ComponentTypeundefined | AttachmentPickerErrorImage

CameraSelectorIcon

Camera selector component displayed in the attachment selector bar.

TypeDefault
ComponentTypeundefined | CameraSelectorIcon

FileSelectorIcon

File selector component displayed in the attachment selector bar.

TypeDefault
ComponentTypeundefined | FileSelectorIcon

ImageOverlaySelectedComponent

Indicator component used to designate an image as selected in the image picker.

TypeDefault
ComponentTypeundefined | ImageOverlaySelectedComponent

ImageSelectorIcon

Image selector component displayed in the attachment selector bar.

TypeDefault
ComponentTypeundefined | ImageSelectorIcon

MessageActionList

Component for rendering a message action list within the message overlay.

TypeDefault
ComponentTypeundefined | MessageActionList

MessageActionListItem

Component for rendering message action list items within a message action list.

TypeDefault
ComponentTypeundefined | MessageActionListItem

OverlayReactionList

Reaction selector component displayed within the message overlay when user long presses a message.

TypeDefault
ComponentTypeundefined | OverlayReactionList

OverlayReactions

List of reactions component within the message overlay.

TypeDefault
ComponentTypeundefined | OverlayReactions

OverlayReactionsAvatar

Component for rendering an avatar in the message reaction overlay.

TypeDefault
ComponentTypeundefined | OverlayReactionsAvatar

Did you find this page helpful?