Skip to main content
Version: v4

AttachmentPickerContext

AttachmentPickerContext is provided by OverlayProvider component. If you are not familiar with React Context API, please read about it on React docs.

Basic Usage#

AttachmentPickerContext can be consumed by any of the child component of OverlayProvider component as following:

import { useContext } from 'react';
import { AttachmentPickerContext } from 'stream-chat-react-native';

const { openPicker, closePicker } = useContext(AttachmentPickerContext);

Alternatively, you can also use useAttachmentPickerContext hook provided by library to consume AttachmentPickerContext.

import { useAttachmentPickerContext } from 'stream-chat-react-native';

const { openPicker, closePicker } = useAttachmentPickerContext();

Value#

forwarded from OverlayProvider props
attachmentPickerBottomSheetHeight#

Height of the image picker bottom sheet when closed.

TypeDefault
number308

forwarded from OverlayProvider props
attachmentSelectionBarHeight#

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

TypeDefault
number52

bottomInset#

bottomInset determine the height of the AttachmentPicker and the underlying shift to the MessageList when it is opened.

TypeDefault
numberbottomInset

forwarded from OverlayProvider props
CameraSelectorIcon#

Camera selector component displayed in the attachment selector bar.

TypeDefault
componentCameraSelectorIcon

closePicker#

Function to close the attachment picker bottom sheet.

Type
function

forwarded from OverlayProvider props
FileSelectorIcon#

File selector component displayed in the attachment selector bar.

TypeDefault
componentFileSelectorIcon

forwarded from OverlayProvider props
ImageSelectorIcon#

Image selector component displayed in the attachment selector bar.

TypeDefault
componentImageSelectorIcon

openPicker#

Function to open the attachment picker bottom sheet.

Type
function

selectedFiles#

List of currently selected files in attachment picker.

Array<{
duration: number | null;
name: string;
size: string;
type: string;
uri: string;
}>;

selectedImages#

List of currently selected images in attachment picker.

Array<{
height: number;
source: 'camera' | 'picker';
uri: string;
width: number;
id?: string;
}>;
Type
array

selectedPicker#

Value is images (string), when image attachment picker is open. Value will be undefined if file picker is active or file picker is open.

Type
'images' | undefined

setBottomInset#

Setter function for bottomInset

Type
(bottomInset: number) => void

setSelectedFiles#

Setter function for selectedFiles

Type
(selectedFiles) => void

setSelectedImages#

Setter function for selectedImages

Type
(selectedImages) => void

setSelectedPicker#

Setter function for selectedPicker

Type
`(picker: 'images'undefined) => void`

setTopInset#

Setter function for topInset

Type
(topInset: number) => void

topInset#

topInset is used to determine how high the scrollable bottom-sheet can go when opened.

TypeDefault
numbertopInset

Did you find this page helpful?