import { useMemo } from 'react'; import type { ThreadContextValue } from '../../threadContext/ThreadContext'; import type { MessageInputContextValue } from '../MessageInputContext'; export const useCreateMessageInputContext = ({ additionalTextInputProps, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, closeAttachmentPicker, closePollCreationDialog, compressImageQuality, createPollOptionGap, editMessage, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, inputBoxRef, messageInputFloating, messageInputHeightStore, openAttachmentPicker, openPollCreationDialog, pickAndUploadImageFromNativePicker, pickFile, sendMessage, setInputBoxRef, setInputRef, showPollCreationDialog, takeAndUploadImage, uploadNewFile, audioRecorderManager, startVoiceRecording, deleteVoiceRecording, uploadVoiceRecording, stopVoiceRecording, thread, }: MessageInputContextValue & Pick) => { const threadId = thread?.id; const messageInputContext: MessageInputContextValue = useMemo( () => ({ additionalTextInputProps, asyncMessagesLockDistance, asyncMessagesMinimumPressDuration, asyncMessagesSlideToCancelDistance, audioRecordingSendOnComplete, attachmentPickerBottomSheetHeight, attachmentSelectionBarHeight, audioRecordingEnabled, closeAttachmentPicker, closePollCreationDialog, compressImageQuality, createPollOptionGap, editMessage, handleAttachButtonPress, hasCameraPicker, hasCommands, hasFilePicker, hasImagePicker, inputBoxRef, messageInputFloating, messageInputHeightStore, openAttachmentPicker, openPollCreationDialog, pickAndUploadImageFromNativePicker, pickFile, sendMessage, setInputBoxRef, setInputRef, showPollCreationDialog, takeAndUploadImage, uploadNewFile, audioRecorderManager, startVoiceRecording, deleteVoiceRecording, uploadVoiceRecording, stopVoiceRecording, }), // eslint-disable-next-line react-hooks/exhaustive-deps [threadId, showPollCreationDialog], ); return messageInputContext; };