UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

42 lines (41 loc) 1.37 kB
import { useMemo } from 'react'; export const useCreateMessageInputContext = (value) => { const { additionalTextareaProps, asyncMessagesMultiSendEnabled, audioRecordingEnabled, clearEditingState, cooldownInterval, cooldownRemaining, emojiSearchIndex, focus, handleSubmit, hideSendButton, isThreadInput, maxRows, minRows, onPaste, parent, recordingController, setCooldownRemaining, shouldSubmit, textareaRef, } = value; const parentId = parent?.id; const messageInputContext = useMemo(() => ({ additionalTextareaProps, asyncMessagesMultiSendEnabled, audioRecordingEnabled, clearEditingState, cooldownInterval, cooldownRemaining, emojiSearchIndex, focus, handleSubmit, hideSendButton, isThreadInput, maxRows, minRows, onPaste, parent, recordingController, setCooldownRemaining, shouldSubmit, textareaRef, }), // eslint-disable-next-line react-hooks/exhaustive-deps [ asyncMessagesMultiSendEnabled, audioRecordingEnabled, cooldownInterval, cooldownRemaining, emojiSearchIndex, handleSubmit, hideSendButton, isThreadInput, minRows, parentId, recordingController, ]); return messageInputContext; };