AttachmentPickerContext
AttachmentPickerContext
is provided by OverlayProvider
component. If you are not familiar with React Context API, please read about it on React docs.
#
Basic UsageAttachmentPickerContext
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();
#
Valueforwarded from OverlayProvider props attachmentPickerBottomSheetHeight#
Height of the image picker bottom sheet when closed.
Type | Default |
---|---|
number | 308 |
forwarded from OverlayProvider props attachmentSelectionBarHeight#
Height of the attachment selection bar displayed above the image picker.
Type | Default |
---|---|
number | 52 |
bottomInset
#
bottomInset
determine the height of the AttachmentPicker
and the underlying shift to the MessageList
when it is opened.
Type | Default |
---|---|
number | bottomInset |
forwarded from OverlayProvider props CameraSelectorIcon#
Camera selector component displayed in the attachment selector bar.
Type | Default |
---|---|
component | CameraSelectorIcon |
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.
Type | Default |
---|---|
component | FileSelectorIcon |
forwarded from OverlayProvider props ImageSelectorIcon#
Image selector component displayed in the attachment selector bar.
Type | Default |
---|---|
component | ImageSelectorIcon |
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 |
#
setBottomInsetSetter function for bottomInset
Type |
---|
(bottomInset: number) => void |
#
setSelectedFilesSetter function for selectedFiles
Type |
---|
(selectedFiles) => void |
#
setSelectedImagesSetter function for selectedImages
Type |
---|
(selectedImages) => void |
#
setSelectedPickerSetter function for selectedPicker
Type | |
---|---|
`(picker: 'images' | undefined) => void` |
#
setTopInsetSetter function for topInset
Type |
---|
(topInset: number) => void |
topInset
#
topInset
is used to determine how high the scroll-able bottom-sheet can go when opened.
Type | Default |
---|---|
number | topInset |