stream-chat-react-native-core 5.21.0 → 5.22.0-beta.10
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/README.md +10 -5
- package/lib/commonjs/components/Attachment/AudioAttachment.js +12 -12
- package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/FileAttachment.js +10 -7
- package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +8 -6
- package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +24 -20
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js +26 -11
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +65 -46
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
- package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +30 -32
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +18 -15
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +41 -12
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +10 -8
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +17 -12
- package/lib/commonjs/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +20 -17
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +18 -17
- package/lib/commonjs/components/Message/MessageSimple/ReactionList.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js +7 -5
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.test.js +8 -0
- package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.test.js.map +1 -0
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +25 -17
- package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js +30 -20
- package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +13 -13
- package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +13 -11
- package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js +8 -14
- package/lib/commonjs/components/MessageOverlay/MessageActionList.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +11 -8
- package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +32 -29
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +17 -15
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +66 -45
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -4
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/hooks/index.js +11 -0
- package/lib/commonjs/hooks/index.js.map +1 -1
- package/lib/commonjs/hooks/useViewport.js +47 -0
- package/lib/commonjs/hooks/useViewport.js.map +1 -0
- package/lib/commonjs/i18n/en.json +6 -1
- package/lib/commonjs/i18n/es.json +77 -0
- package/lib/commonjs/i18n/fr.json +65 -60
- package/lib/commonjs/i18n/he.json +6 -1
- package/lib/commonjs/i18n/hi.json +65 -60
- package/lib/commonjs/i18n/it.json +65 -60
- package/lib/commonjs/i18n/ja.json +6 -1
- package/lib/commonjs/i18n/ko.json +6 -1
- package/lib/commonjs/i18n/nl.json +65 -60
- package/lib/commonjs/i18n/ru.json +65 -60
- package/lib/commonjs/i18n/tr.json +65 -60
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/types/types.js.map +1 -1
- package/lib/commonjs/utils/Streami18n.js +4 -1
- package/lib/commonjs/utils/Streami18n.js.map +1 -1
- package/lib/commonjs/utils/compressImage.js +37 -0
- package/lib/commonjs/utils/compressImage.js.map +1 -0
- package/lib/commonjs/utils/utils.js +1 -15
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/AudioAttachment.js +12 -12
- package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
- package/lib/module/components/Attachment/FileAttachment.js +10 -7
- package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js +8 -6
- package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +24 -20
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js +26 -11
- package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +65 -46
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
- package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
- package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +30 -32
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +18 -15
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +41 -12
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGrid.js +10 -8
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/Indicators/EmptyStateIndicator.js +17 -12
- package/lib/module/components/Indicators/EmptyStateIndicator.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +20 -17
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/ReactionList.js +18 -17
- package/lib/module/components/Message/MessageSimple/ReactionList.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js +7 -5
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.test.js +8 -0
- package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.test.js.map +1 -0
- package/lib/module/components/Message/MessageSimple/utils/renderText.js +25 -17
- package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
- package/lib/module/components/MessageInput/FileUploadPreview.js +30 -20
- package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/ImageUploadPreview.js +13 -13
- package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +1 -1
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/UploadProgressIndicator.js.map +1 -1
- package/lib/module/components/MessageList/InlineUnreadIndicator.js +13 -11
- package/lib/module/components/MessageList/InlineUnreadIndicator.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageActionList.js +8 -14
- package/lib/module/components/MessageOverlay/MessageActionList.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageActionListItem.js +11 -8
- package/lib/module/components/MessageOverlay/MessageActionListItem.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +32 -29
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +17 -15
- package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
- package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +66 -45
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +1 -4
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/hooks/index.js +11 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useViewport.js +47 -0
- package/lib/module/hooks/useViewport.js.map +1 -0
- package/lib/module/i18n/en.json +6 -1
- package/lib/module/i18n/es.json +77 -0
- package/lib/module/i18n/fr.json +65 -60
- package/lib/module/i18n/he.json +6 -1
- package/lib/module/i18n/hi.json +65 -60
- package/lib/module/i18n/it.json +65 -60
- package/lib/module/i18n/ja.json +6 -1
- package/lib/module/i18n/ko.json +6 -1
- package/lib/module/i18n/nl.json +65 -60
- package/lib/module/i18n/ru.json +65 -60
- package/lib/module/i18n/tr.json +65 -60
- package/lib/module/native.js.map +1 -1
- package/lib/module/types/types.js.map +1 -1
- package/lib/module/utils/Streami18n.js +4 -1
- package/lib/module/utils/Streami18n.js.map +1 -1
- package/lib/module/utils/compressImage.js +37 -0
- package/lib/module/utils/compressImage.js.map +1 -0
- package/lib/module/utils/utils.js +1 -15
- package/lib/module/utils/utils.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/AudioAttachment.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +3 -0
- package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.d.ts +1 -3
- package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.test.d.ts +1 -0
- package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/components/MessageInput/UploadProgressIndicator.d.ts +5 -2
- package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +5 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -23
- package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +2 -2
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -2
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -3
- package/lib/typescript/hooks/index.d.ts +1 -0
- package/lib/typescript/hooks/useViewport.d.ts +11 -0
- package/lib/typescript/i18n/en.json +6 -1
- package/lib/typescript/i18n/es.json +77 -0
- package/lib/typescript/i18n/fr.json +65 -60
- package/lib/typescript/i18n/he.json +6 -1
- package/lib/typescript/i18n/hi.json +65 -60
- package/lib/typescript/i18n/it.json +65 -60
- package/lib/typescript/i18n/ja.json +6 -1
- package/lib/typescript/i18n/ko.json +6 -1
- package/lib/typescript/i18n/nl.json +65 -60
- package/lib/typescript/i18n/ru.json +65 -60
- package/lib/typescript/i18n/tr.json +65 -60
- package/lib/typescript/native.d.ts +2 -0
- package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
- package/lib/typescript/types/types.d.ts +27 -10
- package/lib/typescript/utils/Streami18n.d.ts +7 -1
- package/lib/typescript/utils/compressImage.d.ts +8 -0
- package/lib/typescript/utils/utils.d.ts +0 -2
- package/package.json +2 -2
- package/src/components/Attachment/AudioAttachment.tsx +2 -1
- package/src/components/Attachment/FileAttachment.tsx +12 -3
- package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +7 -5
- package/src/components/AttachmentPicker/components/AttachmentSelectionBar.tsx +13 -1
- package/src/components/Channel/Channel.tsx +32 -8
- package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -9
- package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +4 -3
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +4 -3
- package/src/components/ImageGallery/ImageGallery.tsx +10 -19
- package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +5 -3
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +5 -3
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +6 -2
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +12 -7
- package/src/components/ImageGallery/components/ImageGrid.tsx +2 -1
- package/src/components/Indicators/EmptyStateIndicator.tsx +8 -7
- package/src/components/Message/MessageSimple/MessageContent.tsx +3 -1
- package/src/components/Message/MessageSimple/ReactionList.tsx +2 -1
- package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts +23 -0
- package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +12 -13
- package/src/components/Message/MessageSimple/utils/renderText.tsx +12 -2
- package/src/components/MessageInput/FileUploadPreview.tsx +17 -3
- package/src/components/MessageInput/ImageUploadPreview.tsx +1 -2
- package/src/components/MessageInput/MessageInput.tsx +1 -1
- package/src/components/MessageInput/UploadProgressIndicator.tsx +2 -2
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +1 -1
- package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +1 -1
- package/src/components/MessageInput/__tests__/MessageInput.test.js +2 -2
- package/src/components/MessageList/InlineUnreadIndicator.tsx +2 -1
- package/src/components/MessageOverlay/MessageActionList.tsx +3 -11
- package/src/components/MessageOverlay/MessageActionListItem.tsx +5 -2
- package/src/components/MessageOverlay/MessageOverlay.tsx +5 -3
- package/src/components/Thread/components/ThreadFooterComponent.tsx +2 -1
- package/src/contexts/channelContext/ChannelContext.tsx +5 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +81 -69
- package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -2
- package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
- package/src/contexts/messagesContext/MessagesContext.tsx +2 -2
- package/src/contexts/themeContext/utils/theme.ts +2 -7
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useViewport.ts +41 -0
- package/src/i18n/en.json +6 -1
- package/src/i18n/es.json +77 -0
- package/src/i18n/fr.json +65 -60
- package/src/i18n/he.json +6 -1
- package/src/i18n/hi.json +65 -60
- package/src/i18n/it.json +65 -60
- package/src/i18n/ja.json +6 -1
- package/src/i18n/ko.json +6 -1
- package/src/i18n/nl.json +65 -60
- package/src/i18n/ru.json +65 -60
- package/src/i18n/tr.json +65 -60
- package/src/native.ts +5 -1
- package/src/types/types.ts +29 -10
- package/src/utils/Streami18n.ts +13 -6
- package/src/utils/compressImage.ts +32 -0
- package/src/utils/utils.ts +0 -13
- package/src/version.json +1 -1
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
useMessagesContext,
|
|
25
25
|
} from '../../contexts/messagesContext/MessagesContext';
|
|
26
26
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
27
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
27
28
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
28
|
-
import { vw } from '../../utils/utils';
|
|
29
29
|
|
|
30
30
|
const styles = StyleSheet.create({
|
|
31
31
|
container: {
|
|
@@ -35,7 +35,6 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
padding: 8,
|
|
36
36
|
},
|
|
37
37
|
details: {
|
|
38
|
-
maxWidth: vw(60),
|
|
39
38
|
paddingLeft: 16,
|
|
40
39
|
},
|
|
41
40
|
size: {
|
|
@@ -94,6 +93,7 @@ const FileAttachmentWithContext = <
|
|
|
94
93
|
},
|
|
95
94
|
},
|
|
96
95
|
} = useTheme();
|
|
96
|
+
const { vw } = useViewport();
|
|
97
97
|
|
|
98
98
|
const defaultOnPress = () => openUrlSafely(attachment.asset_url);
|
|
99
99
|
|
|
@@ -134,7 +134,16 @@ const FileAttachmentWithContext = <
|
|
|
134
134
|
>
|
|
135
135
|
<View style={[styles.container, { backgroundColor: white }, container, stylesProp.container]}>
|
|
136
136
|
<FileAttachmentIcon mimeType={attachment.mime_type} size={attachmentSize} />
|
|
137
|
-
<View
|
|
137
|
+
<View
|
|
138
|
+
style={[
|
|
139
|
+
styles.details,
|
|
140
|
+
{
|
|
141
|
+
maxWidth: vw(60),
|
|
142
|
+
},
|
|
143
|
+
details,
|
|
144
|
+
stylesProp.details,
|
|
145
|
+
]}
|
|
146
|
+
>
|
|
138
147
|
<Text numberOfLines={2} style={[styles.title, { color: black }, title, stylesProp.title]}>
|
|
139
148
|
{attachment.title}
|
|
140
149
|
</Text>
|
|
@@ -20,13 +20,13 @@ import { renderAttachmentPickerItem } from './components/AttachmentPickerItem';
|
|
|
20
20
|
import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
21
21
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
22
22
|
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
23
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
23
24
|
import {
|
|
24
25
|
getPhotos,
|
|
25
26
|
iOS14RefreshGallerySelection,
|
|
26
27
|
oniOS14GalleryLibrarySelectionChange,
|
|
27
28
|
} from '../../native';
|
|
28
29
|
import type { Asset } from '../../types/types';
|
|
29
|
-
import { vh } from '../../utils/utils';
|
|
30
30
|
|
|
31
31
|
dayjs.extend(duration);
|
|
32
32
|
|
|
@@ -36,7 +36,6 @@ const styles = StyleSheet.create({
|
|
|
36
36
|
},
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const screenHeight = vh(100);
|
|
40
39
|
const fullScreenHeight = Dimensions.get('window').height;
|
|
41
40
|
|
|
42
41
|
export type AttachmentPickerProps = {
|
|
@@ -106,6 +105,9 @@ export const AttachmentPicker = React.forwardRef(
|
|
|
106
105
|
setSelectedPicker,
|
|
107
106
|
topInset,
|
|
108
107
|
} = useAttachmentPickerContext();
|
|
108
|
+
const { vh } = useViewport();
|
|
109
|
+
|
|
110
|
+
const screenHeight = vh(100);
|
|
109
111
|
|
|
110
112
|
const [currentIndex, setCurrentIndex] = useState(-1);
|
|
111
113
|
const endCursorRef = useRef<string>();
|
|
@@ -8,10 +8,10 @@ import { lookup } from 'mime-types';
|
|
|
8
8
|
|
|
9
9
|
import type { AttachmentPickerContextValue } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
10
10
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
11
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
11
12
|
import { Recorder } from '../../../icons';
|
|
12
13
|
import { getLocalAssetUri } from '../../../native';
|
|
13
14
|
import type { Asset, File } from '../../../types/types';
|
|
14
|
-
import { vw } from '../../../utils/utils';
|
|
15
15
|
|
|
16
16
|
type AttachmentPickerItemType = Pick<
|
|
17
17
|
AttachmentPickerContextValue,
|
|
@@ -39,6 +39,7 @@ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
|
|
|
39
39
|
selectedFiles,
|
|
40
40
|
setSelectedFiles,
|
|
41
41
|
} = props;
|
|
42
|
+
const { vw } = useViewport();
|
|
42
43
|
|
|
43
44
|
const {
|
|
44
45
|
theme: {
|
|
@@ -70,15 +71,15 @@ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
|
|
|
70
71
|
const localAssetURI = Platform.OS === 'ios' && asset.id && (await getLocalAssetUri(asset.id));
|
|
71
72
|
const uri = localAssetURI || asset.uri || '';
|
|
72
73
|
// We need a mime-type to upload a video file.
|
|
73
|
-
const mimeType = lookup(asset.
|
|
74
|
+
const mimeType = lookup(asset.name) || 'multipart/form-data';
|
|
74
75
|
return [
|
|
75
76
|
...files,
|
|
76
77
|
{
|
|
77
|
-
duration:
|
|
78
|
+
duration: asset.duration,
|
|
78
79
|
id: asset.id,
|
|
79
80
|
mimeType,
|
|
80
|
-
name: asset.
|
|
81
|
-
size: asset.
|
|
81
|
+
name: asset.name,
|
|
82
|
+
size: asset.size,
|
|
82
83
|
uri,
|
|
83
84
|
},
|
|
84
85
|
];
|
|
@@ -152,6 +153,7 @@ const AttachmentImage: React.FC<AttachmentImageProps> = (props) => {
|
|
|
152
153
|
colors: { overlay },
|
|
153
154
|
},
|
|
154
155
|
} = useTheme();
|
|
156
|
+
const { vw } = useViewport();
|
|
155
157
|
|
|
156
158
|
const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
|
|
157
159
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { Alert, Linking, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useAttachmentPickerContext } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
|
|
5
5
|
import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext';
|
|
6
6
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
7
|
+
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
7
8
|
|
|
8
9
|
import { takePhoto } from '../../../native';
|
|
9
10
|
|
|
@@ -29,6 +30,7 @@ export const AttachmentSelectionBar: React.FC = () => {
|
|
|
29
30
|
setSelectedImages,
|
|
30
31
|
setSelectedPicker,
|
|
31
32
|
} = useAttachmentPickerContext();
|
|
33
|
+
const { t } = useTranslationContext();
|
|
32
34
|
|
|
33
35
|
const { compressImageQuality, hasFilePicker, imageUploads, pickFile } = useMessageInputContext();
|
|
34
36
|
|
|
@@ -57,6 +59,16 @@ export const AttachmentSelectionBar: React.FC = () => {
|
|
|
57
59
|
setSelectedPicker(undefined);
|
|
58
60
|
closePicker();
|
|
59
61
|
const photo = await takePhoto({ compressImageQuality });
|
|
62
|
+
if (photo.askToOpenSettings) {
|
|
63
|
+
Alert.alert(
|
|
64
|
+
t('Allow camera access in device settings'),
|
|
65
|
+
t('Device camera is used to take photos or videos.'),
|
|
66
|
+
[
|
|
67
|
+
{ style: 'cancel', text: t('Cancel') },
|
|
68
|
+
{ onPress: () => Linking.openSettings(), style: 'default', text: t('Open Settings') },
|
|
69
|
+
],
|
|
70
|
+
);
|
|
71
|
+
}
|
|
60
72
|
if (!photo.cancelled) {
|
|
61
73
|
setSelectedImages((images) => [...images, photo]);
|
|
62
74
|
}
|
|
@@ -78,6 +78,7 @@ import { FlatList as FlatListDefault, pickDocument } from '../../native';
|
|
|
78
78
|
import * as dbApi from '../../store/apis';
|
|
79
79
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
80
80
|
import { addReactionToLocalState } from '../../utils/addReactionToLocalState';
|
|
81
|
+
import { compressedImageURI } from '../../utils/compressImage';
|
|
81
82
|
import { DBSyncManager } from '../../utils/DBSyncManager';
|
|
82
83
|
import { patchMessageTextCommand } from '../../utils/patchMessageTextCommand';
|
|
83
84
|
import { removeReactionFromLocalState } from '../../utils/removeReactionFromLocalState';
|
|
@@ -589,6 +590,13 @@ const ChannelWithContext = <
|
|
|
589
590
|
|
|
590
591
|
const { setTargetedMessage, targetedMessage } = useTargetedMessage();
|
|
591
592
|
|
|
593
|
+
/**
|
|
594
|
+
* This ref will hold the abort controllers for
|
|
595
|
+
* requests made for uploading images/files in the messageInputContext
|
|
596
|
+
* Its a map of filename to AbortController
|
|
597
|
+
*/
|
|
598
|
+
const uploadAbortControllerRef = useRef<Map<string, AbortController>>(new Map());
|
|
599
|
+
|
|
592
600
|
const channelId = channel?.id || '';
|
|
593
601
|
useEffect(() => {
|
|
594
602
|
const initChannel = () => {
|
|
@@ -1290,20 +1298,28 @@ const ChannelWithContext = <
|
|
|
1290
1298
|
if (updatedMessage.attachments?.length) {
|
|
1291
1299
|
for (let i = 0; i < updatedMessage.attachments?.length; i++) {
|
|
1292
1300
|
const attachment = updatedMessage.attachments[i];
|
|
1301
|
+
const image = attachment.originalImage;
|
|
1293
1302
|
const file = attachment.originalFile;
|
|
1294
1303
|
// check if image_url is not a remote url
|
|
1295
1304
|
if (
|
|
1296
1305
|
attachment.type === 'image' &&
|
|
1297
|
-
|
|
1306
|
+
image?.uri &&
|
|
1298
1307
|
attachment.image_url &&
|
|
1299
1308
|
isLocalUrl(attachment.image_url)
|
|
1300
1309
|
) {
|
|
1301
|
-
const filename =
|
|
1310
|
+
const filename = image.name ?? image.uri.replace(/^(file:\/\/|content:\/\/)/, '');
|
|
1311
|
+
// if any upload is in progress, cancel it
|
|
1312
|
+
const controller = uploadAbortControllerRef.current.get(filename);
|
|
1313
|
+
if (controller) {
|
|
1314
|
+
controller.abort();
|
|
1315
|
+
uploadAbortControllerRef.current.delete(filename);
|
|
1316
|
+
}
|
|
1317
|
+
const compressedUri = await compressedImageURI(image, compressImageQuality);
|
|
1302
1318
|
const contentType = lookup(filename) || 'multipart/form-data';
|
|
1303
1319
|
|
|
1304
1320
|
const uploadResponse = doImageUploadRequest
|
|
1305
|
-
? await doImageUploadRequest(
|
|
1306
|
-
: await channel.sendImage(
|
|
1321
|
+
? await doImageUploadRequest(image, channel)
|
|
1322
|
+
: await channel.sendImage(compressedUri, filename, contentType);
|
|
1307
1323
|
|
|
1308
1324
|
attachment.image_url = uploadResponse.file;
|
|
1309
1325
|
delete attachment.originalFile;
|
|
@@ -1321,6 +1337,12 @@ const ChannelWithContext = <
|
|
|
1321
1337
|
isLocalUrl(attachment.asset_url) &&
|
|
1322
1338
|
file?.uri
|
|
1323
1339
|
) {
|
|
1340
|
+
// if any upload is in progress, cancel it
|
|
1341
|
+
const controller = uploadAbortControllerRef.current.get(file.name);
|
|
1342
|
+
if (controller) {
|
|
1343
|
+
controller.abort();
|
|
1344
|
+
uploadAbortControllerRef.current.delete(file.name);
|
|
1345
|
+
}
|
|
1324
1346
|
const response = doDocUploadRequest
|
|
1325
1347
|
? await doDocUploadRequest(file, channel)
|
|
1326
1348
|
: await channel.sendFile(file.uri, file.name, file.mimeType);
|
|
@@ -1587,15 +1609,16 @@ const ChannelWithContext = <
|
|
|
1587
1609
|
: client.updateMessage(updatedMessage);
|
|
1588
1610
|
|
|
1589
1611
|
const setEditingState: MessagesContextValue<StreamChatGenerics>['setEditingState'] = (
|
|
1590
|
-
|
|
1612
|
+
messageOrBoolean,
|
|
1591
1613
|
) => {
|
|
1592
|
-
|
|
1614
|
+
clearQuotedMessageState();
|
|
1615
|
+
setEditing(messageOrBoolean);
|
|
1593
1616
|
};
|
|
1594
1617
|
|
|
1595
1618
|
const setQuotedMessageState: MessagesContextValue<StreamChatGenerics>['setQuotedMessageState'] = (
|
|
1596
|
-
|
|
1619
|
+
messageOrBoolean,
|
|
1597
1620
|
) => {
|
|
1598
|
-
setQuotedMessage(
|
|
1621
|
+
setQuotedMessage(messageOrBoolean);
|
|
1599
1622
|
};
|
|
1600
1623
|
|
|
1601
1624
|
const clearEditingState: InputMessageInputContextValue<StreamChatGenerics>['clearEditingState'] =
|
|
@@ -1851,6 +1874,7 @@ const ChannelWithContext = <
|
|
|
1851
1874
|
StickyHeader,
|
|
1852
1875
|
targetedMessage,
|
|
1853
1876
|
threadList,
|
|
1877
|
+
uploadAbortControllerRef,
|
|
1854
1878
|
watcherCount,
|
|
1855
1879
|
watchers,
|
|
1856
1880
|
});
|
|
@@ -36,6 +36,7 @@ export const useCreateChannelContext = <
|
|
|
36
36
|
StickyHeader,
|
|
37
37
|
targetedMessage,
|
|
38
38
|
threadList,
|
|
39
|
+
uploadAbortControllerRef,
|
|
39
40
|
watcherCount,
|
|
40
41
|
watchers,
|
|
41
42
|
}: ChannelContextValue<StreamChatGenerics>) => {
|
|
@@ -79,6 +80,7 @@ export const useCreateChannelContext = <
|
|
|
79
80
|
StickyHeader,
|
|
80
81
|
targetedMessage,
|
|
81
82
|
threadList,
|
|
83
|
+
uploadAbortControllerRef,
|
|
82
84
|
watcherCount,
|
|
83
85
|
watchers,
|
|
84
86
|
}),
|
|
@@ -53,7 +53,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
53
53
|
*/
|
|
54
54
|
channelId?: string;
|
|
55
55
|
}) => {
|
|
56
|
-
const
|
|
56
|
+
const editingDep = typeof editing === 'boolean' ? editing : editing?.id;
|
|
57
57
|
const quotedMessageId = quotedMessage
|
|
58
58
|
? typeof quotedMessage === 'boolean'
|
|
59
59
|
? ''
|
|
@@ -103,14 +103,7 @@ export const useCreateInputMessageInputContext = <
|
|
|
103
103
|
ShowThreadMessageInChannelButton,
|
|
104
104
|
UploadProgressIndicator,
|
|
105
105
|
}),
|
|
106
|
-
[
|
|
107
|
-
compressImageQuality,
|
|
108
|
-
channelId,
|
|
109
|
-
editingExists,
|
|
110
|
-
initialValue,
|
|
111
|
-
maxMessageLength,
|
|
112
|
-
quotedMessageId,
|
|
113
|
-
],
|
|
106
|
+
[compressImageQuality, channelId, editingDep, initialValue, maxMessageLength, quotedMessageId],
|
|
114
107
|
);
|
|
115
108
|
|
|
116
109
|
return inputMessageInputContext;
|
|
@@ -19,8 +19,8 @@ import {
|
|
|
19
19
|
} from '../../contexts/channelsContext/ChannelsContext';
|
|
20
20
|
import { useChatContext } from '../../contexts/chatContext/ChatContext';
|
|
21
21
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
22
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
22
23
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
23
|
-
import { vw } from '../../utils/utils';
|
|
24
24
|
|
|
25
25
|
const styles = StyleSheet.create({
|
|
26
26
|
container: {
|
|
@@ -45,8 +45,6 @@ const styles = StyleSheet.create({
|
|
|
45
45
|
title: { fontSize: 14, fontWeight: '700' },
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
const maxWidth = vw(80) - 16 - 40;
|
|
49
|
-
|
|
50
48
|
export type ChannelPreviewMessengerPropsWithContext<
|
|
51
49
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
52
50
|
> = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'> &
|
|
@@ -120,6 +118,9 @@ const ChannelPreviewMessengerWithContext = <
|
|
|
120
118
|
PreviewMutedStatus = ChannelPreviewMutedStatus,
|
|
121
119
|
unread,
|
|
122
120
|
} = props;
|
|
121
|
+
const { vw } = useViewport();
|
|
122
|
+
|
|
123
|
+
const maxWidth = vw(80) - 16 - 40;
|
|
123
124
|
|
|
124
125
|
const {
|
|
125
126
|
theme: {
|
|
@@ -3,11 +3,9 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
import type { Channel, ChannelMemberResponse } from 'stream-chat';
|
|
4
4
|
|
|
5
5
|
import { useChatContext } from '../../../contexts/chatContext/ChatContext';
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
6
7
|
|
|
7
8
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
8
|
-
import { vw } from '../../../utils/utils';
|
|
9
|
-
|
|
10
|
-
const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
|
|
11
9
|
|
|
12
10
|
const ELLIPSIS = `...`;
|
|
13
11
|
|
|
@@ -81,6 +79,9 @@ export const useChannelPreviewDisplayName = <
|
|
|
81
79
|
characterLength?: number,
|
|
82
80
|
) => {
|
|
83
81
|
const { client } = useChatContext<StreamChatGenerics>();
|
|
82
|
+
const { vw } = useViewport();
|
|
83
|
+
|
|
84
|
+
const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
|
|
84
85
|
|
|
85
86
|
const currentUserId = client?.userID;
|
|
86
87
|
const members = channel?.state?.members;
|
|
@@ -55,18 +55,16 @@ import {
|
|
|
55
55
|
useOverlayContext,
|
|
56
56
|
} from '../../contexts/overlayContext/OverlayContext';
|
|
57
57
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
58
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
58
59
|
import { isVideoPackageAvailable, VideoType } from '../../native';
|
|
59
60
|
import type { DefaultStreamChatGenerics } from '../../types/types';
|
|
60
61
|
import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
61
62
|
import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
|
|
62
|
-
import { vh, vw } from '../../utils/utils';
|
|
63
63
|
import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
|
|
64
64
|
|
|
65
65
|
const isAndroid = Platform.OS === 'android';
|
|
66
66
|
const fullScreenHeight = Dimensions.get('screen').height;
|
|
67
|
-
|
|
68
|
-
const screenWidth = vw(100);
|
|
69
|
-
const halfScreenWidth = vw(50);
|
|
67
|
+
|
|
70
68
|
const MARGIN = 32;
|
|
71
69
|
|
|
72
70
|
export enum HasPinched {
|
|
@@ -162,6 +160,12 @@ export const ImageGallery = <
|
|
|
162
160
|
const { messages, selectedMessage, setSelectedMessage } =
|
|
163
161
|
useImageGalleryContext<StreamChatGenerics>();
|
|
164
162
|
|
|
163
|
+
const { vh, vw } = useViewport();
|
|
164
|
+
|
|
165
|
+
const measuredScreenHeight = vh(100);
|
|
166
|
+
const screenWidth = vw(100);
|
|
167
|
+
const halfScreenWidth = vw(50);
|
|
168
|
+
|
|
165
169
|
/**
|
|
166
170
|
* Height constants
|
|
167
171
|
*/
|
|
@@ -571,21 +575,7 @@ export const ImageGallery = <
|
|
|
571
575
|
simultaneousHandlers={[pinchRef]}
|
|
572
576
|
>
|
|
573
577
|
<Animated.View style={StyleSheet.absoluteFill}>
|
|
574
|
-
<Animated.View
|
|
575
|
-
style={[
|
|
576
|
-
styles.animatedContainer,
|
|
577
|
-
pagerStyle,
|
|
578
|
-
pager,
|
|
579
|
-
{
|
|
580
|
-
transform: [
|
|
581
|
-
{ scaleX: -1 }, // Also only here for opening, wrong direction when not included
|
|
582
|
-
{
|
|
583
|
-
translateX: translationX.value, // Only here for opening, wrong index when this is not included
|
|
584
|
-
},
|
|
585
|
-
],
|
|
586
|
-
},
|
|
587
|
-
]}
|
|
588
|
-
>
|
|
578
|
+
<Animated.View style={[styles.animatedContainer, pagerStyle, pager]}>
|
|
589
579
|
{imageGalleryAttachments.map((photo, i) =>
|
|
590
580
|
photo.type === 'video' ? (
|
|
591
581
|
<AnimatedGalleryVideo
|
|
@@ -669,6 +659,7 @@ export const ImageGallery = <
|
|
|
669
659
|
photoLength={imageGalleryAttachments.length}
|
|
670
660
|
progress={imageGalleryAttachments[selectedIndex].progress || 0}
|
|
671
661
|
selectedIndex={selectedIndex}
|
|
662
|
+
videoRef={videoRef}
|
|
672
663
|
visible={headerFooterVisible}
|
|
673
664
|
{...imageGalleryCustomComponents?.footer}
|
|
674
665
|
/>
|
|
@@ -3,10 +3,8 @@ import { View } from 'react-native';
|
|
|
3
3
|
import type { ImageStyle, StyleProp } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
7
7
|
|
|
8
|
-
const screenWidth = vw(100);
|
|
9
|
-
const halfScreenWidth = vw(50);
|
|
10
8
|
const oneEighth = 1 / 8;
|
|
11
9
|
|
|
12
10
|
type Props = {
|
|
@@ -40,6 +38,10 @@ export const AnimatedGalleryImage: React.FC<Props> = React.memo(
|
|
|
40
38
|
translateX,
|
|
41
39
|
translateY,
|
|
42
40
|
} = props;
|
|
41
|
+
const { vw } = useViewport();
|
|
42
|
+
|
|
43
|
+
const screenWidth = vw(100);
|
|
44
|
+
const halfScreenWidth = vw(50);
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* The current image, designated by selected is scaled and translated
|
|
@@ -3,6 +3,7 @@ import { StyleSheet, View, ViewStyle } from 'react-native';
|
|
|
3
3
|
import type { StyleProp } from 'react-native';
|
|
4
4
|
import Animated, { useAnimatedStyle } from 'react-native-reanimated';
|
|
5
5
|
|
|
6
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
6
7
|
import {
|
|
7
8
|
isVideoPackageAvailable,
|
|
8
9
|
PlaybackStatus,
|
|
@@ -12,11 +13,8 @@ import {
|
|
|
12
13
|
VideoType,
|
|
13
14
|
} from '../../../native';
|
|
14
15
|
|
|
15
|
-
import { vw } from '../../../utils/utils';
|
|
16
16
|
import { Spinner } from '../../Spinner/Spinner';
|
|
17
17
|
|
|
18
|
-
const screenWidth = vw(100);
|
|
19
|
-
const halfScreenWidth = vw(50);
|
|
20
18
|
const oneEighth = 1 / 8;
|
|
21
19
|
|
|
22
20
|
export type AnimatedGalleryVideoType = {
|
|
@@ -74,6 +72,10 @@ export const AnimatedGalleryVideo: React.FC<AnimatedGalleryVideoType> = React.me
|
|
|
74
72
|
translateY,
|
|
75
73
|
videoRef,
|
|
76
74
|
} = props;
|
|
75
|
+
const { vw } = useViewport();
|
|
76
|
+
|
|
77
|
+
const screenWidth = vw(100);
|
|
78
|
+
const halfScreenWidth = vw(50);
|
|
77
79
|
|
|
78
80
|
const onLoadStart = () => {
|
|
79
81
|
setOpacity(1);
|
|
@@ -7,7 +7,7 @@ import { ImageGalleryVideoControl } from './ImageGalleryVideoControl';
|
|
|
7
7
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
8
8
|
import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
|
|
9
9
|
import { Grid as GridIconDefault, Share as ShareIconDefault } from '../../../icons';
|
|
10
|
-
import { deleteFile, saveFile, shareImage } from '../../../native';
|
|
10
|
+
import { deleteFile, saveFile, shareImage, VideoType } from '../../../native';
|
|
11
11
|
|
|
12
12
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
13
13
|
import type { Photo } from '../ImageGallery';
|
|
@@ -67,6 +67,7 @@ export type ImageGalleryFooterVideoControlProps = {
|
|
|
67
67
|
onPlayPause: (status?: boolean) => void;
|
|
68
68
|
paused: boolean;
|
|
69
69
|
progress: number;
|
|
70
|
+
videoRef: React.RefObject<VideoType>;
|
|
70
71
|
};
|
|
71
72
|
|
|
72
73
|
export type ImageGalleryFooterVideoControlComponent = ({
|
|
@@ -100,6 +101,7 @@ type ImageGalleryFooterPropsWithContext<
|
|
|
100
101
|
photoLength: number;
|
|
101
102
|
progress: number;
|
|
102
103
|
selectedIndex: number;
|
|
104
|
+
videoRef: React.RefObject<VideoType>;
|
|
103
105
|
visible: Animated.SharedValue<number>;
|
|
104
106
|
};
|
|
105
107
|
|
|
@@ -125,6 +127,7 @@ export const ImageGalleryFooterWithContext = <
|
|
|
125
127
|
selectedIndex,
|
|
126
128
|
ShareIcon,
|
|
127
129
|
videoControlElement,
|
|
130
|
+
videoRef,
|
|
128
131
|
visible,
|
|
129
132
|
} = props;
|
|
130
133
|
|
|
@@ -181,13 +184,14 @@ export const ImageGalleryFooterWithContext = <
|
|
|
181
184
|
<ReanimatedSafeAreaView style={[container, footerStyle, { backgroundColor: white }]}>
|
|
182
185
|
{photo.type === 'video' ? (
|
|
183
186
|
videoControlElement ? (
|
|
184
|
-
videoControlElement({ duration, onPlayPause, paused, progress })
|
|
187
|
+
videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
|
|
185
188
|
) : (
|
|
186
189
|
<ImageGalleryVideoControl
|
|
187
190
|
duration={duration}
|
|
188
191
|
onPlayPause={onPlayPause}
|
|
189
192
|
paused={paused}
|
|
190
193
|
progress={progress}
|
|
194
|
+
videoRef={videoRef}
|
|
191
195
|
/>
|
|
192
196
|
)
|
|
193
197
|
) : null}
|
|
@@ -35,7 +35,7 @@ const styles = StyleSheet.create({
|
|
|
35
35
|
|
|
36
36
|
export const ImageGalleryVideoControl: React.FC<ImageGalleryFooterVideoControlProps> = React.memo(
|
|
37
37
|
(props) => {
|
|
38
|
-
const { duration, onPlayPause, paused, progress } = props;
|
|
38
|
+
const { duration, onPlayPause, paused, progress, videoRef } = props;
|
|
39
39
|
|
|
40
40
|
const videoDuration = duration
|
|
41
41
|
? duration / 3600 >= 1
|
|
@@ -60,14 +60,19 @@ export const ImageGalleryVideoControl: React.FC<ImageGalleryFooterVideoControlPr
|
|
|
60
60
|
},
|
|
61
61
|
} = useTheme();
|
|
62
62
|
|
|
63
|
+
const handlePlayPause = async () => {
|
|
64
|
+
if (progress === 1) {
|
|
65
|
+
// For expo CLI
|
|
66
|
+
if (videoRef.current?.setPositionAsync) {
|
|
67
|
+
await videoRef.current.setPositionAsync(0);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
onPlayPause();
|
|
71
|
+
};
|
|
72
|
+
|
|
63
73
|
return (
|
|
64
74
|
<View style={[styles.videoContainer, videoContainer]}>
|
|
65
|
-
<TouchableOpacity
|
|
66
|
-
accessibilityLabel='Play Pause Button'
|
|
67
|
-
onPress={() => {
|
|
68
|
-
onPlayPause();
|
|
69
|
-
}}
|
|
70
|
-
>
|
|
75
|
+
<TouchableOpacity accessibilityLabel='Play Pause Button' onPress={handlePlayPause}>
|
|
71
76
|
<View style={[styles.roundedView, roundedView, { backgroundColor: static_white }]}>
|
|
72
77
|
{paused ? (
|
|
73
78
|
<Play accessibilityLabel='Play Icon' height={24} pathFill={static_black} width={24} />
|
|
@@ -5,8 +5,8 @@ import { BottomSheetFlatList, TouchableOpacity } from '@gorhom/bottom-sheet';
|
|
|
5
5
|
|
|
6
6
|
import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
|
|
7
7
|
import { useTheme } from '../../../contexts/themeContext/ThemeContext';
|
|
8
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
8
9
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
9
|
-
import { vw } from '../../../utils/utils';
|
|
10
10
|
|
|
11
11
|
import type { Photo } from '../ImageGallery';
|
|
12
12
|
|
|
@@ -71,6 +71,7 @@ const GridImage = <
|
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
} = useTheme();
|
|
74
|
+
const { vw } = useViewport();
|
|
74
75
|
const { imageComponent, ...restItem } = item;
|
|
75
76
|
|
|
76
77
|
const { numberOfImageGalleryGridColumns, selectAndClose, type, uri } = restItem;
|
|
@@ -2,10 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { StyleSheet, Text, View } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { useTheme } from '../../contexts/themeContext/ThemeContext';
|
|
5
|
+
import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
|
|
6
|
+
import { useViewport } from '../../hooks/useViewport';
|
|
5
7
|
import { MessageIcon } from '../../icons/MessageIcon';
|
|
6
|
-
import { vw } from '../../utils/utils';
|
|
7
|
-
|
|
8
|
-
const width = vw(33);
|
|
9
8
|
|
|
10
9
|
const styles = StyleSheet.create({
|
|
11
10
|
channelContainer: {
|
|
@@ -16,7 +15,6 @@ const styles = StyleSheet.create({
|
|
|
16
15
|
channelDetails: {
|
|
17
16
|
fontSize: 14,
|
|
18
17
|
textAlign: 'center',
|
|
19
|
-
width: vw(66),
|
|
20
18
|
},
|
|
21
19
|
channelTitle: {
|
|
22
20
|
fontSize: 16,
|
|
@@ -36,6 +34,9 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
|
|
|
36
34
|
emptyStateIndicator: { channelContainer, channelDetails, channelTitle },
|
|
37
35
|
},
|
|
38
36
|
} = useTheme();
|
|
37
|
+
const { vw } = useViewport();
|
|
38
|
+
const width = vw(33);
|
|
39
|
+
const { t } = useTranslationContext();
|
|
39
40
|
|
|
40
41
|
switch (listType) {
|
|
41
42
|
case 'channel':
|
|
@@ -46,13 +47,13 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
|
|
|
46
47
|
style={[styles.channelTitle, { color: black }, channelTitle]}
|
|
47
48
|
testID='empty-channel-state-title'
|
|
48
49
|
>
|
|
49
|
-
{"Let's start chatting!"}
|
|
50
|
+
{t("Let's start chatting!")}
|
|
50
51
|
</Text>
|
|
51
52
|
<Text
|
|
52
|
-
style={[styles.channelDetails, { color: grey }, channelDetails]}
|
|
53
|
+
style={[styles.channelDetails, { color: grey, width: vw(66) }, channelDetails]}
|
|
53
54
|
testID='empty-channel-state-details'
|
|
54
55
|
>
|
|
55
|
-
{'How about sending your first message to a friend?'}
|
|
56
|
+
{t('How about sending your first message to a friend?')}
|
|
56
57
|
</Text>
|
|
57
58
|
</View>
|
|
58
59
|
);
|
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
useTranslationContext,
|
|
20
20
|
} from '../../../contexts/translationContext/TranslationContext';
|
|
21
21
|
|
|
22
|
+
import { useViewport } from '../../../hooks/useViewport';
|
|
22
23
|
import type { DefaultStreamChatGenerics } from '../../../types/types';
|
|
23
|
-
import { MessageStatusTypes
|
|
24
|
+
import { MessageStatusTypes } from '../../../utils/utils';
|
|
24
25
|
|
|
25
26
|
const styles = StyleSheet.create({
|
|
26
27
|
containerInner: {
|
|
@@ -164,6 +165,7 @@ const MessageContentWithContext = <
|
|
|
164
165
|
},
|
|
165
166
|
},
|
|
166
167
|
} = useTheme();
|
|
168
|
+
const { vw } = useViewport();
|
|
167
169
|
|
|
168
170
|
const getDateText = (formatter?: (date: TDateTimeParserInput) => string) => {
|
|
169
171
|
if (!message.created_at) return '';
|
|
@@ -121,6 +121,7 @@ const ReactionListWithContext = <
|
|
|
121
121
|
avatarWrapper: { leftAlign, spacer },
|
|
122
122
|
reactionList: {
|
|
123
123
|
container,
|
|
124
|
+
iconFillColor,
|
|
124
125
|
middleIcon,
|
|
125
126
|
radius: themeRadius,
|
|
126
127
|
reactionBubble,
|
|
@@ -263,7 +264,7 @@ const ReactionListWithContext = <
|
|
|
263
264
|
{reactions.map((reaction) => (
|
|
264
265
|
<Icon
|
|
265
266
|
key={reaction.type}
|
|
266
|
-
pathFill={reaction.own ? accent_blue : grey}
|
|
267
|
+
pathFill={reaction.own ? iconFillColor || accent_blue : grey}
|
|
267
268
|
size={reactionSize / 2}
|
|
268
269
|
style={middleIcon}
|
|
269
270
|
supportedReactions={supportedReactions}
|