stream-chat-react-native-core 5.34.1-beta.4 → 5.35.0-beta.1
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/AttachmentPickerIOSSelectMorePhotos.js +1 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +4 -11
- 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/AnimatedGalleryImage.js +3 -3
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +5 -5
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +6 -5
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -11
- 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/AttachmentPickerIOSSelectMorePhotos.js +1 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +4 -11
- 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/AnimatedGalleryImage.js +3 -3
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +5 -5
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +6 -5
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -11
- 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/AttachmentPickerIOSSelectMorePhotos.tsx +3 -0
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +6 -15
- 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/AnimatedGalleryImage.tsx +3 -3
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +5 -4
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +4 -4
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +8 -17
- 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
|
);
|
|
@@ -51,7 +51,7 @@ export const AnimatedGalleryImage = React.memo(
|
|
|
51
51
|
* image as it is scaled. If the scale is less than one they stay in
|
|
52
52
|
* place as to not come into the screen when the image shrinks.
|
|
53
53
|
*/
|
|
54
|
-
const
|
|
54
|
+
const animatedGalleryImageStyle = useAnimatedStyle<ImageStyle>(() => {
|
|
55
55
|
const xScaleOffset = -7 * screenWidth * (0.5 + index);
|
|
56
56
|
const yScaleOffset = -screenHeight * 3.5;
|
|
57
57
|
return {
|
|
@@ -91,8 +91,7 @@ export const AnimatedGalleryImage = React.memo(
|
|
|
91
91
|
resizeMode={'contain'}
|
|
92
92
|
source={{ uri: photo.uri }}
|
|
93
93
|
style={[
|
|
94
|
-
|
|
95
|
-
AnimatedGalleryImageStyle,
|
|
94
|
+
animatedGalleryImageStyle,
|
|
96
95
|
{
|
|
97
96
|
transform: [
|
|
98
97
|
{ scaleX: -1 },
|
|
@@ -103,6 +102,7 @@ export const AnimatedGalleryImage = React.memo(
|
|
|
103
102
|
{ scale: oneEighth },
|
|
104
103
|
],
|
|
105
104
|
},
|
|
105
|
+
style,
|
|
106
106
|
]}
|
|
107
107
|
/>
|
|
108
108
|
);
|
|
@@ -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
|
|
|
@@ -173,7 +174,6 @@ export const AnimatedGalleryVideo = React.memo(
|
|
|
173
174
|
<Animated.View
|
|
174
175
|
accessibilityLabel='Image Gallery Video'
|
|
175
176
|
style={[
|
|
176
|
-
style,
|
|
177
177
|
animatedViewStyles,
|
|
178
178
|
{
|
|
179
179
|
transform: [
|
|
@@ -185,6 +185,7 @@ export const AnimatedGalleryVideo = React.memo(
|
|
|
185
185
|
{ scale: oneEighth },
|
|
186
186
|
],
|
|
187
187
|
},
|
|
188
|
+
style,
|
|
188
189
|
]}
|
|
189
190
|
>
|
|
190
191
|
{isVideoPackageAvailable() && (
|
|
@@ -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
|
|
@@ -181,8 +181,8 @@ export const ImageGalleryFooterWithContext = <
|
|
|
181
181
|
pointerEvents={'box-none'}
|
|
182
182
|
style={styles.wrapper}
|
|
183
183
|
>
|
|
184
|
-
<ReanimatedSafeAreaView style={[container,
|
|
185
|
-
{photo.type ===
|
|
184
|
+
<ReanimatedSafeAreaView style={[container, { backgroundColor: white }, footerStyle]}>
|
|
185
|
+
{photo.type === FileTypes.Video ? (
|
|
186
186
|
videoControlElement ? (
|
|
187
187
|
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
|
|
188
188
|
) : (
|
|
@@ -195,7 +195,7 @@ export const ImageGalleryFooterWithContext = <
|
|
|
195
195
|
/>
|
|
196
196
|
)
|
|
197
197
|
) : null}
|
|
198
|
-
<View style={[styles.innerContainer,
|
|
198
|
+
<View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
|
|
199
199
|
{leftElement ? (
|
|
200
200
|
leftElement({ openGridView, photo, share, shareMenuOpen })
|
|
201
201
|
) : (
|
|
@@ -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: {
|
|
@@ -73,7 +64,7 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
73
64
|
return (
|
|
74
65
|
<View style={[styles.videoContainer, videoContainer]}>
|
|
75
66
|
<TouchableOpacity accessibilityLabel='Play Pause Button' onPress={handlePlayPause}>
|
|
76
|
-
<View style={[styles.roundedView,
|
|
67
|
+
<View style={[styles.roundedView, { backgroundColor: static_white }, roundedView]}>
|
|
77
68
|
{paused ? (
|
|
78
69
|
<Play accessibilityLabel='Play Icon' fill={static_black} height={32} width={32} />
|
|
79
70
|
) : (
|
|
@@ -83,9 +74,9 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
83
74
|
</TouchableOpacity>
|
|
84
75
|
<Text
|
|
85
76
|
accessibilityLabel='Progress Duration'
|
|
86
|
-
style={[styles.durationTextStyle,
|
|
77
|
+
style={[styles.durationTextStyle, { color: black }, durationTextStyle]}
|
|
87
78
|
>
|
|
88
|
-
{progressDuration
|
|
79
|
+
{progressDuration}
|
|
89
80
|
</Text>
|
|
90
81
|
<ProgressControl
|
|
91
82
|
duration={duration}
|
|
@@ -97,9 +88,9 @@ export const ImageGalleryVideoControl = React.memo(
|
|
|
97
88
|
/>
|
|
98
89
|
<Text
|
|
99
90
|
accessibilityLabel='Video Duration'
|
|
100
|
-
style={[styles.durationTextStyle,
|
|
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 && (
|