stream-chat-react-native-core 5.34.1-beta.5 → 5.35.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +5 -4
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Card.js +2 -1
- package/lib/commonjs/components/Attachment/Card.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +2 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +3 -2
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/Giphy.js +2 -3
- package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +2 -1
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +14 -9
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerError.js +2 -2
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerError.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +1 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +6 -13
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -57
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +2 -3
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +2 -1
- package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +5 -2
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +4 -3
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +3 -3
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +2 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +5 -5
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +2 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +8 -7
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/MessageInput/AttachButton.js +67 -9
- package/lib/commonjs/components/MessageInput/AttachButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/CommandsButton.js +3 -2
- package/lib/commonjs/components/MessageInput/CommandsButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +1 -11
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +2 -5
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +27 -22
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +5 -6
- package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
- package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +2 -1
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/commonjs/components/MessageList/MessageList.js +2 -1
- package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +19 -18
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +267 -181
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +3 -2
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +1 -0
- package/lib/commonjs/i18n/es.json +1 -0
- package/lib/commonjs/i18n/fr.json +1 -0
- package/lib/commonjs/i18n/he.json +1 -0
- package/lib/commonjs/i18n/hi.json +1 -0
- package/lib/commonjs/i18n/it.json +1 -0
- package/lib/commonjs/i18n/ja.json +1 -0
- package/lib/commonjs/i18n/ko.json +1 -0
- package/lib/commonjs/i18n/nl.json +1 -0
- package/lib/commonjs/i18n/pt-br.json +1 -0
- package/lib/commonjs/i18n/ru.json +1 -0
- package/lib/commonjs/i18n/tr.json +1 -0
- package/lib/commonjs/icons/Attach.js +29 -6
- package/lib/commonjs/icons/Attach.js.map +1 -1
- package/lib/commonjs/icons/GiphyLightning.js +31 -0
- package/lib/commonjs/icons/GiphyLightning.js.map +1 -0
- package/lib/commonjs/icons/Lightning.js +18 -6
- package/lib/commonjs/icons/Lightning.js.map +1 -1
- package/lib/commonjs/icons/index.js +11 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/native.js +14 -5
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/types/types.js +12 -0
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/utils.js +13 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +5 -4
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Card.js +2 -1
- package/lib/module/components/Attachment/Card.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +2 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +3 -2
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/Giphy.js +2 -3
- package/lib/module/components/Attachment/Giphy.js.map +1 -1
- package/lib/module/components/Attachment/utils/getAspectRatio.js +2 -1
- package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +14 -9
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerError.js +2 -2
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerError.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +1 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +6 -13
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -57
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +2 -3
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +2 -1
- package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +5 -2
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +4 -3
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +3 -3
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +2 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +5 -5
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +2 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/Message/Message.js +8 -7
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/MessageInput/AttachButton.js +67 -9
- package/lib/module/components/MessageInput/AttachButton.js.map +1 -1
- package/lib/module/components/MessageInput/CommandsButton.js +3 -2
- package/lib/module/components/MessageInput/CommandsButton.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +1 -11
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +2 -5
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +27 -22
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/components/InputGiphySearch.js +5 -6
- package/lib/module/components/MessageInput/components/InputGiphySearch.js.map +1 -1
- package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
- package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
- package/lib/module/components/MessageInput/hooks/useAudioController.js +2 -1
- package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
- package/lib/module/components/MessageList/MessageList.js +2 -1
- package/lib/module/components/MessageList/MessageList.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +19 -18
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +267 -181
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +3 -2
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +5 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +1 -0
- package/lib/module/i18n/es.json +1 -0
- package/lib/module/i18n/fr.json +1 -0
- package/lib/module/i18n/he.json +1 -0
- package/lib/module/i18n/hi.json +1 -0
- package/lib/module/i18n/it.json +1 -0
- package/lib/module/i18n/ja.json +1 -0
- package/lib/module/i18n/ko.json +1 -0
- package/lib/module/i18n/nl.json +1 -0
- package/lib/module/i18n/pt-br.json +1 -0
- package/lib/module/i18n/ru.json +1 -0
- package/lib/module/i18n/tr.json +1 -0
- package/lib/module/icons/Attach.js +29 -6
- package/lib/module/icons/Attach.js.map +1 -1
- package/lib/module/icons/GiphyLightning.js +31 -0
- package/lib/module/icons/GiphyLightning.js.map +1 -0
- package/lib/module/icons/Lightning.js +18 -6
- package/lib/module/icons/Lightning.js.map +1 -1
- package/lib/module/icons/index.js +11 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/native.js +14 -5
- package/lib/module/native.js.map +1 -1
- package/lib/module/types/types.js +12 -0
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/utils.js +13 -1
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/Card.d.ts +1 -1
- package/lib/typescript/components/Attachment/Card.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -1
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
- package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/AttachButton.d.ts +3 -1
- package/lib/typescript/components/MessageInput/AttachButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/CommandsButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts +9 -0
- package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts.map +1 -0
- package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
- package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
- package/lib/typescript/components/Reply/Reply.d.ts +1 -1
- package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +15 -3
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +5 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +1 -0
- package/lib/typescript/i18n/es.json +1 -0
- package/lib/typescript/i18n/fr.json +1 -0
- package/lib/typescript/i18n/he.json +1 -0
- package/lib/typescript/i18n/hi.json +1 -0
- package/lib/typescript/i18n/it.json +1 -0
- package/lib/typescript/i18n/ja.json +1 -0
- package/lib/typescript/i18n/ko.json +1 -0
- package/lib/typescript/i18n/nl.json +1 -0
- package/lib/typescript/i18n/pt-br.json +1 -0
- package/lib/typescript/i18n/ru.json +1 -0
- package/lib/typescript/i18n/tr.json +1 -0
- package/lib/typescript/icons/Attach.d.ts +5 -1
- package/lib/typescript/icons/Attach.d.ts.map +1 -1
- package/lib/typescript/icons/GiphyLightning.d.ts +8 -0
- package/lib/typescript/icons/GiphyLightning.d.ts.map +1 -0
- package/lib/typescript/icons/Lightning.d.ts +5 -1
- package/lib/typescript/icons/Lightning.d.ts.map +1 -1
- package/lib/typescript/icons/index.d.ts +1 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/native.d.ts +13 -5
- package/lib/typescript/native.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +10 -1
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +1 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/utils.d.ts +6 -0
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +7 -7
- package/src/components/Attachment/Card.tsx +2 -2
- package/src/components/Attachment/FileAttachmentGroup.tsx +2 -2
- package/src/components/Attachment/Gallery.tsx +3 -3
- package/src/components/Attachment/Giphy.tsx +1 -1
- package/src/components/Attachment/utils/getAspectRatio.ts +2 -2
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +6 -0
- package/src/components/AttachmentPicker/components/AttachmentPickerError.tsx +2 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.tsx +3 -0
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +7 -16
- package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +6 -30
- package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx +1 -1
- package/src/components/AutoCompleteInput/AutoCompleteSuggestionHeader.tsx +1 -1
- package/src/components/Channel/Channel.tsx +8 -6
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
- package/src/components/ImageGallery/ImageGallery.tsx +6 -6
- package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +5 -4
- package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +1 -0
- package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +1 -0
- package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +4 -3
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +2 -2
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +5 -14
- package/src/components/ImageGallery/components/ImageGrid.tsx +2 -2
- package/src/components/Message/Message.tsx +12 -8
- package/src/components/MessageInput/AttachButton.tsx +74 -8
- package/src/components/MessageInput/CommandsButton.tsx +2 -1
- package/src/components/MessageInput/FileUploadPreview.tsx +8 -17
- package/src/components/MessageInput/InputButtons.tsx +1 -2
- package/src/components/MessageInput/MessageInput.tsx +43 -30
- package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -0
- package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap +139 -45
- package/src/components/MessageInput/components/InputGiphySearch.tsx +3 -3
- package/src/components/MessageInput/components/NativeAttachmentPicker.tsx +179 -0
- package/src/components/MessageInput/hooks/useAudioController.tsx +2 -2
- package/src/components/MessageList/MessageList.tsx +2 -2
- package/src/components/Reply/Reply.tsx +31 -29
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +86 -37
- package/src/contexts/messageInputContext/MessageInputContext.tsx +94 -23
- package/src/contexts/messageInputContext/__tests__/MessageInputContext.test.tsx +1 -38
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +6 -1
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +11 -6
- package/src/contexts/overlayContext/OverlayProvider.tsx +4 -1
- package/src/contexts/themeContext/utils/theme.ts +10 -0
- package/src/i18n/en.json +1 -0
- package/src/i18n/es.json +1 -0
- package/src/i18n/fr.json +1 -0
- package/src/i18n/he.json +1 -0
- package/src/i18n/hi.json +1 -0
- package/src/i18n/it.json +1 -0
- package/src/i18n/ja.json +1 -0
- package/src/i18n/ko.json +1 -0
- package/src/i18n/nl.json +1 -0
- package/src/i18n/pt-br.json +1 -0
- package/src/i18n/ru.json +1 -0
- package/src/i18n/tr.json +1 -0
- package/src/icons/Attach.tsx +22 -9
- package/src/icons/GiphyLightning.tsx +18 -0
- package/src/icons/Lightning.tsx +14 -5
- package/src/icons/index.ts +1 -0
- package/src/native.ts +28 -14
- package/src/types/types.ts +11 -1
- package/src/utils/utils.ts +20 -0
- package/src/version.json +1 -1
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
49
49
|
import { useViewport } from '../../hooks/useViewport';
|
|
50
50
|
import { isVideoPackageAvailable, VideoType } from '../../native';
|
|
51
|
-
import
|
|
51
|
+
import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
|
|
52
52
|
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
53
53
|
import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
|
|
54
54
|
import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
|
|
@@ -239,15 +239,15 @@ export const ImageGallery = <
|
|
|
239
239
|
cur.attachments
|
|
240
240
|
?.filter(
|
|
241
241
|
(attachment) =>
|
|
242
|
-
(attachment.type ===
|
|
242
|
+
(attachment.type === FileTypes.Giphy &&
|
|
243
243
|
(attachment.giphy?.[giphyVersion]?.url ||
|
|
244
244
|
attachment.thumb_url ||
|
|
245
245
|
attachment.image_url)) ||
|
|
246
|
-
(attachment.type ===
|
|
246
|
+
(attachment.type === FileTypes.Image &&
|
|
247
247
|
!attachment.title_link &&
|
|
248
248
|
!attachment.og_scrape_url &&
|
|
249
249
|
getUrlOfImageAttachment(attachment)) ||
|
|
250
|
-
(isVideoPackageAvailable() && attachment.type ===
|
|
250
|
+
(isVideoPackageAvailable() && attachment.type === FileTypes.Video),
|
|
251
251
|
)
|
|
252
252
|
.reverse() || [];
|
|
253
253
|
|
|
@@ -344,7 +344,7 @@ export const ImageGallery = <
|
|
|
344
344
|
const imageHeight = Math.floor(height * (fullWindowWidth / width));
|
|
345
345
|
setCurrentImageHeight(imageHeight > fullWindowHeight ? fullWindowHeight : imageHeight);
|
|
346
346
|
} else if (photo?.uri) {
|
|
347
|
-
if (photo.type ===
|
|
347
|
+
if (photo.type === FileTypes.Image) {
|
|
348
348
|
Image.getSize(photo.uri, (width, height) => {
|
|
349
349
|
const imageHeight = Math.floor(height * (fullWindowWidth / width));
|
|
350
350
|
setCurrentImageHeight(imageHeight > fullWindowHeight ? fullWindowHeight : imageHeight);
|
|
@@ -553,7 +553,7 @@ export const ImageGallery = <
|
|
|
553
553
|
<Animated.View style={StyleSheet.absoluteFill}>
|
|
554
554
|
<Animated.View style={[styles.animatedContainer, pagerStyle, pager]}>
|
|
555
555
|
{imageGalleryAttachments.map((photo, i) =>
|
|
556
|
-
photo.type ===
|
|
556
|
+
photo.type === FileTypes.Video ? (
|
|
557
557
|
<AnimatedGalleryVideo
|
|
558
558
|
attachmentId={photo.id}
|
|
559
559
|
handleEnd={handleEnd}
|
|
@@ -24,6 +24,7 @@ import { ImageGallery } from '../ImageGallery';
|
|
|
24
24
|
jest.mock('../../../native.ts', () => {
|
|
25
25
|
const View = require('react-native/Libraries/Components/View/View');
|
|
26
26
|
return {
|
|
27
|
+
isImageMediaLibraryAvailable: jest.fn(() => true),
|
|
27
28
|
isVideoPackageAvailable: jest.fn(() => true),
|
|
28
29
|
NetInfo: {
|
|
29
30
|
addEventListener: jest.fn(),
|
|
@@ -82,7 +83,7 @@ describe('ImageGallery', () => {
|
|
|
82
83
|
videoItemComponent,
|
|
83
84
|
'handleLoad',
|
|
84
85
|
`photoId-${message.id}-${attachment.asset_url}`,
|
|
85
|
-
10,
|
|
86
|
+
10 * 1000,
|
|
86
87
|
);
|
|
87
88
|
});
|
|
88
89
|
|
|
@@ -143,7 +144,7 @@ describe('ImageGallery', () => {
|
|
|
143
144
|
videoItemComponent,
|
|
144
145
|
'handleProgress',
|
|
145
146
|
`photoId-${message.id}-${attachment.asset_url}`,
|
|
146
|
-
0.3,
|
|
147
|
+
0.3 * 1000,
|
|
147
148
|
);
|
|
148
149
|
});
|
|
149
150
|
|
|
@@ -169,7 +170,7 @@ describe('ImageGallery', () => {
|
|
|
169
170
|
|
|
170
171
|
act(() => {
|
|
171
172
|
fireEvent(videoItemComponent, 'handleLoad', {
|
|
172
|
-
duration: 10,
|
|
173
|
+
duration: 10 * 1000,
|
|
173
174
|
});
|
|
174
175
|
fireEvent(videoItemComponent, 'handleProgress', {
|
|
175
176
|
currentTime: undefined,
|
|
@@ -202,7 +203,7 @@ describe('ImageGallery', () => {
|
|
|
202
203
|
videoItemComponent,
|
|
203
204
|
'handleLoad',
|
|
204
205
|
`photoId-${message.id}-${attachment.asset_url}`,
|
|
205
|
-
10,
|
|
206
|
+
10 * 1000,
|
|
206
207
|
);
|
|
207
208
|
fireEvent(videoItemComponent, 'handleEnd');
|
|
208
209
|
});
|
|
@@ -28,6 +28,7 @@ jest.mock('../../../native.ts', () => {
|
|
|
28
28
|
const View = require('react-native/Libraries/Components/View/View');
|
|
29
29
|
return {
|
|
30
30
|
deleteFile: jest.fn(),
|
|
31
|
+
isImageMediaLibraryAvailable: jest.fn(() => true),
|
|
31
32
|
isVideoPackageAvailable: jest.fn(() => true),
|
|
32
33
|
NetInfo: {
|
|
33
34
|
addEventListener: jest.fn(),
|
|
@@ -30,6 +30,7 @@ import { ImageGallery, ImageGalleryCustomComponents } from '../ImageGallery';
|
|
|
30
30
|
jest.mock('../../../native.ts', () => {
|
|
31
31
|
const View = require('react-native/Libraries/Components/View/View');
|
|
32
32
|
return {
|
|
33
|
+
isImageMediaLibraryAvailable: jest.fn(() => true),
|
|
33
34
|
isVideoPackageAvailable: jest.fn(() => true),
|
|
34
35
|
NetInfo: {
|
|
35
36
|
addEventListener: jest.fn(),
|
|
@@ -54,7 +54,7 @@ describe('ImageGalleryOverlay', () => {
|
|
|
54
54
|
|
|
55
55
|
render(
|
|
56
56
|
getComponent({
|
|
57
|
-
duration: 3600,
|
|
57
|
+
duration: 3600 * 1000,
|
|
58
58
|
progress: 1,
|
|
59
59
|
}),
|
|
60
60
|
);
|
|
@@ -73,7 +73,7 @@ describe('ImageGalleryOverlay', () => {
|
|
|
73
73
|
|
|
74
74
|
render(
|
|
75
75
|
getComponent({
|
|
76
|
-
duration: 60,
|
|
76
|
+
duration: 60 * 1000,
|
|
77
77
|
progress: 0.5,
|
|
78
78
|
}),
|
|
79
79
|
);
|
|
@@ -83,7 +83,8 @@ export const AnimatedGalleryVideo = React.memo(
|
|
|
83
83
|
|
|
84
84
|
const onLoad = (payload: VideoPayloadData) => {
|
|
85
85
|
setOpacity(0);
|
|
86
|
-
|
|
86
|
+
// Duration is in seconds so we convert to milliseconds.
|
|
87
|
+
handleLoad(attachmentId, payload.duration * 1000);
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
const onEnd = () => {
|
|
@@ -109,12 +110,12 @@ export const AnimatedGalleryVideo = React.memo(
|
|
|
109
110
|
} else {
|
|
110
111
|
// Update your UI for the loaded state
|
|
111
112
|
setOpacity(0);
|
|
112
|
-
handleLoad(attachmentId, playbackStatus.durationMillis
|
|
113
|
+
handleLoad(attachmentId, playbackStatus.durationMillis);
|
|
113
114
|
if (playbackStatus.isPlaying) {
|
|
114
115
|
// Update your UI for the playing state
|
|
115
116
|
handleProgress(
|
|
116
117
|
attachmentId,
|
|
117
|
-
playbackStatus.positionMillis /
|
|
118
|
+
playbackStatus.positionMillis / playbackStatus.durationMillis,
|
|
118
119
|
);
|
|
119
120
|
}
|
|
120
121
|
|
|
@@ -9,7 +9,7 @@ import { useTranslationContext } from '../../../contexts/translationContext/Tran
|
|
|
9
9
|
import { Grid as GridIconDefault, Share as ShareIconDefault } from '../../../icons';
|
|
10
10
|
import { deleteFile, saveFile, shareImage, VideoType } from '../../../native';
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import { DefaultStreamChatGenerics, FileTypes } from '../../../types/types';
|
|
13
13
|
import type { Photo } from '../ImageGallery';
|
|
14
14
|
|
|
15
15
|
const ReanimatedSafeAreaView = Animated.createAnimatedComponent
|
|
@@ -182,7 +182,7 @@ export const ImageGalleryFooterWithContext = <
|
|
|
182
182
|
style={styles.wrapper}
|
|
183
183
|
>
|
|
184
184
|
<ReanimatedSafeAreaView style={[container, { backgroundColor: white }, footerStyle]}>
|
|
185
|
-
{photo.type ===
|
|
185
|
+
{photo.type === FileTypes.Video ? (
|
|
186
186
|
videoControlElement ? (
|
|
187
187
|
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
|
|
188
188
|
) : (
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
|
|
6
4
|
import type { ImageGalleryFooterVideoControlProps } from './ImageGalleryFooter';
|
|
7
5
|
|
|
8
6
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
9
7
|
|
|
10
8
|
import { Pause, Play } from '../../../icons';
|
|
9
|
+
import { getDurationLabelFromDuration } from '../../../utils/utils';
|
|
11
10
|
import { ProgressControl } from '../../ProgressControl/ProgressControl';
|
|
12
11
|
|
|
13
12
|
const styles = StyleSheet.create({
|
|
@@ -37,19 +36,11 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
37
36
|
(props: ImageGalleryFooterVideoControlProps) => {
|
|
38
37
|
const { duration, onPlayPause, paused, progress, videoRef } = props;
|
|
39
38
|
|
|
40
|
-
const videoDuration = duration
|
|
41
|
-
? duration / 3600 >= 1
|
|
42
|
-
? dayjs.duration(duration, 'second').format('HH:mm:ss')
|
|
43
|
-
: dayjs.duration(duration, 'second').format('mm:ss')
|
|
44
|
-
: null;
|
|
39
|
+
const videoDuration = getDurationLabelFromDuration(duration);
|
|
45
40
|
|
|
46
41
|
const progressValueInSeconds = progress * duration;
|
|
47
42
|
|
|
48
|
-
const progressDuration = progressValueInSeconds
|
|
49
|
-
? progressValueInSeconds / 3600 >= 1
|
|
50
|
-
? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')
|
|
51
|
-
: dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')
|
|
52
|
-
: null;
|
|
43
|
+
const progressDuration = getDurationLabelFromDuration(progressValueInSeconds);
|
|
53
44
|
|
|
54
45
|
const {
|
|
55
46
|
theme: {
|
|
@@ -85,7 +76,7 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
85
76
|
accessibilityLabel='Progress Duration'
|
|
86
77
|
style={[styles.durationTextStyle, { color: black }, durationTextStyle]}
|
|
87
78
|
>
|
|
88
|
-
{progressDuration
|
|
79
|
+
{progressDuration}
|
|
89
80
|
</Text>
|
|
90
81
|
<ProgressControl
|
|
91
82
|
duration={duration}
|
|
@@ -99,7 +90,7 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
99
90
|
accessibilityLabel='Video Duration'
|
|
100
91
|
style={[styles.durationTextStyle, { color: black }, durationTextStyle]}
|
|
101
92
|
>
|
|
102
|
-
{videoDuration
|
|
93
|
+
{videoDuration}
|
|
103
94
|
</Text>
|
|
104
95
|
</View>
|
|
105
96
|
);
|
|
@@ -6,7 +6,7 @@ import { BottomSheetFlatList, TouchableOpacity } from '@gorhom/bottom-sheet';
|
|
|
6
6
|
import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
|
|
7
7
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
8
8
|
import { useViewport } from '../../../hooks/useViewport';
|
|
9
|
-
import
|
|
9
|
+
import { DefaultStreamChatGenerics, FileTypes } from '../../../types/types';
|
|
10
10
|
|
|
11
11
|
import type { Photo } from '../ImageGallery';
|
|
12
12
|
|
|
@@ -84,7 +84,7 @@ const GridImage = <
|
|
|
84
84
|
|
|
85
85
|
return (
|
|
86
86
|
<TouchableOpacity accessibilityLabel='Grid Image' onPress={selectAndClose}>
|
|
87
|
-
{type ===
|
|
87
|
+
{type === FileTypes.Video ? (
|
|
88
88
|
<View style={[styles.image, { height: size, width: size }, gridImage]}>
|
|
89
89
|
<VideoThumbnail thumb_url={thumb_url} />
|
|
90
90
|
</View>
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
} from '../../contexts/translationContext/TranslationContext';
|
|
41
41
|
|
|
42
42
|
import { isVideoPackageAvailable, triggerHaptic } from '../../native';
|
|
43
|
-
import
|
|
43
|
+
import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
|
|
44
44
|
import {
|
|
45
45
|
hasOnlyEmojis,
|
|
46
46
|
isBlockedMessage,
|
|
@@ -377,22 +377,26 @@ const MessageWithContext = <
|
|
|
377
377
|
!isMessageTypeDeleted && Array.isArray(message.attachments)
|
|
378
378
|
? message.attachments.reduce(
|
|
379
379
|
(acc, cur) => {
|
|
380
|
-
if (cur.type ===
|
|
380
|
+
if (cur.type === FileTypes.File) {
|
|
381
381
|
acc.files.push(cur);
|
|
382
382
|
acc.other = []; // remove other attachments if a file exists
|
|
383
|
-
} else if (
|
|
383
|
+
} else if (
|
|
384
|
+
cur.type === FileTypes.Video &&
|
|
385
|
+
!cur.og_scrape_url &&
|
|
386
|
+
isVideoPackageAvailable()
|
|
387
|
+
) {
|
|
384
388
|
acc.videos.push({
|
|
385
389
|
image_url: cur.asset_url,
|
|
386
390
|
thumb_url: cur.thumb_url,
|
|
387
|
-
type:
|
|
391
|
+
type: FileTypes.Video,
|
|
388
392
|
});
|
|
389
393
|
acc.other = [];
|
|
390
|
-
} else if (cur.type ===
|
|
394
|
+
} else if (cur.type === FileTypes.Video && !cur.og_scrape_url) {
|
|
391
395
|
acc.files.push(cur);
|
|
392
396
|
acc.other = []; // remove other attachments if a file exists
|
|
393
|
-
} else if (cur.type ===
|
|
397
|
+
} else if (cur.type === FileTypes.Audio || cur.type === FileTypes.VoiceRecording) {
|
|
394
398
|
acc.files.push(cur);
|
|
395
|
-
} else if (cur.type ===
|
|
399
|
+
} else if (cur.type === FileTypes.Image && !cur.title_link && !cur.og_scrape_url) {
|
|
396
400
|
/**
|
|
397
401
|
* this next if is not combined with the above one for cases where we have
|
|
398
402
|
* an image with no url links at all falling back to being an attachment
|
|
@@ -859,7 +863,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
859
863
|
prevMessageAttachments.length === nextMessageAttachments.length &&
|
|
860
864
|
prevMessageAttachments.every((attachment, index) => {
|
|
861
865
|
const attachmentKeysEqual =
|
|
862
|
-
attachment.type ===
|
|
866
|
+
attachment.type === FileTypes.Image
|
|
863
867
|
? attachment.image_url === nextMessageAttachments[index].image_url &&
|
|
864
868
|
attachment.thumb_url === nextMessageAttachments[index].thumb_url
|
|
865
869
|
: attachment.type === nextMessageAttachments[index].type;
|
|
@@ -1,30 +1,96 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { GestureResponderEvent } from 'react-native';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import type { GestureResponderEvent, LayoutChangeEvent, LayoutRectangle } from 'react-native';
|
|
3
3
|
import { Pressable } from 'react-native';
|
|
4
4
|
|
|
5
|
+
import { NativeAttachmentPicker } from './components/NativeAttachmentPicker';
|
|
6
|
+
|
|
5
7
|
import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
8
|
+
import { ChannelContextValue } from '../../contexts/channelContext/ChannelContext';
|
|
9
|
+
import { useMessageInputContext } from '../../contexts/messageInputContext/MessageInputContext';
|
|
6
10
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
7
11
|
import { Attach } from '../../icons/Attach';
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
import { isImageMediaLibraryAvailable } from '../../native';
|
|
14
|
+
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
15
|
+
|
|
16
|
+
type AttachButtonPropsWithContext<
|
|
17
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
18
|
+
> = Pick<ChannelContextValue<StreamChatGenerics>, 'disabled'> & {
|
|
10
19
|
/** Function that opens attachment options bottom sheet */
|
|
11
20
|
handleOnPress?: ((event: GestureResponderEvent) => void) & (() => void);
|
|
12
21
|
selectedPicker?: 'images';
|
|
13
22
|
};
|
|
14
23
|
|
|
15
|
-
const AttachButtonWithContext =
|
|
16
|
-
|
|
24
|
+
const AttachButtonWithContext = <
|
|
25
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
26
|
+
>(
|
|
27
|
+
props: AttachButtonPropsWithContext<StreamChatGenerics>,
|
|
28
|
+
) => {
|
|
29
|
+
const [showAttachButtonPicker, setShowAttachButtonPicker] = useState<boolean>(false);
|
|
30
|
+
const [attachButtonLayoutRectangle, setAttachButtonLayoutRectangle] = useState<LayoutRectangle>();
|
|
31
|
+
const { disabled, handleOnPress, selectedPicker } = props;
|
|
17
32
|
const {
|
|
18
33
|
theme: {
|
|
19
34
|
colors: { accent_blue, grey },
|
|
20
35
|
messageInput: { attachButton },
|
|
21
36
|
},
|
|
22
37
|
} = useTheme();
|
|
38
|
+
const { handleAttachButtonPress, toggleAttachmentPicker } = useMessageInputContext();
|
|
39
|
+
|
|
40
|
+
const onAttachButtonLayout = (event: LayoutChangeEvent) => {
|
|
41
|
+
const layout = event.nativeEvent.layout;
|
|
42
|
+
setAttachButtonLayoutRectangle((prev) => {
|
|
43
|
+
if (
|
|
44
|
+
prev &&
|
|
45
|
+
prev.width === layout.width &&
|
|
46
|
+
prev.height === layout.height &&
|
|
47
|
+
prev.x === layout.x &&
|
|
48
|
+
prev.y === layout.y
|
|
49
|
+
) {
|
|
50
|
+
return prev;
|
|
51
|
+
}
|
|
52
|
+
return layout;
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const attachButtonHandler = () => {
|
|
57
|
+
setShowAttachButtonPicker(true);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const onPressHandler = () => {
|
|
61
|
+
if (handleOnPress) {
|
|
62
|
+
handleOnPress();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (handleAttachButtonPress) {
|
|
66
|
+
handleAttachButtonPress();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (isImageMediaLibraryAvailable()) {
|
|
70
|
+
toggleAttachmentPicker();
|
|
71
|
+
} else {
|
|
72
|
+
attachButtonHandler();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
23
75
|
|
|
24
76
|
return (
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
77
|
+
<>
|
|
78
|
+
<Pressable
|
|
79
|
+
disabled={disabled}
|
|
80
|
+
onLayout={onAttachButtonLayout}
|
|
81
|
+
onPress={disabled ? () => null : onPressHandler}
|
|
82
|
+
style={[attachButton]}
|
|
83
|
+
testID='attach-button'
|
|
84
|
+
>
|
|
85
|
+
<Attach fill={selectedPicker === 'images' ? accent_blue : grey} size={32} />
|
|
86
|
+
</Pressable>
|
|
87
|
+
{showAttachButtonPicker ? (
|
|
88
|
+
<NativeAttachmentPicker
|
|
89
|
+
attachButtonLayoutRectangle={attachButtonLayoutRectangle}
|
|
90
|
+
onRequestedClose={() => setShowAttachButtonPicker(false)}
|
|
91
|
+
/>
|
|
92
|
+
) : null}
|
|
93
|
+
</>
|
|
28
94
|
);
|
|
29
95
|
};
|
|
30
96
|
|
|
@@ -36,11 +36,12 @@ const CommandsButtonWithContext = <
|
|
|
36
36
|
return (
|
|
37
37
|
<Pressable onPress={handleOnPress} style={[commandsButton]} testID='commands-button'>
|
|
38
38
|
<Lightning
|
|
39
|
-
|
|
39
|
+
fill={
|
|
40
40
|
suggestions && suggestions.data.some((suggestion) => isSuggestionCommand(suggestion))
|
|
41
41
|
? accent_blue
|
|
42
42
|
: grey
|
|
43
43
|
}
|
|
44
|
+
size={32}
|
|
44
45
|
/>
|
|
45
46
|
</Pressable>
|
|
46
47
|
);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { FlatList, I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import dayjs from 'dayjs';
|
|
5
|
-
|
|
6
4
|
import { UploadProgressIndicator } from './UploadProgressIndicator';
|
|
7
5
|
|
|
8
6
|
import { ChatContextValue, useChatContext } from '../../contexts';
|
|
@@ -21,7 +19,11 @@ import { Warning } from '../../icons/Warning';
|
|
|
21
19
|
import { isAudioPackageAvailable } from '../../native';
|
|
22
20
|
import type { DefaultStreamChatGenerics, FileUpload } from '../../types/types';
|
|
23
21
|
import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
|
|
24
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
getDurationLabelFromDuration,
|
|
24
|
+
getIndicatorTypeForFileState,
|
|
25
|
+
ProgressIndicatorTypes,
|
|
26
|
+
} from '../../utils/utils';
|
|
25
27
|
import { getFileSizeDisplayText } from '../Attachment/FileAttachment';
|
|
26
28
|
import { WritingDirectionAwareText } from '../RTLComponents/WritingDirectionAwareText';
|
|
27
29
|
|
|
@@ -97,19 +99,6 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
|
|
|
97
99
|
},
|
|
98
100
|
} = useTheme();
|
|
99
101
|
|
|
100
|
-
const ONE_HOUR_IN_SECONDS = 3600;
|
|
101
|
-
let durationLabel = '00:00';
|
|
102
|
-
const videoDuration = item.file.duration;
|
|
103
|
-
|
|
104
|
-
if (videoDuration) {
|
|
105
|
-
const isDurationLongerThanHour = videoDuration / ONE_HOUR_IN_SECONDS >= 1;
|
|
106
|
-
const formattedDurationParam = isDurationLongerThanHour ? 'HH:mm:ss' : 'mm:ss';
|
|
107
|
-
const formattedVideoDuration = dayjs
|
|
108
|
-
.duration(videoDuration, 'second')
|
|
109
|
-
.format(formattedDurationParam);
|
|
110
|
-
durationLabel = formattedVideoDuration;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
102
|
const { t } = useTranslationContext();
|
|
114
103
|
|
|
115
104
|
return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (
|
|
@@ -126,7 +115,9 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
|
|
|
126
115
|
</View>
|
|
127
116
|
) : (
|
|
128
117
|
<WritingDirectionAwareText style={[styles.fileSizeText, { color: grey }, fileSizeText]}>
|
|
129
|
-
{
|
|
118
|
+
{item.file.duration
|
|
119
|
+
? getDurationLabelFromDuration(item.file.duration)
|
|
120
|
+
: getFileSizeDisplayText(item.file.size)}
|
|
130
121
|
</WritingDirectionAwareText>
|
|
131
122
|
);
|
|
132
123
|
};
|
|
@@ -56,7 +56,6 @@ export const InputButtonsWithContext = <
|
|
|
56
56
|
setShowMoreOptions,
|
|
57
57
|
showMoreOptions,
|
|
58
58
|
text,
|
|
59
|
-
toggleAttachmentPicker,
|
|
60
59
|
} = props;
|
|
61
60
|
|
|
62
61
|
const {
|
|
@@ -79,7 +78,7 @@ export const InputButtonsWithContext = <
|
|
|
79
78
|
<View
|
|
80
79
|
style={[hasCommands ? styles.attachButtonContainer : undefined, attachButtonContainer]}
|
|
81
80
|
>
|
|
82
|
-
<AttachButton
|
|
81
|
+
<AttachButton />
|
|
83
82
|
</View>
|
|
84
83
|
)}
|
|
85
84
|
{hasCommands && !text && (
|
|
@@ -118,6 +118,7 @@ type MessageInputPropsWithContext<
|
|
|
118
118
|
| 'FileUploadPreview'
|
|
119
119
|
| 'fileUploads'
|
|
120
120
|
| 'giphyActive'
|
|
121
|
+
| 'hasImagePicker'
|
|
121
122
|
| 'ImageUploadPreview'
|
|
122
123
|
| 'imageUploads'
|
|
123
124
|
| 'Input'
|
|
@@ -184,6 +185,7 @@ const MessageInputWithContext = <
|
|
|
184
185
|
FileUploadPreview,
|
|
185
186
|
fileUploads,
|
|
186
187
|
giphyActive,
|
|
188
|
+
hasImagePicker,
|
|
187
189
|
ImageUploadPreview,
|
|
188
190
|
imageUploads,
|
|
189
191
|
Input,
|
|
@@ -277,6 +279,9 @@ const MessageInputWithContext = <
|
|
|
277
279
|
const fileUploadsLength = hasResetFiles ? fileUploads.length : 0;
|
|
278
280
|
const imagesForInput = (!!thread && !!threadList) || (!thread && !threadList);
|
|
279
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Reset the selected images when the component is unmounted.
|
|
284
|
+
*/
|
|
280
285
|
useEffect(() => {
|
|
281
286
|
setSelectedImages([]);
|
|
282
287
|
if (imageUploads.length) {
|
|
@@ -285,11 +290,15 @@ const MessageInputWithContext = <
|
|
|
285
290
|
return () => setSelectedImages([]);
|
|
286
291
|
}, []);
|
|
287
292
|
|
|
293
|
+
/**
|
|
294
|
+
* Reset the selected files when the component is unmounted.
|
|
295
|
+
*/
|
|
288
296
|
useEffect(() => {
|
|
289
297
|
setSelectedFiles([]);
|
|
290
298
|
if (fileUploads.length) {
|
|
291
299
|
fileUploads.forEach((file) => removeFile(file.id));
|
|
292
300
|
}
|
|
301
|
+
|
|
293
302
|
return () => setSelectedFiles([]);
|
|
294
303
|
}, []);
|
|
295
304
|
|
|
@@ -306,10 +315,10 @@ const MessageInputWithContext = <
|
|
|
306
315
|
}, [fileUploadsLength, selectedFilesLength]);
|
|
307
316
|
|
|
308
317
|
useEffect(() => {
|
|
309
|
-
if (imagesForInput === false &&
|
|
318
|
+
if (imagesForInput === false && imageUploadsLength) {
|
|
310
319
|
imageUploads.forEach((image) => removeImage(image.id));
|
|
311
320
|
}
|
|
312
|
-
}, [imagesForInput]);
|
|
321
|
+
}, [imagesForInput, imageUploadsLength]);
|
|
313
322
|
|
|
314
323
|
const uploadImagesHandler = () => {
|
|
315
324
|
const imageToUpload = selectedImages.find((selectedImage) => {
|
|
@@ -371,9 +380,9 @@ const MessageInputWithContext = <
|
|
|
371
380
|
}, [selectedFilesLength]);
|
|
372
381
|
|
|
373
382
|
useEffect(() => {
|
|
374
|
-
if (imagesForInput) {
|
|
383
|
+
if (imagesForInput && hasImagePicker) {
|
|
375
384
|
if (imageUploadsLength < selectedImagesLength) {
|
|
376
|
-
/** User removed some image from seleted images within ImageUploadPreview. */
|
|
385
|
+
// /** User removed some image from seleted images within ImageUploadPreview. */
|
|
377
386
|
const updatedSelectedImages = selectedImages.filter((selectedImage) => {
|
|
378
387
|
const uploadedImage = imageUploads.find(
|
|
379
388
|
(imageUpload) =>
|
|
@@ -400,36 +409,38 @@ const MessageInputWithContext = <
|
|
|
400
409
|
);
|
|
401
410
|
}
|
|
402
411
|
}
|
|
403
|
-
}, [imageUploadsLength]);
|
|
412
|
+
}, [imageUploadsLength, hasImagePicker]);
|
|
404
413
|
|
|
405
414
|
useEffect(() => {
|
|
406
|
-
if (
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
const
|
|
410
|
-
(
|
|
411
|
-
fileUpload
|
|
415
|
+
if (hasImagePicker) {
|
|
416
|
+
if (fileUploadsLength < selectedFilesLength) {
|
|
417
|
+
/** User removed some video from seleted files within ImageUploadPreview. */
|
|
418
|
+
const updatedSelectedFiles = selectedFiles.filter((selectedFile) => {
|
|
419
|
+
const uploadedFile = fileUploads.find(
|
|
420
|
+
(fileUpload) =>
|
|
421
|
+
fileUpload.file.uri === selectedFile.uri || fileUpload.url === selectedFile.uri,
|
|
422
|
+
);
|
|
423
|
+
return uploadedFile;
|
|
424
|
+
});
|
|
425
|
+
setSelectedFiles(updatedSelectedFiles);
|
|
426
|
+
} else if (fileUploadsLength > selectedFilesLength) {
|
|
427
|
+
/**
|
|
428
|
+
* User is editing some message which contains video attachments OR
|
|
429
|
+
* video attachment is added from custom image picker (other than the default bottom-sheet image picker)
|
|
430
|
+
* using `uploadNewFile` function from `MessageInputContext`.
|
|
431
|
+
**/
|
|
432
|
+
setSelectedFiles(
|
|
433
|
+
fileUploads.map((fileUpload) => ({
|
|
434
|
+
duration: fileUpload.file.duration,
|
|
435
|
+
mimeType: fileUpload.file.mimeType,
|
|
436
|
+
name: fileUpload.file.name,
|
|
437
|
+
size: fileUpload.file.size,
|
|
438
|
+
uri: fileUpload.file.uri,
|
|
439
|
+
})),
|
|
412
440
|
);
|
|
413
|
-
|
|
414
|
-
});
|
|
415
|
-
setSelectedFiles(updatedSelectedFiles);
|
|
416
|
-
} else if (fileUploadsLength > selectedFilesLength) {
|
|
417
|
-
/**
|
|
418
|
-
* User is editing some message which contains video attachments OR
|
|
419
|
-
* video attachment is added from custom image picker (other than the default bottom-sheet image picker)
|
|
420
|
-
* using `uploadNewFile` function from `MessageInputContext`.
|
|
421
|
-
**/
|
|
422
|
-
setSelectedFiles(
|
|
423
|
-
fileUploads.map((fileUpload) => ({
|
|
424
|
-
duration: fileUpload.file.duration,
|
|
425
|
-
mimeType: fileUpload.file.mimeType,
|
|
426
|
-
name: fileUpload.file.name,
|
|
427
|
-
size: fileUpload.file.size,
|
|
428
|
-
uri: fileUpload.file.uri,
|
|
429
|
-
})),
|
|
430
|
-
);
|
|
441
|
+
}
|
|
431
442
|
}
|
|
432
|
-
}, [fileUploadsLength]);
|
|
443
|
+
}, [fileUploadsLength, hasImagePicker]);
|
|
433
444
|
|
|
434
445
|
const editingExists = !!editing;
|
|
435
446
|
useEffect(() => {
|
|
@@ -1012,6 +1023,7 @@ export const MessageInput = <
|
|
|
1012
1023
|
FileUploadPreview,
|
|
1013
1024
|
fileUploads,
|
|
1014
1025
|
giphyActive,
|
|
1026
|
+
hasImagePicker,
|
|
1015
1027
|
ImageUploadPreview,
|
|
1016
1028
|
imageUploads,
|
|
1017
1029
|
Input,
|
|
@@ -1092,6 +1104,7 @@ export const MessageInput = <
|
|
|
1092
1104
|
FileUploadPreview,
|
|
1093
1105
|
fileUploads,
|
|
1094
1106
|
giphyActive,
|
|
1107
|
+
hasImagePicker,
|
|
1095
1108
|
ImageUploadPreview,
|
|
1096
1109
|
imageUploads,
|
|
1097
1110
|
Input,
|