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
|
@@ -1701,6 +1701,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1701
1701
|
onBlur={[Function]}
|
|
1702
1702
|
onClick={[Function]}
|
|
1703
1703
|
onFocus={[Function]}
|
|
1704
|
+
onLayout={[Function]}
|
|
1704
1705
|
onResponderGrant={[Function]}
|
|
1705
1706
|
onResponderMove={[Function]}
|
|
1706
1707
|
onResponderRelease={[Function]}
|
|
@@ -1716,14 +1717,14 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1716
1717
|
>
|
|
1717
1718
|
<RNSVGSvgView
|
|
1718
1719
|
align="xMidYMid"
|
|
1719
|
-
bbHeight={
|
|
1720
|
-
bbWidth={
|
|
1720
|
+
bbHeight={32}
|
|
1721
|
+
bbWidth={32}
|
|
1722
|
+
fill="#7A7A7A"
|
|
1721
1723
|
focusable={false}
|
|
1722
|
-
height={
|
|
1724
|
+
height={32}
|
|
1723
1725
|
meetOrSlice={0}
|
|
1724
1726
|
minX={0}
|
|
1725
1727
|
minY={0}
|
|
1726
|
-
pathFill="#7A7A7A"
|
|
1727
1728
|
style={
|
|
1728
1729
|
[
|
|
1729
1730
|
{
|
|
@@ -1732,40 +1733,86 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1732
1733
|
},
|
|
1733
1734
|
{
|
|
1734
1735
|
"flex": 0,
|
|
1735
|
-
"height":
|
|
1736
|
-
"width":
|
|
1736
|
+
"height": 32,
|
|
1737
|
+
"width": 32,
|
|
1737
1738
|
},
|
|
1738
1739
|
]
|
|
1739
1740
|
}
|
|
1740
|
-
vbHeight={
|
|
1741
|
-
vbWidth={
|
|
1742
|
-
width={
|
|
1741
|
+
vbHeight={32}
|
|
1742
|
+
vbWidth={32}
|
|
1743
|
+
width={32}
|
|
1743
1744
|
>
|
|
1744
1745
|
<RNSVGGroup
|
|
1745
1746
|
fill={
|
|
1746
1747
|
{
|
|
1747
|
-
"payload":
|
|
1748
|
+
"payload": 4286216826,
|
|
1748
1749
|
"type": 0,
|
|
1749
1750
|
}
|
|
1750
1751
|
}
|
|
1752
|
+
propList={
|
|
1753
|
+
[
|
|
1754
|
+
"fill",
|
|
1755
|
+
]
|
|
1756
|
+
}
|
|
1751
1757
|
>
|
|
1752
|
-
<
|
|
1753
|
-
|
|
1754
|
-
d="M13.468 2.888a5.07 5.07 0 012.983.635 5.07 5.07 0 012.041 2.265c.45 1.01.546 2.254-.144 3.449l-4.5 7.794a3.232 3.232 0 01-1.427 1.294c-.757.342-1.696.367-2.671-.196-.975-.563-1.422-1.389-1.506-2.215a3.233 3.233 0 01.408-1.883l4-6.928a1 1 0 011.732 1l-4 6.928c-.087.15-.176.425-.15.682.02.196.105.447.516.684.41.237.671.185.85.105.236-.107.43-.32.516-.47l4.5-7.795c.31-.538.29-1.093.049-1.636a3.072 3.072 0 00-1.214-1.346 3.072 3.072 0 00-1.773-.378c-.591.062-1.082.322-1.392.86l-5 8.66c-.654 1.133-.286 3.3 1.964 4.598 2.25 1.3 4.31.535 4.964-.598l3.5-6.062a1 1 0 111.732 1l-3.5 6.062c-1.345 2.33-4.75 3.031-7.696 1.33-2.946-1.7-4.042-5-2.696-7.33l5-8.66c.69-1.195 1.815-1.733 2.914-1.85z"
|
|
1758
|
+
<RNSVGGroup
|
|
1759
|
+
clipPath="id"
|
|
1755
1760
|
fill={
|
|
1756
1761
|
{
|
|
1757
|
-
"payload":
|
|
1762
|
+
"payload": 4278190080,
|
|
1758
1763
|
"type": 0,
|
|
1759
1764
|
}
|
|
1760
1765
|
}
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1766
|
+
>
|
|
1767
|
+
<RNSVGPath
|
|
1768
|
+
d="M17.5245 9.33332L14.8579 9.33332L14.8579 14.6666L9.52453 14.6666L9.52453 17.3333L14.8579 17.3333L14.8579 22.6667L17.5245 22.6667L17.5245 17.3333L22.8579 17.3333L22.8579 14.6666L17.5245 14.6666L17.5245 9.33332ZM16.1912 2.66665C8.83119 2.66665 2.85786 8.63998 2.85786 16C2.85786 23.36 8.83119 29.3333 16.1912 29.3333C23.5512 29.3333 29.5245 23.36 29.5245 16C29.5245 8.63998 23.5512 2.66665 16.1912 2.66665ZM16.1912 26.6667C10.3112 26.6666 5.52453 21.88 5.52453 16C5.52453 10.12 10.3112 5.33332 16.1912 5.33332C22.0712 5.33332 26.8579 10.12 26.8579 16C26.8579 21.88 22.0712 26.6666 16.1912 26.6667Z"
|
|
1769
|
+
fill={
|
|
1770
|
+
{
|
|
1771
|
+
"payload": 4286216826,
|
|
1772
|
+
"type": 0,
|
|
1773
|
+
}
|
|
1774
|
+
}
|
|
1775
|
+
propList={
|
|
1776
|
+
[
|
|
1777
|
+
"fill",
|
|
1778
|
+
]
|
|
1779
|
+
}
|
|
1780
|
+
/>
|
|
1781
|
+
</RNSVGGroup>
|
|
1782
|
+
<RNSVGDefs>
|
|
1783
|
+
<RNSVGClipPath
|
|
1784
|
+
fill={
|
|
1785
|
+
{
|
|
1786
|
+
"payload": 4278190080,
|
|
1787
|
+
"type": 0,
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
name="id"
|
|
1791
|
+
>
|
|
1792
|
+
<RNSVGRect
|
|
1793
|
+
fill={
|
|
1794
|
+
{
|
|
1795
|
+
"payload": 4278190080,
|
|
1796
|
+
"type": 0,
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
height={32}
|
|
1800
|
+
matrix={
|
|
1801
|
+
[
|
|
1802
|
+
1,
|
|
1803
|
+
0,
|
|
1804
|
+
0,
|
|
1805
|
+
1,
|
|
1806
|
+
0.191406,
|
|
1807
|
+
0,
|
|
1808
|
+
]
|
|
1809
|
+
}
|
|
1810
|
+
width={32}
|
|
1811
|
+
x={0}
|
|
1812
|
+
y={0}
|
|
1813
|
+
/>
|
|
1814
|
+
</RNSVGClipPath>
|
|
1815
|
+
</RNSVGDefs>
|
|
1769
1816
|
</RNSVGGroup>
|
|
1770
1817
|
</RNSVGSvgView>
|
|
1771
1818
|
</View>
|
|
@@ -1812,14 +1859,14 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1812
1859
|
>
|
|
1813
1860
|
<RNSVGSvgView
|
|
1814
1861
|
align="xMidYMid"
|
|
1815
|
-
bbHeight={
|
|
1816
|
-
bbWidth={
|
|
1862
|
+
bbHeight={32}
|
|
1863
|
+
bbWidth={32}
|
|
1864
|
+
fill="#7A7A7A"
|
|
1817
1865
|
focusable={false}
|
|
1818
|
-
height={
|
|
1866
|
+
height={32}
|
|
1819
1867
|
meetOrSlice={0}
|
|
1820
1868
|
minX={0}
|
|
1821
1869
|
minY={0}
|
|
1822
|
-
pathFill="#7A7A7A"
|
|
1823
1870
|
style={
|
|
1824
1871
|
[
|
|
1825
1872
|
{
|
|
@@ -1828,37 +1875,39 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1828
1875
|
},
|
|
1829
1876
|
{
|
|
1830
1877
|
"flex": 0,
|
|
1831
|
-
"height":
|
|
1832
|
-
"width":
|
|
1878
|
+
"height": 32,
|
|
1879
|
+
"width": 32,
|
|
1833
1880
|
},
|
|
1834
1881
|
]
|
|
1835
1882
|
}
|
|
1836
|
-
vbHeight={
|
|
1837
|
-
vbWidth={
|
|
1838
|
-
width={
|
|
1883
|
+
vbHeight={32}
|
|
1884
|
+
vbWidth={32}
|
|
1885
|
+
width={32}
|
|
1839
1886
|
>
|
|
1840
1887
|
<RNSVGGroup
|
|
1841
1888
|
fill={
|
|
1842
1889
|
{
|
|
1843
|
-
"payload":
|
|
1890
|
+
"payload": 4286216826,
|
|
1844
1891
|
"type": 0,
|
|
1845
1892
|
}
|
|
1846
1893
|
}
|
|
1894
|
+
propList={
|
|
1895
|
+
[
|
|
1896
|
+
"fill",
|
|
1897
|
+
]
|
|
1898
|
+
}
|
|
1847
1899
|
>
|
|
1848
1900
|
<RNSVGPath
|
|
1849
|
-
|
|
1850
|
-
d="M11.636 4H16l-2.91 5.818H16L10.546 20l1.09-7.273H8L11.636 4z"
|
|
1901
|
+
d="M14.8522 28H13.5188L14.8522 18.6667H10.1855C9.01218 18.6667 9.74551 17.6667 9.77218 17.6267C11.4922 14.5867 14.0788 10.0533 17.5322 4H18.8655L17.5322 13.3333H22.2122C22.7455 13.3333 23.0388 13.5867 22.7455 14.2133C17.4788 23.4 14.8522 28 14.8522 28Z"
|
|
1851
1902
|
fill={
|
|
1852
1903
|
{
|
|
1853
1904
|
"payload": 4286216826,
|
|
1854
1905
|
"type": 0,
|
|
1855
1906
|
}
|
|
1856
1907
|
}
|
|
1857
|
-
fillRule={0}
|
|
1858
1908
|
propList={
|
|
1859
1909
|
[
|
|
1860
1910
|
"fill",
|
|
1861
|
-
"fillRule",
|
|
1862
1911
|
]
|
|
1863
1912
|
}
|
|
1864
1913
|
/>
|
|
@@ -1914,7 +1963,7 @@ exports[`Thread should match thread snapshot 1`] = `
|
|
|
1914
1963
|
[
|
|
1915
1964
|
{
|
|
1916
1965
|
"flex": 1,
|
|
1917
|
-
"fontSize":
|
|
1966
|
+
"fontSize": 16,
|
|
1918
1967
|
"includeFontPadding": false,
|
|
1919
1968
|
"padding": 0,
|
|
1920
1969
|
"paddingTop": 0,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { LegacyRef } from 'react';
|
|
2
2
|
import React, { PropsWithChildren, useContext, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import
|
|
4
|
-
import { Alert, Keyboard } from 'react-native';
|
|
3
|
+
import { Alert, Keyboard, Linking, TextInput, TextInputProps } from 'react-native';
|
|
5
4
|
|
|
6
5
|
import uniq from 'lodash/uniq';
|
|
7
6
|
import { lookup } from 'mime-types';
|
|
@@ -47,11 +46,12 @@ import type { SendButtonProps } from '../../components/MessageInput/SendButton';
|
|
|
47
46
|
import type { UploadProgressIndicatorProps } from '../../components/MessageInput/UploadProgressIndicator';
|
|
48
47
|
import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
|
|
49
48
|
import type { Emoji } from '../../emoji-data';
|
|
50
|
-
import { pickDocument } from '../../native';
|
|
51
|
-
import
|
|
49
|
+
import { pickDocument, pickImage, takePhoto } from '../../native';
|
|
50
|
+
import {
|
|
52
51
|
Asset,
|
|
53
52
|
DefaultStreamChatGenerics,
|
|
54
53
|
File,
|
|
54
|
+
FileTypes,
|
|
55
55
|
FileUpload,
|
|
56
56
|
ImageUpload,
|
|
57
57
|
UnknownType,
|
|
@@ -159,6 +159,10 @@ export type LocalMessageInputContext<
|
|
|
159
159
|
openCommandsPicker: () => void;
|
|
160
160
|
openFilePicker: () => void;
|
|
161
161
|
openMentionsPicker: () => void;
|
|
162
|
+
/**
|
|
163
|
+
* Function for picking a photo from native image picker and uploading it.
|
|
164
|
+
*/
|
|
165
|
+
pickAndUploadImageFromNativePicker: () => Promise<void>;
|
|
162
166
|
pickFile: () => Promise<void>;
|
|
163
167
|
/**
|
|
164
168
|
* Function for removing a file from the upload preview
|
|
@@ -202,6 +206,10 @@ export type LocalMessageInputContext<
|
|
|
202
206
|
setShowMoreOptions: React.Dispatch<React.SetStateAction<boolean>>;
|
|
203
207
|
setText: React.Dispatch<React.SetStateAction<string>>;
|
|
204
208
|
showMoreOptions: boolean;
|
|
209
|
+
/**
|
|
210
|
+
* Function for taking a photo and uploading it
|
|
211
|
+
*/
|
|
212
|
+
takeAndUploadImage: () => Promise<void>;
|
|
205
213
|
text: string;
|
|
206
214
|
toggleAttachmentPicker: () => void;
|
|
207
215
|
/**
|
|
@@ -424,6 +432,11 @@ export type InputMessageInputContextValue<
|
|
|
424
432
|
*/
|
|
425
433
|
emojiSearchIndex?: EmojiSearchIndex;
|
|
426
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Handler for when the attach button is pressed.
|
|
437
|
+
*/
|
|
438
|
+
handleAttachButtonPress?: () => void;
|
|
439
|
+
|
|
427
440
|
/** Initial value to set on input */
|
|
428
441
|
initialValue?: string;
|
|
429
442
|
/**
|
|
@@ -536,7 +549,7 @@ export const MessageInputProvider = <
|
|
|
536
549
|
}>({});
|
|
537
550
|
const [giphyActive, setGiphyActive] = useState(false);
|
|
538
551
|
const [sendThreadMessageInChannel, setSendThreadMessageInChannel] = useState(false);
|
|
539
|
-
const { editing,
|
|
552
|
+
const { editing, initialValue } = value;
|
|
540
553
|
const {
|
|
541
554
|
fileUploads,
|
|
542
555
|
imageUploads,
|
|
@@ -626,21 +639,77 @@ export const MessageInputProvider = <
|
|
|
626
639
|
}
|
|
627
640
|
};
|
|
628
641
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
642
|
+
/**
|
|
643
|
+
* Function for capturing a photo and uploading it
|
|
644
|
+
*/
|
|
645
|
+
const takeAndUploadImage = async () => {
|
|
646
|
+
setSelectedPicker(undefined);
|
|
647
|
+
closePicker();
|
|
648
|
+
const photo = await takePhoto({ compressImageQuality: value.compressImageQuality });
|
|
649
|
+
if (photo.askToOpenSettings) {
|
|
650
|
+
Alert.alert(
|
|
651
|
+
t('Allow camera access in device settings'),
|
|
652
|
+
t('Device camera is used to take photos or videos.'),
|
|
653
|
+
[
|
|
654
|
+
{ style: 'cancel', text: t('Cancel') },
|
|
655
|
+
{ onPress: () => Linking.openSettings(), style: 'default', text: t('Open Settings') },
|
|
656
|
+
],
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
if (!photo.cancelled) {
|
|
660
|
+
setSelectedImages((images) => [...images, photo]);
|
|
636
661
|
}
|
|
637
662
|
};
|
|
638
663
|
|
|
664
|
+
/**
|
|
665
|
+
* Function for picking a photo from native image picker and uploading it
|
|
666
|
+
*/
|
|
667
|
+
const pickAndUploadImageFromNativePicker = async () => {
|
|
668
|
+
const result = await pickImage();
|
|
669
|
+
if (result.askToOpenSettings) {
|
|
670
|
+
Alert.alert(
|
|
671
|
+
t('Allow access to your Gallery'),
|
|
672
|
+
t('Device gallery permissions is used to take photos or videos.'),
|
|
673
|
+
[
|
|
674
|
+
{ style: 'cancel', text: t('Cancel') },
|
|
675
|
+
{ onPress: () => Linking.openSettings(), style: 'default', text: t('Open Settings') },
|
|
676
|
+
],
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
if (result.assets && result.assets.length > 0) {
|
|
680
|
+
result.assets.forEach((asset) => {
|
|
681
|
+
if (asset.type.includes('image')) {
|
|
682
|
+
setSelectedImages((prevImages) => [...prevImages, asset]);
|
|
683
|
+
} else {
|
|
684
|
+
setSelectedFiles((prevFiles) => [
|
|
685
|
+
...prevFiles,
|
|
686
|
+
{ ...asset, mimeType: asset.type, type: FileTypes.Video },
|
|
687
|
+
]);
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/**
|
|
694
|
+
* Function to open the attachment picker if the MediaLibary is installed.
|
|
695
|
+
*/
|
|
696
|
+
const openAttachmentPicker = () => {
|
|
697
|
+
Keyboard.dismiss();
|
|
698
|
+
setSelectedPicker('images');
|
|
699
|
+
openPicker();
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Function to close the attachment picker if the MediaLibrary is installed.
|
|
704
|
+
*/
|
|
639
705
|
const closeAttachmentPicker = () => {
|
|
640
706
|
setSelectedPicker(undefined);
|
|
641
707
|
closePicker();
|
|
642
708
|
};
|
|
643
709
|
|
|
710
|
+
/**
|
|
711
|
+
* Function to toggle the attachment picker if the MediaLibrary is installed.
|
|
712
|
+
*/
|
|
644
713
|
const toggleAttachmentPicker = () => {
|
|
645
714
|
if (selectedPicker) {
|
|
646
715
|
closeAttachmentPicker();
|
|
@@ -723,20 +792,20 @@ export const MessageInputProvider = <
|
|
|
723
792
|
original_height: image.height,
|
|
724
793
|
original_width: image.width,
|
|
725
794
|
originalImage: image.file,
|
|
726
|
-
type:
|
|
795
|
+
type: FileTypes.Image,
|
|
727
796
|
};
|
|
728
797
|
};
|
|
729
798
|
|
|
730
799
|
const mapFileUploadToAttachment = (file: FileUpload): Attachment<StreamChatGenerics> => {
|
|
731
|
-
if (file.type ===
|
|
800
|
+
if (file.type === FileTypes.Image) {
|
|
732
801
|
return {
|
|
733
802
|
fallback: file.file.name,
|
|
734
803
|
image_url: file.url,
|
|
735
804
|
mime_type: file.file.mimeType,
|
|
736
805
|
originalFile: file.file,
|
|
737
|
-
type:
|
|
806
|
+
type: FileTypes.Image,
|
|
738
807
|
};
|
|
739
|
-
} else if (file.type ===
|
|
808
|
+
} else if (file.type === FileTypes.Audio) {
|
|
740
809
|
return {
|
|
741
810
|
asset_url: file.url || file.file.uri,
|
|
742
811
|
duration: file.file.duration,
|
|
@@ -744,9 +813,9 @@ export const MessageInputProvider = <
|
|
|
744
813
|
mime_type: file.file.mimeType,
|
|
745
814
|
originalFile: file.file,
|
|
746
815
|
title: file.file.name,
|
|
747
|
-
type:
|
|
816
|
+
type: FileTypes.Audio,
|
|
748
817
|
};
|
|
749
|
-
} else if (file.type ===
|
|
818
|
+
} else if (file.type === FileTypes.Video) {
|
|
750
819
|
return {
|
|
751
820
|
asset_url: file.url || file.file.uri,
|
|
752
821
|
duration: file.file.duration,
|
|
@@ -755,9 +824,9 @@ export const MessageInputProvider = <
|
|
|
755
824
|
originalFile: file.file,
|
|
756
825
|
thumb_url: file.thumb_url,
|
|
757
826
|
title: file.file.name,
|
|
758
|
-
type:
|
|
827
|
+
type: FileTypes.Video,
|
|
759
828
|
};
|
|
760
|
-
} else if (file.type ===
|
|
829
|
+
} else if (file.type === FileTypes.VoiceRecording) {
|
|
761
830
|
return {
|
|
762
831
|
asset_url: file.url || file.file.uri,
|
|
763
832
|
duration: file.file.duration,
|
|
@@ -765,7 +834,7 @@ export const MessageInputProvider = <
|
|
|
765
834
|
mime_type: file.file.mimeType,
|
|
766
835
|
originalFile: file.file,
|
|
767
836
|
title: file.file.name,
|
|
768
|
-
type:
|
|
837
|
+
type: FileTypes.VoiceRecording,
|
|
769
838
|
waveform_data: file.file.waveform_data,
|
|
770
839
|
};
|
|
771
840
|
} else {
|
|
@@ -775,7 +844,7 @@ export const MessageInputProvider = <
|
|
|
775
844
|
mime_type: file.file.mimeType,
|
|
776
845
|
originalFile: file.file,
|
|
777
846
|
title: file.file.name,
|
|
778
|
-
type:
|
|
847
|
+
type: FileTypes.File,
|
|
779
848
|
};
|
|
780
849
|
}
|
|
781
850
|
};
|
|
@@ -940,7 +1009,7 @@ export const MessageInputProvider = <
|
|
|
940
1009
|
const attachments = [
|
|
941
1010
|
{
|
|
942
1011
|
image_url: image.url,
|
|
943
|
-
type:
|
|
1012
|
+
type: FileTypes.Image,
|
|
944
1013
|
},
|
|
945
1014
|
] as StreamMessage<StreamChatGenerics>['attachments'];
|
|
946
1015
|
|
|
@@ -1287,6 +1356,7 @@ export const MessageInputProvider = <
|
|
|
1287
1356
|
openCommandsPicker,
|
|
1288
1357
|
openFilePicker: pickFile,
|
|
1289
1358
|
openMentionsPicker,
|
|
1359
|
+
pickAndUploadImageFromNativePicker,
|
|
1290
1360
|
pickFile,
|
|
1291
1361
|
removeFile,
|
|
1292
1362
|
removeImage,
|
|
@@ -1307,6 +1377,7 @@ export const MessageInputProvider = <
|
|
|
1307
1377
|
setShowMoreOptions,
|
|
1308
1378
|
setText,
|
|
1309
1379
|
showMoreOptions,
|
|
1380
|
+
takeAndUploadImage,
|
|
1310
1381
|
text,
|
|
1311
1382
|
thread,
|
|
1312
1383
|
toggleAttachmentPicker,
|
|
@@ -7,15 +7,11 @@ import type { AppSettingsAPIResponse, StreamChat } from 'stream-chat';
|
|
|
7
7
|
|
|
8
8
|
import { ChatContextValue, ChatProvider } from '../../../contexts/chatContext/ChatContext';
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
generateFileAttachment,
|
|
12
|
-
generateImageAttachment,
|
|
13
|
-
} from '../../../mock-builders/generator/attachment';
|
|
10
|
+
import { generateImageAttachment } from '../../../mock-builders/generator/attachment';
|
|
14
11
|
|
|
15
12
|
import { generateMessage } from '../../../mock-builders/generator/message';
|
|
16
13
|
import { generateUser } from '../../../mock-builders/generator/user';
|
|
17
14
|
|
|
18
|
-
import * as NativeUtils from '../../../native';
|
|
19
15
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
20
16
|
import { FileState } from '../../../utils/utils';
|
|
21
17
|
import {
|
|
@@ -235,37 +231,4 @@ describe('MessageInputContext', () => {
|
|
|
235
231
|
expect(result.current.text).toBe(`${initialProps.editing.text}@`);
|
|
236
232
|
});
|
|
237
233
|
});
|
|
238
|
-
|
|
239
|
-
it('openAttachmentPicker works', async () => {
|
|
240
|
-
jest.spyOn(NativeUtils, 'pickDocument').mockImplementation(
|
|
241
|
-
jest.fn().mockResolvedValue({
|
|
242
|
-
cancelled: false,
|
|
243
|
-
docs: [generateFileAttachment(), generateImageAttachment()],
|
|
244
|
-
}),
|
|
245
|
-
);
|
|
246
|
-
const initialProps = {
|
|
247
|
-
editing: message,
|
|
248
|
-
hasFilePicker: true,
|
|
249
|
-
hasImagePicker: false,
|
|
250
|
-
};
|
|
251
|
-
const { result } = renderHook(() => useMessageInputContext(), {
|
|
252
|
-
initialProps,
|
|
253
|
-
wrapper: (props) => (
|
|
254
|
-
<Wrapper
|
|
255
|
-
editing={initialProps.editing}
|
|
256
|
-
hasFilePicker={initialProps.hasFilePicker}
|
|
257
|
-
hasImagePicker={initialProps.hasImagePicker}
|
|
258
|
-
{...props}
|
|
259
|
-
/>
|
|
260
|
-
),
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
act(() => {
|
|
264
|
-
result.current.openAttachmentPicker();
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
await waitFor(async () => {
|
|
268
|
-
expect(await result.current.pickFile()).toBe(undefined);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
234
|
});
|
|
@@ -39,6 +39,7 @@ export const useCreateMessageInputContext = <
|
|
|
39
39
|
FileUploadPreview,
|
|
40
40
|
fileUploads,
|
|
41
41
|
giphyActive,
|
|
42
|
+
handleAttachButtonPress,
|
|
42
43
|
hasCameraPicker,
|
|
43
44
|
hasCommands,
|
|
44
45
|
hasFilePicker,
|
|
@@ -68,7 +69,7 @@ export const useCreateMessageInputContext = <
|
|
|
68
69
|
openCommandsPicker,
|
|
69
70
|
openFilePicker,
|
|
70
71
|
openMentionsPicker,
|
|
71
|
-
|
|
72
|
+
pickAndUploadImageFromNativePicker,
|
|
72
73
|
pickFile,
|
|
73
74
|
quotedMessage,
|
|
74
75
|
removeFile,
|
|
@@ -98,6 +99,7 @@ export const useCreateMessageInputContext = <
|
|
|
98
99
|
showMoreOptions,
|
|
99
100
|
ShowThreadMessageInChannelButton,
|
|
100
101
|
StartAudioRecordingButton,
|
|
102
|
+
takeAndUploadImage,
|
|
101
103
|
text,
|
|
102
104
|
thread,
|
|
103
105
|
toggleAttachmentPicker,
|
|
@@ -159,6 +161,7 @@ export const useCreateMessageInputContext = <
|
|
|
159
161
|
FileUploadPreview,
|
|
160
162
|
fileUploads,
|
|
161
163
|
giphyActive,
|
|
164
|
+
handleAttachButtonPress,
|
|
162
165
|
hasCameraPicker,
|
|
163
166
|
hasCommands,
|
|
164
167
|
hasFilePicker,
|
|
@@ -188,6 +191,7 @@ export const useCreateMessageInputContext = <
|
|
|
188
191
|
openCommandsPicker,
|
|
189
192
|
openFilePicker,
|
|
190
193
|
openMentionsPicker,
|
|
194
|
+
pickAndUploadImageFromNativePicker,
|
|
191
195
|
pickFile,
|
|
192
196
|
quotedMessage,
|
|
193
197
|
removeFile,
|
|
@@ -217,6 +221,7 @@ export const useCreateMessageInputContext = <
|
|
|
217
221
|
showMoreOptions,
|
|
218
222
|
ShowThreadMessageInChannelButton,
|
|
219
223
|
StartAudioRecordingButton,
|
|
224
|
+
takeAndUploadImage,
|
|
220
225
|
text,
|
|
221
226
|
toggleAttachmentPicker,
|
|
222
227
|
triggerSettings,
|
|
@@ -2,7 +2,12 @@ import { useEffect, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Attachment } from 'stream-chat';
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import {
|
|
6
|
+
DefaultStreamChatGenerics,
|
|
7
|
+
FileTypes,
|
|
8
|
+
FileUpload,
|
|
9
|
+
ImageUpload,
|
|
10
|
+
} from '../../../types/types';
|
|
6
11
|
import { generateRandomId } from '../../../utils/utils';
|
|
7
12
|
|
|
8
13
|
import type { MessageInputContextValue } from '../MessageInputContext';
|
|
@@ -44,7 +49,7 @@ export const useMessageDetailsForState = <
|
|
|
44
49
|
const mapAttachmentToFileUpload = (attachment: Attachment<StreamChatGenerics>): FileUpload => {
|
|
45
50
|
const id = generateRandomId();
|
|
46
51
|
|
|
47
|
-
if (attachment.type ===
|
|
52
|
+
if (attachment.type === FileTypes.Audio) {
|
|
48
53
|
return {
|
|
49
54
|
file: {
|
|
50
55
|
duration: attachment.duration,
|
|
@@ -57,7 +62,7 @@ export const useMessageDetailsForState = <
|
|
|
57
62
|
state: 'finished',
|
|
58
63
|
url: attachment.asset_url,
|
|
59
64
|
};
|
|
60
|
-
} else if (attachment.type ===
|
|
65
|
+
} else if (attachment.type === FileTypes.Video) {
|
|
61
66
|
return {
|
|
62
67
|
file: {
|
|
63
68
|
mimeType: attachment.mime_type,
|
|
@@ -69,7 +74,7 @@ export const useMessageDetailsForState = <
|
|
|
69
74
|
thumb_url: attachment.thumb_url,
|
|
70
75
|
url: attachment.asset_url,
|
|
71
76
|
};
|
|
72
|
-
} else if (attachment.type ===
|
|
77
|
+
} else if (attachment.type === FileTypes.VoiceRecording) {
|
|
73
78
|
return {
|
|
74
79
|
file: {
|
|
75
80
|
duration: attachment.duration,
|
|
@@ -83,7 +88,7 @@ export const useMessageDetailsForState = <
|
|
|
83
88
|
state: 'finished',
|
|
84
89
|
url: attachment.asset_url,
|
|
85
90
|
};
|
|
86
|
-
} else if (attachment.type ===
|
|
91
|
+
} else if (attachment.type === FileTypes.File) {
|
|
87
92
|
return {
|
|
88
93
|
file: {
|
|
89
94
|
mimeType: attachment.mime_type,
|
|
@@ -117,7 +122,7 @@ export const useMessageDetailsForState = <
|
|
|
117
122
|
const attachments = Array.isArray(message.attachments) ? message.attachments : [];
|
|
118
123
|
|
|
119
124
|
for (const attachment of attachments) {
|
|
120
|
-
if (attachment.type ===
|
|
125
|
+
if (attachment.type === FileTypes.Image) {
|
|
121
126
|
const id = generateRandomId();
|
|
122
127
|
newImageUploads.push({
|
|
123
128
|
file: {
|
|
@@ -30,6 +30,7 @@ import { OverlayBackdrop } from '../../components/MessageOverlay/OverlayBackdrop
|
|
|
30
30
|
import { useStreami18n } from '../../hooks/useStreami18n';
|
|
31
31
|
|
|
32
32
|
import { useViewport } from '../../hooks/useViewport';
|
|
33
|
+
import { isImageMediaLibraryAvailable } from '../../native';
|
|
33
34
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
34
35
|
import { AttachmentPickerProvider } from '../attachmentPickerContext/AttachmentPickerContext';
|
|
35
36
|
import { ImageGalleryProvider } from '../imageGalleryContext/ImageGalleryContext';
|
|
@@ -253,7 +254,9 @@ export const OverlayProvider = <
|
|
|
253
254
|
overlayOpacity={overlayOpacity}
|
|
254
255
|
/>
|
|
255
256
|
)}
|
|
256
|
-
|
|
257
|
+
{isImageMediaLibraryAvailable() ? (
|
|
258
|
+
<AttachmentPicker ref={bottomSheetRef} {...attachmentPickerProps} />
|
|
259
|
+
) : null}
|
|
257
260
|
</ThemeProvider>
|
|
258
261
|
</ImageGalleryProvider>
|
|
259
262
|
</AttachmentPickerProvider>
|
|
@@ -318,6 +318,11 @@ export type Theme = {
|
|
|
318
318
|
inputBoxContainer: ViewStyle;
|
|
319
319
|
micButtonContainer: ViewStyle;
|
|
320
320
|
moreOptionsButton: ViewStyle;
|
|
321
|
+
nativeAttachmentPicker: {
|
|
322
|
+
buttonContainer: ViewStyle;
|
|
323
|
+
buttonDimmerStyle: ViewStyle;
|
|
324
|
+
container: ViewStyle;
|
|
325
|
+
};
|
|
321
326
|
optionsContainer: ViewStyle;
|
|
322
327
|
replyContainer: ViewStyle;
|
|
323
328
|
searchIcon: IconProps;
|
|
@@ -885,6 +890,11 @@ export const defaultTheme: Theme = {
|
|
|
885
890
|
inputBoxContainer: {},
|
|
886
891
|
micButtonContainer: {},
|
|
887
892
|
moreOptionsButton: {},
|
|
893
|
+
nativeAttachmentPicker: {
|
|
894
|
+
buttonContainer: {},
|
|
895
|
+
buttonDimmerStyle: {},
|
|
896
|
+
container: {},
|
|
897
|
+
},
|
|
888
898
|
optionsContainer: {},
|
|
889
899
|
replyContainer: {},
|
|
890
900
|
searchIcon: {},
|
package/src/i18n/en.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"Delete": "Delete",
|
|
15
15
|
"Delete Message": "Delete Message",
|
|
16
16
|
"Device camera is used to take photos or videos.": "Device camera is used to take photos or videos.",
|
|
17
|
+
"Device gallery permissions is used to take photos or videos.": "Device gallery permissions is used to take photos or videos.",
|
|
17
18
|
"Do you want to send a copy of this message to a moderator for further investigation?": "Do you want to send a copy of this message to a moderator for further investigation?",
|
|
18
19
|
"Edit Message": "Edit Message",
|
|
19
20
|
"Edited": "Edited",
|
package/src/i18n/es.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"Delete": "Eliminar",
|
|
15
15
|
"Delete Message": "Eliminar mensaje",
|
|
16
16
|
"Device camera is used to take photos or videos.": "La cámara del dispositivo se utiliza para tomar fotografías o vídeos.",
|
|
17
|
+
"Device gallery permissions is used to take photos or videos.": "Los permisos de la galería del dispositivo se utilizan para tomar fotos o videos.",
|
|
17
18
|
"Do you want to send a copy of this message to a moderator for further investigation?": "¿Deseas enviar una copia de este mensaje a un moderador para una investigación adicional?",
|
|
18
19
|
"Edit Message": "Editar mensaje",
|
|
19
20
|
"Edited": "Editado",
|
package/src/i18n/fr.json
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"Delete": "Supprimer",
|
|
15
15
|
"Delete Message": "Supprimer un message",
|
|
16
16
|
"Device camera is used to take photos or videos.": "L'appareil photo de l'appareil est utilisé pour prendre des photos ou des vidéos.",
|
|
17
|
+
"Device gallery permissions is used to take photos or videos.": "Les autorisations de la galerie de l'appareil sont utilisées pour prendre des photos ou des vidéos.",
|
|
17
18
|
"Do you want to send a copy of this message to a moderator for further investigation?": "Voulez-vous envoyer une copie de ce message à un modérateur pour une enquête plus approfondie?",
|
|
18
19
|
"Edit Message": "Éditer un message",
|
|
19
20
|
"Edited": "Édité",
|