stream-chat-react-native-core 5.28.1 → 5.29.0
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 +2 -2
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/AudioAttachment.js +247 -115
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +30 -50
- package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +3 -3
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +43 -1
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +1 -1
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useMessageActions.js +4 -2
- package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +55 -74
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
- package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +250 -43
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/SendButton.js +9 -7
- package/lib/commonjs/components/MessageInput/SendButton.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
- package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +452 -0
- package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -0
- package/lib/commonjs/components/MessageInput/utils/audioSampling.js +91 -0
- package/lib/commonjs/components/MessageInput/utils/audioSampling.js.map +1 -0
- package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
- package/lib/commonjs/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
- package/lib/commonjs/components/ProgressControl/ProgressControl.js +57 -40
- package/lib/commonjs/components/ProgressControl/ProgressControl.js.map +1 -1
- package/lib/commonjs/components/ProgressControl/WaveProgressBar.js +162 -0
- package/lib/commonjs/components/ProgressControl/WaveProgressBar.js.map +1 -0
- package/lib/commonjs/components/Reply/Reply.js +45 -20
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/index.js +66 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +23 -12
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +62 -7
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +2 -0
- package/lib/commonjs/i18n/es.json +2 -0
- package/lib/commonjs/i18n/fr.json +2 -0
- package/lib/commonjs/i18n/he.json +2 -0
- package/lib/commonjs/i18n/hi.json +2 -0
- package/lib/commonjs/i18n/it.json +2 -0
- package/lib/commonjs/i18n/ja.json +2 -0
- package/lib/commonjs/i18n/ko.json +2 -0
- package/lib/commonjs/i18n/nl.json +2 -0
- package/lib/commonjs/i18n/pt-BR.json +2 -0
- package/lib/commonjs/i18n/ru.json +2 -0
- package/lib/commonjs/i18n/tr.json +2 -0
- package/lib/commonjs/icons/ArrowLeft.js +27 -0
- package/lib/commonjs/icons/ArrowLeft.js.map +1 -0
- package/lib/commonjs/icons/ArrowUp.js +26 -0
- package/lib/commonjs/icons/ArrowUp.js.map +1 -0
- package/lib/commonjs/icons/Audio.js +24 -24
- package/lib/commonjs/icons/Audio.js.map +1 -1
- package/lib/commonjs/icons/CircleStop.js +27 -0
- package/lib/commonjs/icons/CircleStop.js.map +1 -0
- package/lib/commonjs/icons/Delete.js +17 -6
- package/lib/commonjs/icons/Delete.js.map +1 -1
- package/lib/commonjs/icons/Lock.js +30 -0
- package/lib/commonjs/icons/Lock.js.map +1 -0
- package/lib/commonjs/icons/Mic.js +30 -0
- package/lib/commonjs/icons/Mic.js.map +1 -0
- package/lib/commonjs/icons/Pause.js +15 -20
- package/lib/commonjs/icons/Pause.js.map +1 -1
- package/lib/commonjs/icons/Play.js +18 -10
- package/lib/commonjs/icons/Play.js.map +1 -1
- package/lib/commonjs/icons/SendCheck.js +30 -0
- package/lib/commonjs/icons/SendCheck.js.map +1 -0
- package/lib/commonjs/icons/SendRight.js +24 -6
- package/lib/commonjs/icons/SendRight.js.map +1 -1
- package/lib/commonjs/icons/SendUp.js +24 -6
- package/lib/commonjs/icons/SendUp.js.map +1 -1
- package/lib/commonjs/icons/Stop.js +19 -0
- package/lib/commonjs/icons/Stop.js.map +1 -0
- package/lib/commonjs/icons/index.js +77 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/native.js +10 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js +11 -0
- package/lib/commonjs/utils/getTrimmedAttachmentTitle.js.map +1 -0
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +2 -2
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +247 -115
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachmentGroup.js +30 -50
- package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +3 -3
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +43 -1
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +24 -0
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/module/components/Message/Message.js +1 -1
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
- package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
- package/lib/module/components/Message/hooks/useMessageActions.js +4 -2
- package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +55 -74
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/InputButtons.js +1 -1
- package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +250 -43
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/SendButton.js +9 -7
- package/lib/module/components/MessageInput/SendButton.js.map +1 -1
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js +221 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecorder.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +121 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js +68 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js +75 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js +87 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.js.map +1 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js +47 -0
- package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.js.map +1 -0
- package/lib/module/components/MessageInput/hooks/useAudioController.js +452 -0
- package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -0
- package/lib/module/components/MessageInput/utils/audioSampling.js +91 -0
- package/lib/module/components/MessageInput/utils/audioSampling.js.map +1 -0
- package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js +18 -0
- package/lib/module/components/MessageInput/utils/normalizeAudioLevel.js.map +1 -0
- package/lib/module/components/ProgressControl/ProgressControl.js +57 -40
- package/lib/module/components/ProgressControl/ProgressControl.js.map +1 -1
- package/lib/module/components/ProgressControl/WaveProgressBar.js +162 -0
- package/lib/module/components/ProgressControl/WaveProgressBar.js.map +1 -0
- package/lib/module/components/Reply/Reply.js +45 -20
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/index.js +66 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +23 -12
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +24 -0
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +76 -28
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +62 -7
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +2 -0
- package/lib/module/i18n/es.json +2 -0
- package/lib/module/i18n/fr.json +2 -0
- package/lib/module/i18n/he.json +2 -0
- package/lib/module/i18n/hi.json +2 -0
- package/lib/module/i18n/it.json +2 -0
- package/lib/module/i18n/ja.json +2 -0
- package/lib/module/i18n/ko.json +2 -0
- package/lib/module/i18n/nl.json +2 -0
- package/lib/module/i18n/pt-BR.json +2 -0
- package/lib/module/i18n/ru.json +2 -0
- package/lib/module/i18n/tr.json +2 -0
- package/lib/module/icons/ArrowLeft.js +27 -0
- package/lib/module/icons/ArrowLeft.js.map +1 -0
- package/lib/module/icons/ArrowUp.js +26 -0
- package/lib/module/icons/ArrowUp.js.map +1 -0
- package/lib/module/icons/Audio.js +24 -24
- package/lib/module/icons/Audio.js.map +1 -1
- package/lib/module/icons/CircleStop.js +27 -0
- package/lib/module/icons/CircleStop.js.map +1 -0
- package/lib/module/icons/Delete.js +17 -6
- package/lib/module/icons/Delete.js.map +1 -1
- package/lib/module/icons/Lock.js +30 -0
- package/lib/module/icons/Lock.js.map +1 -0
- package/lib/module/icons/Mic.js +30 -0
- package/lib/module/icons/Mic.js.map +1 -0
- package/lib/module/icons/Pause.js +15 -20
- package/lib/module/icons/Pause.js.map +1 -1
- package/lib/module/icons/Play.js +18 -10
- package/lib/module/icons/Play.js.map +1 -1
- package/lib/module/icons/SendCheck.js +30 -0
- package/lib/module/icons/SendCheck.js.map +1 -0
- package/lib/module/icons/SendRight.js +24 -6
- package/lib/module/icons/SendRight.js.map +1 -1
- package/lib/module/icons/SendUp.js +24 -6
- package/lib/module/icons/SendUp.js.map +1 -1
- package/lib/module/icons/Stop.js +19 -0
- package/lib/module/icons/Stop.js.map +1 -0
- package/lib/module/icons/index.js +77 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/native.js +10 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/utils/getTrimmedAttachmentTitle.js +11 -0
- package/lib/module/utils/getTrimmedAttachmentTitle.js.map +1 -0
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +3 -8
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
- package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +15 -3
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +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/SendButton.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts +51 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecorder.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts +43 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingButton.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts +29 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts +22 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts +31 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts +19 -0
- package/lib/typescript/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts +28 -0
- package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts +11 -0
- package/lib/typescript/components/MessageInput/utils/audioSampling.d.ts.map +1 -0
- package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts +5 -0
- package/lib/typescript/components/MessageInput/utils/normalizeAudioLevel.d.ts.map +1 -0
- package/lib/typescript/components/ProgressControl/ProgressControl.d.ts +2 -2
- package/lib/typescript/components/ProgressControl/ProgressControl.d.ts.map +1 -1
- package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts +11 -0
- package/lib/typescript/components/ProgressControl/WaveProgressBar.d.ts.map +1 -0
- package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +6 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +70 -4
- 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.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +62 -7
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +2 -0
- package/lib/typescript/i18n/es.json +2 -0
- package/lib/typescript/i18n/fr.json +2 -0
- package/lib/typescript/i18n/he.json +2 -0
- package/lib/typescript/i18n/hi.json +2 -0
- package/lib/typescript/i18n/it.json +2 -0
- package/lib/typescript/i18n/ja.json +2 -0
- package/lib/typescript/i18n/ko.json +2 -0
- package/lib/typescript/i18n/nl.json +2 -0
- package/lib/typescript/i18n/pt-BR.json +2 -0
- package/lib/typescript/i18n/ru.json +2 -0
- package/lib/typescript/i18n/tr.json +2 -0
- package/lib/typescript/icons/ArrowLeft.d.ts +8 -0
- package/lib/typescript/icons/ArrowLeft.d.ts.map +1 -0
- package/lib/typescript/icons/ArrowUp.d.ts +9 -0
- package/lib/typescript/icons/ArrowUp.d.ts.map +1 -0
- package/lib/typescript/icons/Audio.d.ts.map +1 -1
- package/lib/typescript/icons/CircleStop.d.ts +8 -0
- package/lib/typescript/icons/CircleStop.d.ts.map +1 -0
- package/lib/typescript/icons/Delete.d.ts +5 -1
- package/lib/typescript/icons/Delete.d.ts.map +1 -1
- package/lib/typescript/icons/Lock.d.ts +9 -0
- package/lib/typescript/icons/Lock.d.ts.map +1 -0
- package/lib/typescript/icons/Mic.d.ts +8 -0
- package/lib/typescript/icons/Mic.d.ts.map +1 -0
- package/lib/typescript/icons/Pause.d.ts +3 -1
- package/lib/typescript/icons/Pause.d.ts.map +1 -1
- package/lib/typescript/icons/Play.d.ts +3 -1
- package/lib/typescript/icons/Play.d.ts.map +1 -1
- package/lib/typescript/icons/SendCheck.d.ts +8 -0
- package/lib/typescript/icons/SendCheck.d.ts.map +1 -0
- package/lib/typescript/icons/SendRight.d.ts +5 -1
- package/lib/typescript/icons/SendRight.d.ts.map +1 -1
- package/lib/typescript/icons/SendUp.d.ts +5 -1
- package/lib/typescript/icons/SendUp.d.ts.map +1 -1
- package/lib/typescript/icons/Stop.d.ts +4 -0
- package/lib/typescript/icons/Stop.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +7 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/native.d.ts +49 -0
- package/lib/typescript/native.d.ts.map +1 -1
- package/lib/typescript/types/types.d.ts +6 -0
- package/lib/typescript/types/types.d.ts.map +1 -1
- package/lib/typescript/utils/Streami18n.d.ts +2 -0
- package/lib/typescript/utils/Streami18n.d.ts.map +1 -1
- package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts +2 -0
- package/lib/typescript/utils/getTrimmedAttachmentTitle.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +7 -2
- package/src/components/Attachment/AudioAttachment.tsx +223 -119
- package/src/components/Attachment/FileAttachmentGroup.tsx +35 -55
- package/src/components/Attachment/VideoThumbnail.tsx +1 -1
- package/src/components/Channel/Channel.tsx +32 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +24 -0
- package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +1 -1
- package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +2 -7
- package/src/components/Message/Message.tsx +1 -1
- package/src/components/Message/MessageSimple/MessageContent.tsx +2 -1
- package/src/components/Message/MessageSimple/MessageSimple.tsx +2 -1
- package/src/components/Message/hooks/useMessageActions.tsx +2 -2
- package/src/components/MessageInput/FileUploadPreview.tsx +67 -98
- package/src/components/MessageInput/InputButtons.tsx +2 -1
- package/src/components/MessageInput/MessageInput.tsx +320 -49
- package/src/components/MessageInput/SendButton.tsx +7 -3
- package/src/components/MessageInput/__tests__/MessageInput.test.js +0 -1
- package/src/components/MessageInput/__tests__/__snapshots__/SendButton.test.js.snap +132 -48
- package/src/components/MessageInput/components/AudioRecorder/AudioRecorder.tsx +313 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +192 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingInProgress.tsx +114 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingLockIndicator.tsx +85 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingPreview.tsx +102 -0
- package/src/components/MessageInput/components/AudioRecorder/AudioRecordingWaveform.tsx +62 -0
- package/src/components/MessageInput/hooks/useAudioController.tsx +288 -0
- package/src/components/MessageInput/utils/audioSampling.ts +108 -0
- package/src/components/MessageInput/utils/normalizeAudioLevel.ts +20 -0
- package/src/components/ProgressControl/ProgressControl.tsx +69 -40
- package/src/components/ProgressControl/WaveProgressBar.tsx +180 -0
- package/src/components/Reply/Reply.tsx +89 -56
- package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +38 -20
- package/src/components/index.ts +6 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +95 -10
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +25 -0
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +80 -27
- package/src/contexts/themeContext/utils/theme.ts +111 -14
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +2 -0
- package/src/i18n/fr.json +2 -0
- package/src/i18n/he.json +2 -0
- package/src/i18n/hi.json +2 -0
- package/src/i18n/it.json +2 -0
- package/src/i18n/ja.json +2 -0
- package/src/i18n/ko.json +2 -0
- package/src/i18n/nl.json +2 -0
- package/src/i18n/pt-BR.json +2 -0
- package/src/i18n/ru.json +2 -0
- package/src/i18n/tr.json +2 -0
- package/src/icons/ArrowLeft.tsx +18 -0
- package/src/icons/ArrowUp.tsx +19 -0
- package/src/icons/Audio.tsx +24 -24
- package/src/icons/CircleStop.tsx +18 -0
- package/src/icons/Delete.tsx +14 -8
- package/src/icons/Lock.tsx +22 -0
- package/src/icons/Mic.tsx +20 -0
- package/src/icons/Pause.tsx +12 -11
- package/src/icons/Play.tsx +9 -13
- package/src/icons/SendCheck.tsx +18 -0
- package/src/icons/SendRight.tsx +16 -7
- package/src/icons/SendUp.tsx +16 -7
- package/src/icons/Stop.tsx +12 -0
- package/src/icons/index.ts +7 -0
- package/src/native.ts +69 -0
- package/src/types/types.ts +6 -0
- package/src/utils/getTrimmedAttachmentTitle.ts +5 -0
- package/src/version.json +1 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Alert, Linking, Pressable, StyleSheet } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ChannelContextValue,
|
|
6
|
+
useChannelContext,
|
|
7
|
+
} from '../../../../contexts/channelContext/ChannelContext';
|
|
8
|
+
import {
|
|
9
|
+
MessageInputContextValue,
|
|
10
|
+
useMessageInputContext,
|
|
11
|
+
} from '../../../../contexts/messageInputContext/MessageInputContext';
|
|
12
|
+
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
|
|
13
|
+
import { useTranslationContext } from '../../../../contexts/translationContext/TranslationContext';
|
|
14
|
+
import { Mic } from '../../../../icons/Mic';
|
|
15
|
+
import { AudioRecordingReturnType, triggerHaptic } from '../../../../native';
|
|
16
|
+
|
|
17
|
+
import type { DefaultStreamChatGenerics } from '../../../../types/types';
|
|
18
|
+
|
|
19
|
+
type AudioRecordingButtonPropsWithContext<
|
|
20
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
21
|
+
> = Pick<ChannelContextValue<StreamChatGenerics>, 'disabled'> &
|
|
22
|
+
Pick<MessageInputContextValue<StreamChatGenerics>, 'asyncMessagesMinimumPressDuration'> & {
|
|
23
|
+
/**
|
|
24
|
+
* The current voice recording that is in progress.
|
|
25
|
+
*/
|
|
26
|
+
recording: AudioRecordingReturnType;
|
|
27
|
+
/**
|
|
28
|
+
* Size of the mic button.
|
|
29
|
+
*/
|
|
30
|
+
buttonSize?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Handler to determine what should happen on long press of the mic button.
|
|
33
|
+
*/
|
|
34
|
+
handleLongPress?: () => void;
|
|
35
|
+
/**
|
|
36
|
+
* Handler to determine what should happen on press of the mic button.
|
|
37
|
+
*/
|
|
38
|
+
handlePress?: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Boolean to determine if the audio recording permissions are granted.
|
|
41
|
+
*/
|
|
42
|
+
permissionsGranted?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Function to start the voice recording.
|
|
45
|
+
*/
|
|
46
|
+
startVoiceRecording?: () => Promise<void>;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const AudioRecordingButtonWithContext = <
|
|
50
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
51
|
+
>(
|
|
52
|
+
props: AudioRecordingButtonPropsWithContext<StreamChatGenerics>,
|
|
53
|
+
) => {
|
|
54
|
+
const {
|
|
55
|
+
asyncMessagesMinimumPressDuration,
|
|
56
|
+
buttonSize,
|
|
57
|
+
disabled,
|
|
58
|
+
handleLongPress,
|
|
59
|
+
handlePress,
|
|
60
|
+
permissionsGranted,
|
|
61
|
+
recording,
|
|
62
|
+
startVoiceRecording,
|
|
63
|
+
} = props;
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
theme: {
|
|
67
|
+
colors: { grey, light_gray, white },
|
|
68
|
+
messageInput: {
|
|
69
|
+
audioRecordingButton: { container, micIcon },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
} = useTheme();
|
|
73
|
+
const { t } = useTranslationContext();
|
|
74
|
+
|
|
75
|
+
const onPressHandler = () => {
|
|
76
|
+
if (handlePress) {
|
|
77
|
+
handlePress();
|
|
78
|
+
}
|
|
79
|
+
if (!recording) {
|
|
80
|
+
triggerHaptic('notificationError');
|
|
81
|
+
Alert.alert(t('Hold to start recording.'));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const onLongPressHandler = () => {
|
|
86
|
+
if (handleLongPress) {
|
|
87
|
+
handleLongPress();
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!recording) {
|
|
91
|
+
triggerHaptic('impactHeavy');
|
|
92
|
+
if (!permissionsGranted) {
|
|
93
|
+
Alert.alert(t('Please allow Audio permissions in settings.'), '', [
|
|
94
|
+
{
|
|
95
|
+
onPress: () => {
|
|
96
|
+
Linking.openSettings();
|
|
97
|
+
},
|
|
98
|
+
text: t('Open Settings'),
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (startVoiceRecording) startVoiceRecording();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Pressable
|
|
109
|
+
delayLongPress={asyncMessagesMinimumPressDuration}
|
|
110
|
+
disabled={disabled}
|
|
111
|
+
onLongPress={onLongPressHandler}
|
|
112
|
+
onPress={onPressHandler}
|
|
113
|
+
style={({ pressed }) => [
|
|
114
|
+
styles.container,
|
|
115
|
+
{
|
|
116
|
+
backgroundColor: pressed ? light_gray : white,
|
|
117
|
+
height: buttonSize || 40,
|
|
118
|
+
width: buttonSize || 40,
|
|
119
|
+
},
|
|
120
|
+
container,
|
|
121
|
+
]}
|
|
122
|
+
testID='audio-button'
|
|
123
|
+
>
|
|
124
|
+
<Mic fill={grey} size={32} {...micIcon} />
|
|
125
|
+
</Pressable>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
|
|
130
|
+
prevProps: AudioRecordingButtonPropsWithContext<StreamChatGenerics>,
|
|
131
|
+
nextProps: AudioRecordingButtonPropsWithContext<StreamChatGenerics>,
|
|
132
|
+
) => {
|
|
133
|
+
const {
|
|
134
|
+
asyncMessagesMinimumPressDuration: prevAsyncMessagesMinimumPressDuration,
|
|
135
|
+
disabled: prevDisabled,
|
|
136
|
+
recording: prevRecording,
|
|
137
|
+
} = prevProps;
|
|
138
|
+
const {
|
|
139
|
+
asyncMessagesMinimumPressDuration: nextAsyncMessagesMinimumPressDuration,
|
|
140
|
+
disabled: nextDisabled,
|
|
141
|
+
recording: nextRecording,
|
|
142
|
+
} = nextProps;
|
|
143
|
+
|
|
144
|
+
const asyncMessagesMinimumPressDurationEqual =
|
|
145
|
+
prevAsyncMessagesMinimumPressDuration === nextAsyncMessagesMinimumPressDuration;
|
|
146
|
+
if (!asyncMessagesMinimumPressDurationEqual) return false;
|
|
147
|
+
|
|
148
|
+
const disabledEqual = prevDisabled === nextDisabled;
|
|
149
|
+
if (!disabledEqual) return false;
|
|
150
|
+
|
|
151
|
+
const recordingEqual = prevRecording === nextRecording;
|
|
152
|
+
if (!recordingEqual) return false;
|
|
153
|
+
|
|
154
|
+
return true;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const MemoizedAudioRecordingButton = React.memo(
|
|
158
|
+
AudioRecordingButtonWithContext,
|
|
159
|
+
areEqual,
|
|
160
|
+
) as typeof AudioRecordingButtonWithContext;
|
|
161
|
+
|
|
162
|
+
export type AudioRecordingButtonProps<
|
|
163
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
164
|
+
> = Partial<AudioRecordingButtonPropsWithContext<StreamChatGenerics>> & {
|
|
165
|
+
recording: AudioRecordingReturnType;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Component to display the mic button on the Message Input.
|
|
170
|
+
*/
|
|
171
|
+
export const AudioRecordingButton = <
|
|
172
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
173
|
+
>(
|
|
174
|
+
props: AudioRecordingButtonProps<StreamChatGenerics>,
|
|
175
|
+
) => {
|
|
176
|
+
const { disabled = false } = useChannelContext<StreamChatGenerics>();
|
|
177
|
+
const { asyncMessagesMinimumPressDuration } = useMessageInputContext<StreamChatGenerics>();
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
<MemoizedAudioRecordingButton {...{ asyncMessagesMinimumPressDuration, disabled }} {...props} />
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const styles = StyleSheet.create({
|
|
185
|
+
container: {
|
|
186
|
+
alignItems: 'center',
|
|
187
|
+
borderRadius: 50,
|
|
188
|
+
justifyContent: 'center',
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
AudioRecordingButton.displayName = 'AudioRecordingButton{messageInput}';
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
MessageInputContextValue,
|
|
8
|
+
useMessageInputContext,
|
|
9
|
+
} from '../../../../contexts/messageInputContext/MessageInputContext';
|
|
10
|
+
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
|
|
11
|
+
|
|
12
|
+
import type { DefaultStreamChatGenerics } from '../../../../types/types';
|
|
13
|
+
|
|
14
|
+
type AudioRecordingInProgressPropsWithContext<
|
|
15
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
16
|
+
> = Pick<MessageInputContextValue<StreamChatGenerics>, 'AudioRecordingWaveform'> & {
|
|
17
|
+
/**
|
|
18
|
+
* The waveform data to be presented to show the audio levels.
|
|
19
|
+
*/
|
|
20
|
+
waveformData: number[];
|
|
21
|
+
/**
|
|
22
|
+
* Maximum number of waveform lines that should be rendered in the UI.
|
|
23
|
+
*/
|
|
24
|
+
maxDataPointsDrawn?: number;
|
|
25
|
+
/**
|
|
26
|
+
* The duration of the voice recording.
|
|
27
|
+
*/
|
|
28
|
+
recordingDuration?: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const AudioRecordingInProgressWithContext = <
|
|
32
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
33
|
+
>(
|
|
34
|
+
props: AudioRecordingInProgressPropsWithContext<StreamChatGenerics>,
|
|
35
|
+
) => {
|
|
36
|
+
const {
|
|
37
|
+
AudioRecordingWaveform,
|
|
38
|
+
maxDataPointsDrawn = 80,
|
|
39
|
+
recordingDuration,
|
|
40
|
+
waveformData,
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
theme: {
|
|
45
|
+
colors: { grey_dark },
|
|
46
|
+
messageInput: {
|
|
47
|
+
audioRecordingInProgress: { container, durationText },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
} = useTheme();
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<View style={[styles.container, container]}>
|
|
54
|
+
{/* `durationMillis` is for Expo apps, `currentPosition` is for Native CLI apps. */}
|
|
55
|
+
<Text style={[styles.durationText, { color: grey_dark }, durationText]}>
|
|
56
|
+
{recordingDuration ? dayjs.duration(recordingDuration).format('mm:ss') : null}
|
|
57
|
+
</Text>
|
|
58
|
+
<AudioRecordingWaveform maxDataPointsDrawn={maxDataPointsDrawn} waveformData={waveformData} />
|
|
59
|
+
</View>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(
|
|
64
|
+
prevProps: AudioRecordingInProgressPropsWithContext<StreamChatGenerics>,
|
|
65
|
+
nextProps: AudioRecordingInProgressPropsWithContext<StreamChatGenerics>,
|
|
66
|
+
) => {
|
|
67
|
+
const { recordingDuration: prevRecordingDuration } = prevProps;
|
|
68
|
+
const { recordingDuration: nextRecordingDuration } = nextProps;
|
|
69
|
+
|
|
70
|
+
const recordingDurationEqual = prevRecordingDuration === nextRecordingDuration;
|
|
71
|
+
|
|
72
|
+
if (!recordingDurationEqual) return false;
|
|
73
|
+
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const MemoizedAudioRecordingInProgress = React.memo(
|
|
78
|
+
AudioRecordingInProgressWithContext,
|
|
79
|
+
areEqual,
|
|
80
|
+
) as typeof AudioRecordingInProgressWithContext;
|
|
81
|
+
|
|
82
|
+
export type AudioRecordingInProgressProps<
|
|
83
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
84
|
+
> = Partial<AudioRecordingInProgressPropsWithContext<StreamChatGenerics>> & {
|
|
85
|
+
waveformData: number[];
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Component displayed when the audio is in the recording state.
|
|
90
|
+
*/
|
|
91
|
+
export const AudioRecordingInProgress = <
|
|
92
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
93
|
+
>(
|
|
94
|
+
props: AudioRecordingInProgressProps<StreamChatGenerics>,
|
|
95
|
+
) => {
|
|
96
|
+
const { AudioRecordingWaveform } = useMessageInputContext<StreamChatGenerics>();
|
|
97
|
+
|
|
98
|
+
return <MemoizedAudioRecordingInProgress {...{ AudioRecordingWaveform }} {...props} />;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const styles = StyleSheet.create({
|
|
102
|
+
container: {
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
flexDirection: 'row',
|
|
105
|
+
justifyContent: 'space-between',
|
|
106
|
+
paddingBottom: 8,
|
|
107
|
+
paddingTop: 4,
|
|
108
|
+
},
|
|
109
|
+
durationText: {
|
|
110
|
+
fontSize: 16,
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
AudioRecordingInProgress.displayName = 'AudioRecordingInProgress{messageInput}';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { StyleProp, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import Animated from 'react-native-reanimated';
|
|
5
|
+
|
|
6
|
+
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
|
|
7
|
+
import { ArrowUp, Lock } from '../../../../icons';
|
|
8
|
+
|
|
9
|
+
export type AudioRecordingLockIndicatorProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Boolean used to show if the voice recording state is locked. This makes sure the mic button shouldn't be pressed any longer.
|
|
12
|
+
* When the mic is locked the `AudioRecordingInProgress` component shows up.
|
|
13
|
+
*/
|
|
14
|
+
micLocked: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Height of the message input, to apply necessary position adjustments to this component.
|
|
17
|
+
*/
|
|
18
|
+
messageInputHeight?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Styles of the lock indicator.
|
|
21
|
+
*/
|
|
22
|
+
style?: StyleProp<ViewStyle>;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Component displayed to show the lock state of the recording when the button is slided up.
|
|
27
|
+
*/
|
|
28
|
+
export const AudioRecordingLockIndicator = ({
|
|
29
|
+
messageInputHeight,
|
|
30
|
+
micLocked,
|
|
31
|
+
style,
|
|
32
|
+
}: AudioRecordingLockIndicatorProps) => {
|
|
33
|
+
const [visible, setVisible] = useState(true);
|
|
34
|
+
const timeoutRef = useRef<NodeJS.Timer>();
|
|
35
|
+
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
timeoutRef.current = setTimeout(() => {
|
|
38
|
+
if (micLocked) {
|
|
39
|
+
setVisible(false);
|
|
40
|
+
}
|
|
41
|
+
}, 2000);
|
|
42
|
+
|
|
43
|
+
return () => {
|
|
44
|
+
clearTimeout(timeoutRef.current);
|
|
45
|
+
};
|
|
46
|
+
}, [micLocked]);
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
theme: {
|
|
50
|
+
colors: { accent_blue, grey, light_gray },
|
|
51
|
+
messageInput: {
|
|
52
|
+
audioRecordingLockIndicator: { arrowUpIcon, container, lockIcon },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
} = useTheme();
|
|
56
|
+
|
|
57
|
+
if (!visible) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<Animated.View
|
|
63
|
+
style={[
|
|
64
|
+
styles.container,
|
|
65
|
+
style,
|
|
66
|
+
{ backgroundColor: light_gray, bottom: messageInputHeight },
|
|
67
|
+
container,
|
|
68
|
+
]}
|
|
69
|
+
>
|
|
70
|
+
<Lock color={micLocked ? accent_blue : grey} size={32} {...lockIcon} />
|
|
71
|
+
{!micLocked && <ArrowUp color={grey} size={32} {...arrowUpIcon} />}
|
|
72
|
+
</Animated.View>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const styles = StyleSheet.create({
|
|
77
|
+
container: {
|
|
78
|
+
borderRadius: 50,
|
|
79
|
+
margin: 5,
|
|
80
|
+
padding: 8,
|
|
81
|
+
position: 'absolute',
|
|
82
|
+
right: 0,
|
|
83
|
+
zIndex: 1,
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
|
|
6
|
+
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
|
|
7
|
+
import { Pause, Play } from '../../../../icons';
|
|
8
|
+
|
|
9
|
+
import { WaveProgressBar } from '../../../ProgressControl/WaveProgressBar';
|
|
10
|
+
|
|
11
|
+
export type AudioRecordingPreviewProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Boolean used to show the paused state of the player.
|
|
14
|
+
*/
|
|
15
|
+
paused: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Number used to show the current position of the audio being played.
|
|
18
|
+
*/
|
|
19
|
+
position: number;
|
|
20
|
+
/**
|
|
21
|
+
* Number used to show the percentage of progress of the audio being played. It should be in 0-1 range.
|
|
22
|
+
*/
|
|
23
|
+
progress: number;
|
|
24
|
+
/**
|
|
25
|
+
* The waveform data to be presented to show the audio levels.
|
|
26
|
+
*/
|
|
27
|
+
waveformData: number[];
|
|
28
|
+
/**
|
|
29
|
+
* Function to play or pause the audio player.
|
|
30
|
+
*/
|
|
31
|
+
onVoicePlayerPlayPause?: () => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Component displayed when the audio is recorded and can be previewed.
|
|
36
|
+
*/
|
|
37
|
+
export const AudioRecordingPreview = (props: AudioRecordingPreviewProps) => {
|
|
38
|
+
const { onVoicePlayerPlayPause, paused, position, progress, waveformData } = props;
|
|
39
|
+
|
|
40
|
+
const {
|
|
41
|
+
theme: {
|
|
42
|
+
colors: { accent_blue, grey_dark },
|
|
43
|
+
messageInput: {
|
|
44
|
+
audioRecordingPreview: {
|
|
45
|
+
container,
|
|
46
|
+
currentTime,
|
|
47
|
+
infoContainer,
|
|
48
|
+
pauseIcon,
|
|
49
|
+
playIcon,
|
|
50
|
+
progressBar,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
} = useTheme();
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<View style={[styles.container, container]}>
|
|
58
|
+
<View style={[styles.infoContainer, infoContainer]}>
|
|
59
|
+
<Pressable onPress={onVoicePlayerPlayPause}>
|
|
60
|
+
{paused ? (
|
|
61
|
+
<Play fill={accent_blue} height={32} width={32} {...playIcon} />
|
|
62
|
+
) : (
|
|
63
|
+
<Pause fill={accent_blue} height={32} width={32} {...pauseIcon} />
|
|
64
|
+
)}
|
|
65
|
+
</Pressable>
|
|
66
|
+
{/* `durationMillis` is for Expo apps, `currentPosition` is for Native CLI apps. */}
|
|
67
|
+
<Text style={[styles.currentTime, { color: grey_dark }, currentTime]}>
|
|
68
|
+
{dayjs.duration(position).format('mm:ss')}
|
|
69
|
+
</Text>
|
|
70
|
+
</View>
|
|
71
|
+
<View style={[styles.progressBar, progressBar]}>
|
|
72
|
+
{/* Since the progress is in range 0-1 we convert it in terms of 100% */}
|
|
73
|
+
<WaveProgressBar progress={progress} waveformData={waveformData} />
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
alignItems: 'center',
|
|
82
|
+
display: 'flex',
|
|
83
|
+
flexDirection: 'row',
|
|
84
|
+
paddingBottom: 8,
|
|
85
|
+
paddingTop: 4,
|
|
86
|
+
},
|
|
87
|
+
currentTime: {
|
|
88
|
+
fontSize: 16,
|
|
89
|
+
marginLeft: 4,
|
|
90
|
+
},
|
|
91
|
+
infoContainer: {
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
display: 'flex',
|
|
94
|
+
flex: 1,
|
|
95
|
+
flexDirection: 'row',
|
|
96
|
+
},
|
|
97
|
+
progressBar: {
|
|
98
|
+
flex: 3,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
AudioRecordingPreview.displayName = 'AudioRecordingPreview{messageInput}';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { useTheme } from '../../../../contexts/themeContext/ThemeContext';
|
|
5
|
+
|
|
6
|
+
export type AudioRecordingWaveformProps = {
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of waveform lines that should be rendered in the UI.
|
|
9
|
+
*/
|
|
10
|
+
maxDataPointsDrawn: number;
|
|
11
|
+
/**
|
|
12
|
+
* The waveform data to be presented to show the audio levels.
|
|
13
|
+
*/
|
|
14
|
+
waveformData: number[];
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Waveform Component displayed when the audio is in the recording state.
|
|
19
|
+
*/
|
|
20
|
+
export const AudioRecordingWaveform = (props: AudioRecordingWaveformProps) => {
|
|
21
|
+
const { maxDataPointsDrawn, waveformData } = props;
|
|
22
|
+
const {
|
|
23
|
+
theme: {
|
|
24
|
+
colors: { grey_dark },
|
|
25
|
+
messageInput: {
|
|
26
|
+
audioRecordingWaveform: { container, waveform: waveformTheme },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
} = useTheme();
|
|
30
|
+
return (
|
|
31
|
+
<View style={[styles.container, container]}>
|
|
32
|
+
{waveformData.slice(-maxDataPointsDrawn).map((waveform, index) => (
|
|
33
|
+
<View
|
|
34
|
+
key={index}
|
|
35
|
+
style={[
|
|
36
|
+
styles.waveform,
|
|
37
|
+
{
|
|
38
|
+
backgroundColor: grey_dark,
|
|
39
|
+
height: waveform * 30 > 3 ? waveform * 30 : 3,
|
|
40
|
+
},
|
|
41
|
+
waveformTheme,
|
|
42
|
+
]}
|
|
43
|
+
/>
|
|
44
|
+
))}
|
|
45
|
+
</View>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const styles = StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
alignSelf: 'center',
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
},
|
|
54
|
+
waveform: {
|
|
55
|
+
alignSelf: 'center',
|
|
56
|
+
borderRadius: 2,
|
|
57
|
+
marginHorizontal: 1,
|
|
58
|
+
width: 2,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
AudioRecordingWaveform.displayName = 'AudioRecordingWaveform{messageInput}';
|