diff --git a/package/src/contexts/messageInputContext/MessageInputContext.tsx b/package/src/contexts/messageInputContext/MessageInputContext.tsx index b243c1fca..77576e072 100644 --- a/package/src/contexts/messageInputContext/MessageInputContext.tsx +++ b/package/src/contexts/messageInputContext/MessageInputContext.tsx @@ -538,7 +538,8 @@ export const MessageInputProvider = < setSelectedImages, setSelectedPicker, } = useAttachmentPickerContext(); - const { appSettings, client, enableOfflineSupport } = useChatContext(); + const { appSettings, client, enableOfflineSupport, isOnline } = + useChatContext(); const { removeMessage } = useMessagesContext(); const getFileUploadConfig = () => { @@ -652,7 +653,7 @@ export const MessageInputProvider = < } setText(newText); - if (newText && channel && channelCapabities.sendTypingEvents) { + if (newText && channel && channelCapabities.sendTypingEvents && isOnline) { logChatPromiseExecution(channel.keystroke(thread?.id), 'start typing event'); } diff --git a/package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx b/package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx index afaf47ade..8a125d408 100644 --- a/package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx +++ b/package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx @@ -61,7 +61,7 @@ describe("MessageInputContext's pickFile", () => { maxNumberOfFiles: 2, }; - it.each([[3, 2]])( + it.each([[3, 1]])( 'run pickFile when numberOfUploads is %d and alert is triggered %d number of times', async (numberOfUploads, numberOfTimesCalled) => { const { rerender, result } = renderHook(() => useMessageInputContext(), { @@ -87,6 +87,7 @@ describe("MessageInputContext's pickFile", () => { }); expect(Alert.alert).toHaveBeenCalledTimes(numberOfTimesCalled); + expect(Alert.alert).toHaveBeenCalledWith('Maximum number of files reached'); }, ); diff --git a/package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts b/package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts index 8cbcac187..0d7e3e0d2 100644 --- a/package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +++ b/package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts @@ -258,6 +258,7 @@ export const useCreateMessageInputContext = < text, threadId, showPollCreationDialog, + onChange, ], );