import { useContext } from "react";
import { AttachmentPickerContext } from "stream-chat-react-native";
const { openPicker, closePicker } = useContext(AttachmentPickerContext);AttachmentPickerContext
AttachmentPickerContext is provided by Channel 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 Channel wrapper component as following:
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
bottomSheetRef
Reference to the bottom sheet component used for the attachment picker.
bottomInset
Height of items located below the MessageInput when present. This inset determines the underlying shift to the MessageList when it is opened.
This can also be set via the setBottomInset function provided by the useAttachmentPickerContext hook.
| Type | Default |
|---|---|
| Number | 0 |
setBottomInset
Setter function for bottomInset
| Type |
|---|
(bottomInset: number) => void |
closePicker
Function to close the attachment picker bottom sheet.
| Type |
|---|
Function(() => void) |
openPicker
Function to open the attachment picker bottom sheet.
| Type |
|---|
Function(() => void) |
selectedPicker
Value is images (string), when image attachment picker is open else undefined.
| Type |
|---|
| ’images’ | undefined |
setSelectedPicker
Setter function for selectedPicker
| Type |
|---|
(picker: 'images' | undefined) => void |
topInset
Distance from the top of the screen the attachment picker should open to when expanded. This is often set to the header height.
This can also be set via the setTopInset function provided by the useAttachmentPickerContext hook.
| Type | Default |
|---|---|
| Number | 0 |
setTopInset
Setter 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 |