UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

72 lines (68 loc) 2.02 kB
import { useMemo } from 'react'; import type { InputMessageInputContextValue } from '../../../contexts/messageInputContext/MessageInputContext'; export const useCreateInputMessageInputContext = ({ additionalTextInputProps, allowSendBeforeAttachmentsUpload, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, channelId, compressImageQuality, createPollOptionGap, doFileUploadRequest, editMessage, focusInputOnPickerClose, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, messageInputFloating, messageInputHeightStore, openPollCreationDialog, sendMessage, setInputRef, showPollCreationDialog, }: InputMessageInputContextValue & { /** * To ensure we allow re-render, when channel is changed */ channelId?: string; }) => { const inputMessageInputContext: InputMessageInputContextValue = useMemo( () => ({ additionalTextInputProps, allowSendBeforeAttachmentsUpload, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, compressImageQuality, createPollOptionGap, doFileUploadRequest, editMessage, focusInputOnPickerClose, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, messageInputFloating, messageInputHeightStore, openPollCreationDialog, sendMessage, setInputRef, showPollCreationDialog, }), // eslint-disable-next-line react-hooks/exhaustive-deps [compressImageQuality, channelId, showPollCreationDialog, allowSendBeforeAttachmentsUpload], ); return inputMessageInputContext; };