stream-chat-react-native-core 4.6.1 → 4.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Attachment.js +22 -13
- package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
- package/lib/commonjs/components/Attachment/Gallery.js +72 -37
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Attachment/VideoThumbnail.js +83 -0
- package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -0
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +1 -1
- package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
- package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +5 -5
- package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +19 -14
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -2
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
- package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +167 -345
- package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
- package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +31 -34
- package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +153 -0
- package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +1 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
- package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
- package/lib/commonjs/components/Message/Message.js +23 -13
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +4 -2
- package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +25 -23
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/Reply/Reply.js +32 -12
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/Spinner/Spinner.js +12 -4
- package/lib/commonjs/components/Spinner/Spinner.js.map +1 -1
- package/lib/commonjs/components/index.js +26 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
- package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +10 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/icons/Pause.js +61 -0
- package/lib/commonjs/icons/Pause.js.map +1 -0
- package/lib/commonjs/icons/Play.js +42 -0
- package/lib/commonjs/icons/Play.js.map +1 -0
- package/lib/commonjs/icons/index.js +26 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/mock-builders/api/queryMembers.js +98 -1
- package/lib/commonjs/mock-builders/api/queryMembers.js.map +1 -1
- package/lib/commonjs/native.js +7 -1
- package/lib/commonjs/native.js.map +1 -1
- package/lib/commonjs/utils/getUrlOfImageAttachment.js +1 -1
- package/lib/commonjs/utils/getUrlOfImageAttachment.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Attachment.js +22 -13
- package/lib/module/components/Attachment/Attachment.js.map +1 -1
- package/lib/module/components/Attachment/Gallery.js +72 -37
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Attachment/VideoThumbnail.js +83 -0
- package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -0
- package/lib/module/components/Attachment/hooks/useGoToURL.js +1 -1
- package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -1
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
- package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
- package/lib/module/components/Attachment/utils/getAspectRatio.js +5 -5
- package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +19 -14
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -2
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
- package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
- package/lib/module/components/ImageGallery/ImageGallery.js +167 -345
- package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
- package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
- package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
- package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
- package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
- package/lib/module/components/ImageGallery/components/ImageGrid.js +31 -34
- package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
- package/lib/module/components/ImageGallery/components/ProgressControl.js +153 -0
- package/lib/module/components/ImageGallery/components/ProgressControl.js.map +1 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
- package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
- package/lib/module/components/Message/Message.js +23 -13
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/hooks/useCreateMessageContext.js +4 -2
- package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +25 -23
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/Reply/Reply.js +32 -12
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/Spinner/Spinner.js +12 -4
- package/lib/module/components/Spinner/Spinner.js.map +1 -1
- package/lib/module/components/index.js +26 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/messageContext/MessageContext.js +2 -2
- package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +10 -1
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/icons/Pause.js +61 -0
- package/lib/module/icons/Pause.js.map +1 -0
- package/lib/module/icons/Play.js +42 -0
- package/lib/module/icons/Play.js.map +1 -0
- package/lib/module/icons/index.js +26 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/mock-builders/api/queryMembers.js +98 -1
- package/lib/module/mock-builders/api/queryMembers.js.map +1 -1
- package/lib/module/native.js +7 -1
- package/lib/module/native.js.map +1 -1
- package/lib/module/utils/getUrlOfImageAttachment.js +1 -1
- package/lib/module/utils/getUrlOfImageAttachment.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
- package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
- package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +1 -0
- package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.d.ts +1 -0
- package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayName.d.ts +4 -4
- package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -0
- package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +27 -0
- package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +18 -2
- package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +3 -0
- package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +5 -0
- package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +36 -0
- package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
- package/lib/typescript/components/Spinner/Spinner.d.ts +7 -1
- package/lib/typescript/components/index.d.ts +2 -0
- package/lib/typescript/contexts/messageContext/MessageContext.d.ts +3 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +1 -0
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
- package/lib/typescript/icons/Pause.d.ts +3 -0
- package/lib/typescript/icons/Play.d.ts +3 -0
- package/lib/typescript/icons/index.d.ts +2 -0
- package/lib/typescript/mock-builders/api/queryMembers.d.ts +161 -0
- package/lib/typescript/mock-builders/api/utils.d.ts +7 -0
- package/lib/typescript/mock-builders/generator/user.d.ts +30 -0
- package/lib/typescript/mock-builders/mock.d.ts +3 -0
- package/lib/typescript/native.d.ts +66 -1
- package/package.json +1 -1
- package/src/components/Attachment/Attachment.tsx +11 -7
- package/src/components/Attachment/Gallery.tsx +75 -36
- package/src/components/Attachment/VideoThumbnail.tsx +45 -0
- package/src/components/Attachment/hooks/useGoToURL.ts +1 -1
- package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +1 -0
- package/src/components/Attachment/utils/buildGallery/types.ts +1 -0
- package/src/components/Attachment/utils/getAspectRatio.ts +7 -5
- package/src/components/Channel/Channel.tsx +4 -0
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
- package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +83 -0
- package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +43 -26
- package/src/components/ImageGallery/ImageGallery.tsx +145 -667
- package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +4 -4
- package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +224 -0
- package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +114 -19
- package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +103 -0
- package/src/components/ImageGallery/components/ImageGrid.tsx +12 -25
- package/src/components/ImageGallery/components/ProgressControl.tsx +107 -0
- package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +722 -0
- package/src/components/Message/Message.tsx +10 -3
- package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
- package/src/components/MessageOverlay/MessageOverlay.tsx +2 -0
- package/src/components/Reply/Reply.tsx +36 -23
- package/src/components/Spinner/Spinner.tsx +11 -4
- package/src/components/index.ts +2 -0
- package/src/contexts/messageContext/MessageContext.tsx +2 -0
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +1 -0
- package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
- package/src/contexts/themeContext/utils/theme.ts +18 -0
- package/src/icons/Pause.tsx +14 -0
- package/src/icons/Play.tsx +17 -0
- package/src/icons/index.ts +2 -0
- package/src/mock-builders/api/queryMembers.js +98 -0
- package/src/native.ts +59 -1
- package/src/utils/getUrlOfImageAttachment.ts +1 -1
- package/src/version.json +1 -1
|
@@ -325,9 +325,12 @@ const MessageWithContext = <
|
|
|
325
325
|
!isMessageTypeDeleted && Array.isArray(message.attachments)
|
|
326
326
|
? message.attachments.reduce(
|
|
327
327
|
(acc, cur) => {
|
|
328
|
-
if (cur.type === 'file'
|
|
328
|
+
if (cur.type === 'file') {
|
|
329
329
|
acc.files.push(cur);
|
|
330
330
|
acc.other = []; // remove other attachments if a file exists
|
|
331
|
+
} else if (cur.type === 'video' && !cur.og_scrape_url) {
|
|
332
|
+
acc.videos.push({ image_url: cur.asset_url, type: 'video' });
|
|
333
|
+
acc.other = [];
|
|
331
334
|
} else if (cur.type === 'image' && !cur.title_link && !cur.og_scrape_url) {
|
|
332
335
|
/**
|
|
333
336
|
* this next if is not combined with the above one for cases where we have
|
|
@@ -338,7 +341,7 @@ const MessageWithContext = <
|
|
|
338
341
|
acc.other = []; // remove other attachments if an image exists
|
|
339
342
|
}
|
|
340
343
|
// only add other attachments if there are no files/images
|
|
341
|
-
} else if (!acc.files.length && !acc.images.length) {
|
|
344
|
+
} else if (!acc.files.length && !acc.images.length && !acc.videos.length) {
|
|
342
345
|
acc.other.push(cur);
|
|
343
346
|
}
|
|
344
347
|
|
|
@@ -348,12 +351,14 @@ const MessageWithContext = <
|
|
|
348
351
|
files: [] as Attachment<StreamChatGenerics>[],
|
|
349
352
|
images: [] as Attachment<StreamChatGenerics>[],
|
|
350
353
|
other: [] as Attachment<StreamChatGenerics>[],
|
|
354
|
+
videos: [] as Attachment<StreamChatGenerics>[],
|
|
351
355
|
},
|
|
352
356
|
)
|
|
353
357
|
: {
|
|
354
358
|
files: [] as Attachment<StreamChatGenerics>[],
|
|
355
359
|
images: [] as Attachment<StreamChatGenerics>[],
|
|
356
360
|
other: [] as Attachment<StreamChatGenerics>[],
|
|
361
|
+
videos: [] as Attachment<StreamChatGenerics>[],
|
|
357
362
|
};
|
|
358
363
|
|
|
359
364
|
/**
|
|
@@ -375,7 +380,7 @@ const MessageWithContext = <
|
|
|
375
380
|
case 'files':
|
|
376
381
|
return !!attachments.files.length;
|
|
377
382
|
case 'gallery':
|
|
378
|
-
return !!attachments.images.length;
|
|
383
|
+
return !!attachments.images.length || !!attachments.videos.length;
|
|
379
384
|
case 'text':
|
|
380
385
|
default:
|
|
381
386
|
return !!message.text;
|
|
@@ -536,6 +541,7 @@ const MessageWithContext = <
|
|
|
536
541
|
ownCapabilities,
|
|
537
542
|
supportedReactions,
|
|
538
543
|
threadList,
|
|
544
|
+
videos: attachments.videos,
|
|
539
545
|
});
|
|
540
546
|
|
|
541
547
|
setOverlay('message');
|
|
@@ -651,6 +657,7 @@ const MessageWithContext = <
|
|
|
651
657
|
showMessageOverlay,
|
|
652
658
|
showMessageStatus: typeof showMessageStatus === 'boolean' ? showMessageStatus : isMyMessage,
|
|
653
659
|
threadList,
|
|
660
|
+
videos: attachments.videos,
|
|
654
661
|
});
|
|
655
662
|
|
|
656
663
|
if (!(isMessageTypeDeleted || messageContentOrder.length)) return null;
|
|
@@ -42,6 +42,7 @@ export const useCreateMessageContext = <
|
|
|
42
42
|
showMessageOverlay,
|
|
43
43
|
showMessageStatus,
|
|
44
44
|
threadList,
|
|
45
|
+
videos,
|
|
45
46
|
}: MessageContextValue<StreamChatGenerics>) => {
|
|
46
47
|
const groupStylesLength = groupStyles.length;
|
|
47
48
|
const reactionsValue = reactions.map(({ own, type }) => `${own}${type}`).join();
|
|
@@ -93,6 +94,7 @@ export const useCreateMessageContext = <
|
|
|
93
94
|
showMessageOverlay,
|
|
94
95
|
showMessageStatus,
|
|
95
96
|
threadList,
|
|
97
|
+
videos,
|
|
96
98
|
}),
|
|
97
99
|
[
|
|
98
100
|
actionsEnabled,
|
|
@@ -135,6 +135,7 @@ const MessageOverlayWithContext = <
|
|
|
135
135
|
OverlayReactionsAvatar = OverlayReactionsAvatarDefault,
|
|
136
136
|
setOverlay,
|
|
137
137
|
threadList,
|
|
138
|
+
videos,
|
|
138
139
|
isMyMessage,
|
|
139
140
|
messageReactions,
|
|
140
141
|
error,
|
|
@@ -451,6 +452,7 @@ const MessageOverlayWithContext = <
|
|
|
451
452
|
key={`gallery_${messageContentOrderIndex}`}
|
|
452
453
|
message={message}
|
|
453
454
|
threadList={threadList}
|
|
455
|
+
videos={videos}
|
|
454
456
|
/>
|
|
455
457
|
)
|
|
456
458
|
);
|
|
@@ -24,6 +24,7 @@ import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
|
|
|
24
24
|
import { emojiRegex } from '../../utils/utils';
|
|
25
25
|
|
|
26
26
|
import { FileIcon as FileIconDefault } from '../Attachment/FileIcon';
|
|
27
|
+
import { VideoThumbnail } from '../Attachment/VideoThumbnail';
|
|
27
28
|
import { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';
|
|
28
29
|
import { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';
|
|
29
30
|
|
|
@@ -52,6 +53,13 @@ const styles = StyleSheet.create({
|
|
|
52
53
|
},
|
|
53
54
|
text: { fontSize: 12 },
|
|
54
55
|
textContainer: { maxWidth: undefined, paddingHorizontal: 8 },
|
|
56
|
+
videoAttachment: {
|
|
57
|
+
borderRadius: 8,
|
|
58
|
+
height: 50,
|
|
59
|
+
marginLeft: 8,
|
|
60
|
+
marginVertical: 8,
|
|
61
|
+
width: 50,
|
|
62
|
+
},
|
|
55
63
|
});
|
|
56
64
|
|
|
57
65
|
type ReplyPropsWithContext<
|
|
@@ -76,10 +84,9 @@ const getMessageType = <
|
|
|
76
84
|
) => {
|
|
77
85
|
let messageType;
|
|
78
86
|
|
|
79
|
-
const isLastAttachmentFile =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
lastAttachment.type === 'video';
|
|
87
|
+
const isLastAttachmentFile = lastAttachment.type === 'file' || lastAttachment.type === 'audio';
|
|
88
|
+
|
|
89
|
+
const isLastAttachmentVideo = lastAttachment.type === 'video';
|
|
83
90
|
|
|
84
91
|
const isLastAttachmentGiphy = lastAttachment.type === 'giphy' || lastAttachment.type === 'imgur';
|
|
85
92
|
|
|
@@ -90,6 +97,8 @@ const getMessageType = <
|
|
|
90
97
|
|
|
91
98
|
if (isLastAttachmentFile) {
|
|
92
99
|
messageType = 'file';
|
|
100
|
+
} else if (isLastAttachmentVideo) {
|
|
101
|
+
messageType = 'video';
|
|
93
102
|
} else if (isLastAttachmentImageOrGiphy) {
|
|
94
103
|
if (isLastAttachmentImage) messageType = 'image';
|
|
95
104
|
else messageType = undefined;
|
|
@@ -194,6 +203,7 @@ const ReplyWithContext = <
|
|
|
194
203
|
/>
|
|
195
204
|
) : null
|
|
196
205
|
) : null}
|
|
206
|
+
{messageType === 'video' ? <VideoThumbnail style={[styles.videoAttachment]} /> : null}
|
|
197
207
|
<MessageTextContainer<StreamChatGenerics>
|
|
198
208
|
markdownStyles={
|
|
199
209
|
quotedMessage.deleted_at
|
|
@@ -210,6 +220,8 @@ const ReplyWithContext = <
|
|
|
210
220
|
: quotedMessage.text
|
|
211
221
|
: messageType === 'image'
|
|
212
222
|
? t('Photo')
|
|
223
|
+
: messageType === 'video'
|
|
224
|
+
? 'Video'
|
|
213
225
|
: messageType === 'file'
|
|
214
226
|
? lastAttachment?.title || ''
|
|
215
227
|
: '',
|
|
@@ -218,25 +230,26 @@ const ReplyWithContext = <
|
|
|
218
230
|
styles={{
|
|
219
231
|
textContainer: [
|
|
220
232
|
{
|
|
221
|
-
marginRight:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
imageAttachment
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
imageAttachment
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
fileAttachmentContainer
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
233
|
+
marginRight:
|
|
234
|
+
hasImage || messageType === 'video'
|
|
235
|
+
? Number(
|
|
236
|
+
stylesProp.imageAttachment?.height ||
|
|
237
|
+
imageAttachment.height ||
|
|
238
|
+
styles.imageAttachment.height,
|
|
239
|
+
) +
|
|
240
|
+
Number(
|
|
241
|
+
stylesProp.imageAttachment?.marginLeft ||
|
|
242
|
+
imageAttachment.marginLeft ||
|
|
243
|
+
styles.imageAttachment.marginLeft,
|
|
244
|
+
)
|
|
245
|
+
: messageType === 'file'
|
|
246
|
+
? attachmentSize +
|
|
247
|
+
Number(
|
|
248
|
+
stylesProp.fileAttachmentContainer?.paddingLeft ||
|
|
249
|
+
fileAttachmentContainer.paddingLeft ||
|
|
250
|
+
styles.fileAttachmentContainer.paddingLeft,
|
|
251
|
+
)
|
|
252
|
+
: undefined,
|
|
240
253
|
},
|
|
241
254
|
styles.textContainer,
|
|
242
255
|
textContainer,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
-
import { StyleSheet, ViewStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, StyleSheet, ViewStyle } from 'react-native';
|
|
3
3
|
import Animated, {
|
|
4
4
|
Easing,
|
|
5
5
|
useAnimatedStyle,
|
|
@@ -20,8 +20,15 @@ const styles = StyleSheet.create({
|
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export
|
|
23
|
+
export type SpinnerProps = {
|
|
24
|
+
height?: number;
|
|
25
|
+
style?: StyleProp<ViewStyle>;
|
|
26
|
+
width?: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Spinner: React.FC<SpinnerProps> = (props) => {
|
|
24
30
|
const rotation = useSharedValue(0);
|
|
31
|
+
const { height, style, width } = props;
|
|
25
32
|
|
|
26
33
|
const {
|
|
27
34
|
theme: {
|
|
@@ -49,8 +56,8 @@ export const Spinner: React.FC = () => {
|
|
|
49
56
|
}, []);
|
|
50
57
|
|
|
51
58
|
return (
|
|
52
|
-
<Animated.View style={[styles.spinner, animatedStyle, spinner]}>
|
|
53
|
-
<Loading stopColor={accent_blue} />
|
|
59
|
+
<Animated.View style={[style, styles.spinner, animatedStyle, spinner, { height, width }]}>
|
|
60
|
+
<Loading height={height} stopColor={accent_blue} width={width} />
|
|
54
61
|
</Animated.View>
|
|
55
62
|
);
|
|
56
63
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from './Attachment/FileAttachmentGroup';
|
|
|
6
6
|
export * from './Attachment/FileIcon';
|
|
7
7
|
export * from './Attachment/Gallery';
|
|
8
8
|
export * from './Attachment/Giphy';
|
|
9
|
+
export * from './Attachment/VideoThumbnail';
|
|
9
10
|
export * from './Attachment/utils/buildGallery/buildGallery';
|
|
10
11
|
|
|
11
12
|
export * from './AttachmentPicker/AttachmentPicker';
|
|
@@ -74,6 +75,7 @@ export * from './Chat/hooks/useMutedUsers';
|
|
|
74
75
|
|
|
75
76
|
export * from './ImageGallery/ImageGallery';
|
|
76
77
|
export * from './ImageGallery/components/AnimatedGalleryImage';
|
|
78
|
+
export * from './ImageGallery/components/AnimatedGalleryVideo';
|
|
77
79
|
export * from './ImageGallery/components/ImageGalleryFooter';
|
|
78
80
|
export * from './ImageGallery/components/ImageGalleryHeader';
|
|
79
81
|
export * from './ImageGallery/components/ImageGalleryOverlay';
|
|
@@ -91,6 +91,8 @@ export type MessageContextValue<
|
|
|
91
91
|
showMessageStatus: boolean;
|
|
92
92
|
/** Whether or not the Message is part of a Thread */
|
|
93
93
|
threadList: boolean;
|
|
94
|
+
/** The videos attached to a message */
|
|
95
|
+
videos: Attachment<StreamChatGenerics>[];
|
|
94
96
|
goToMessage?: (messageId: string) => void;
|
|
95
97
|
/** Latest message id on current channel */
|
|
96
98
|
lastReceivedId?: string;
|
|
@@ -14,6 +14,7 @@ import type { FileAttachmentGroupProps } from '../../components/Attachment/FileA
|
|
|
14
14
|
import type { FileIconProps } from '../../components/Attachment/FileIcon';
|
|
15
15
|
import type { GalleryProps } from '../../components/Attachment/Gallery';
|
|
16
16
|
import type { GiphyProps } from '../../components/Attachment/Giphy';
|
|
17
|
+
import type { VideoThumbnailProps } from '../../components/Attachment/VideoThumbnail';
|
|
17
18
|
import type {
|
|
18
19
|
MessageProps,
|
|
19
20
|
MessageTouchableHandlerPayload,
|
|
@@ -228,6 +229,7 @@ export type MessagesContextValue<
|
|
|
228
229
|
* Defaults to https://github.com/GetStream/stream-chat-react-native/blob/main/package/src/components/Attachment/Card.tsx
|
|
229
230
|
*/
|
|
230
231
|
UrlPreview: React.ComponentType<CardProps<StreamChatGenerics>>;
|
|
232
|
+
VideoThumbnail: React.ComponentType<VideoThumbnailProps>;
|
|
231
233
|
/**
|
|
232
234
|
* Provide any additional props for `TouchableOpacity` which wraps inner MessageContent component here.
|
|
233
235
|
* Please check docs for TouchableOpacity for supported props - https://reactnative.dev/docs/touchableopacity#props
|
|
@@ -196,6 +196,11 @@ export type Theme = {
|
|
|
196
196
|
rightContainer: ViewStyle;
|
|
197
197
|
usernameText: TextStyle;
|
|
198
198
|
};
|
|
199
|
+
videoControl: {
|
|
200
|
+
durationTextStyle: TextStyle;
|
|
201
|
+
roundedView: ViewStyle;
|
|
202
|
+
videoContainer: ViewStyle;
|
|
203
|
+
};
|
|
199
204
|
backgroundColor?: string;
|
|
200
205
|
pager?: ViewStyle;
|
|
201
206
|
slide?: ImageStyle;
|
|
@@ -476,6 +481,10 @@ export type Theme = {
|
|
|
476
481
|
timeIcon: IconProps;
|
|
477
482
|
};
|
|
478
483
|
targetedMessageUnderlay: ViewStyle;
|
|
484
|
+
videoThumbnail: {
|
|
485
|
+
container: ViewStyle;
|
|
486
|
+
roundedView: ViewStyle;
|
|
487
|
+
};
|
|
479
488
|
};
|
|
480
489
|
overlay: {
|
|
481
490
|
container: ViewStyle;
|
|
@@ -669,6 +678,11 @@ export const defaultTheme: Theme = {
|
|
|
669
678
|
rightContainer: {},
|
|
670
679
|
usernameText: {},
|
|
671
680
|
},
|
|
681
|
+
videoControl: {
|
|
682
|
+
durationTextStyle: {},
|
|
683
|
+
roundedView: {},
|
|
684
|
+
videoContainer: {},
|
|
685
|
+
},
|
|
672
686
|
},
|
|
673
687
|
inlineDateSeparator: {
|
|
674
688
|
container: {},
|
|
@@ -983,6 +997,10 @@ export const defaultTheme: Theme = {
|
|
|
983
997
|
},
|
|
984
998
|
},
|
|
985
999
|
targetedMessageUnderlay: {},
|
|
1000
|
+
videoThumbnail: {
|
|
1001
|
+
container: {},
|
|
1002
|
+
roundedView: {},
|
|
1003
|
+
},
|
|
986
1004
|
},
|
|
987
1005
|
overlay: {
|
|
988
1006
|
container: {},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Rect } from 'react-native-svg';
|
|
3
|
+
|
|
4
|
+
import { IconProps, RootSvg } from './utils/base';
|
|
5
|
+
|
|
6
|
+
export const Pause: React.FC<IconProps> = (props) => {
|
|
7
|
+
const { height, width } = props;
|
|
8
|
+
return (
|
|
9
|
+
<RootSvg height={height} viewBox={`0 0 ${height} ${width}`} width={width} {...props}>
|
|
10
|
+
<Rect fill={'black'} height={14} width={4} x={6} y={5} />
|
|
11
|
+
<Rect fill={'black'} height={14} width={4} x={14} y={5} />
|
|
12
|
+
</RootSvg>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { IconProps, RootPath, RootSvg } from './utils/base';
|
|
4
|
+
|
|
5
|
+
export const Play: React.FC<IconProps> = (props) => (
|
|
6
|
+
<RootSvg
|
|
7
|
+
height={props.height}
|
|
8
|
+
viewBox={`0 0 ${props.height} ${props.width}`}
|
|
9
|
+
width={props.width}
|
|
10
|
+
{...props}
|
|
11
|
+
>
|
|
12
|
+
<RootPath
|
|
13
|
+
d='M 9.5547 5.03647 C 8.89014 4.59343 8 5.06982 8 5.86852 V 18.1315 C 8 18.9302 8.89015 19.4066 9.5547 18.9635 L 18.7519 12.8321 C 19.3457 12.4362 19.3457 11.5638 18.7519 11.1679 L 9.5547 5.03647 Z'
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</RootSvg>
|
|
17
|
+
);
|
package/src/icons/index.ts
CHANGED
|
@@ -45,10 +45,12 @@ export * from './MessageIcon';
|
|
|
45
45
|
export * from './Mute';
|
|
46
46
|
export * from './Notification';
|
|
47
47
|
export * from './ODT';
|
|
48
|
+
export * from './Pause';
|
|
48
49
|
export * from './PDF';
|
|
49
50
|
export * from './Picture';
|
|
50
51
|
export * from './Pin';
|
|
51
52
|
export * from './PinHeader';
|
|
53
|
+
export * from './Play';
|
|
52
54
|
export * from './PPT';
|
|
53
55
|
export * from './PPTX';
|
|
54
56
|
export * from './RAR';
|
|
@@ -14,3 +14,101 @@ export const queryMembersApi = (members = []) => {
|
|
|
14
14
|
|
|
15
15
|
return mockedApiResponse(result, 'get');
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
export const ONE_CHANNEL_MEMBER_MOCK = {
|
|
19
|
+
okey: {
|
|
20
|
+
banned: false,
|
|
21
|
+
channel_role: 'channel_member',
|
|
22
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
23
|
+
role: 'member',
|
|
24
|
+
shadow_banned: false,
|
|
25
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
26
|
+
user: {
|
|
27
|
+
id: 'okechukwu nwagba martin',
|
|
28
|
+
name: 'okechukwu nwagba martin',
|
|
29
|
+
},
|
|
30
|
+
user_id: 'okechukwu nwagba martin',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const GROUP_CHANNEL_MEMBERS_MOCK = {
|
|
35
|
+
ben: {
|
|
36
|
+
banned: false,
|
|
37
|
+
channel_role: 'channel_member',
|
|
38
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
39
|
+
role: 'member',
|
|
40
|
+
shadow_banned: false,
|
|
41
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
42
|
+
user: {
|
|
43
|
+
id: 'ben',
|
|
44
|
+
name: 'ben',
|
|
45
|
+
},
|
|
46
|
+
user_id: 'ben',
|
|
47
|
+
},
|
|
48
|
+
nick: {
|
|
49
|
+
banned: false,
|
|
50
|
+
channel_role: 'channel_member',
|
|
51
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
52
|
+
role: 'member',
|
|
53
|
+
shadow_banned: false,
|
|
54
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
55
|
+
user: {
|
|
56
|
+
id: 'nick',
|
|
57
|
+
name: 'nick',
|
|
58
|
+
},
|
|
59
|
+
user_id: 'nick',
|
|
60
|
+
},
|
|
61
|
+
okey: {
|
|
62
|
+
banned: false,
|
|
63
|
+
channel_role: 'channel_member',
|
|
64
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
65
|
+
role: 'member',
|
|
66
|
+
shadow_banned: false,
|
|
67
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
68
|
+
user: {
|
|
69
|
+
id: 'okechukwu nwagba',
|
|
70
|
+
name: 'okechukwu nwagba',
|
|
71
|
+
},
|
|
72
|
+
user_id: 'okechukwu nwagba',
|
|
73
|
+
},
|
|
74
|
+
qatest1: {
|
|
75
|
+
banned: false,
|
|
76
|
+
channel_role: 'channel_member',
|
|
77
|
+
created_at: '2021-01-28T09:08:43.274508Z',
|
|
78
|
+
role: 'member',
|
|
79
|
+
shadow_banned: false,
|
|
80
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
81
|
+
user: {
|
|
82
|
+
id: 'qatest1',
|
|
83
|
+
name: 'qatest1',
|
|
84
|
+
},
|
|
85
|
+
user_id: 'qatest1',
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
thierry: {
|
|
89
|
+
banned: false,
|
|
90
|
+
channel_role: 'channel_member',
|
|
91
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
92
|
+
role: 'member',
|
|
93
|
+
shadow_banned: false,
|
|
94
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
95
|
+
user: {
|
|
96
|
+
id: 'thierry',
|
|
97
|
+
name: 'thierry',
|
|
98
|
+
},
|
|
99
|
+
user_id: 'thierry',
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export const ONE_MEMBER_WITH_EMPTY_USER_MOCK = {
|
|
104
|
+
okey: {
|
|
105
|
+
banned: false,
|
|
106
|
+
channel_role: 'channel_member',
|
|
107
|
+
created_at: '2021-01-27T11:54:34.173125Z',
|
|
108
|
+
role: 'member',
|
|
109
|
+
shadow_banned: false,
|
|
110
|
+
updated_at: '2021-02-12T12:12:35.862282Z',
|
|
111
|
+
user: {},
|
|
112
|
+
user_id: 'okechukwu nwagba martin',
|
|
113
|
+
},
|
|
114
|
+
};
|
package/src/native.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { FlatList as DefaultFlatList, StyleProp, ViewStyle } from 'react-native';
|
|
2
3
|
|
|
3
4
|
import type { NetInfoSubscription } from '@react-native-community/netinfo';
|
|
4
5
|
|
|
@@ -94,6 +95,58 @@ export let triggerHaptic: TriggerHaptic = fail;
|
|
|
94
95
|
|
|
95
96
|
export let SDK: string;
|
|
96
97
|
|
|
98
|
+
export type PlaybackStatus = {
|
|
99
|
+
didJustFinish: boolean;
|
|
100
|
+
durationMillis: number;
|
|
101
|
+
error: string;
|
|
102
|
+
isBuffering: boolean;
|
|
103
|
+
isLoaded: boolean;
|
|
104
|
+
isLooping: boolean;
|
|
105
|
+
isPlaying: boolean;
|
|
106
|
+
positionMillis: number;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type VideoProgressData = {
|
|
110
|
+
currentTime?: number;
|
|
111
|
+
playableDuration?: number;
|
|
112
|
+
seekableDuration?: number;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type VideoPayloadData = {
|
|
116
|
+
audioTracks?: { index: number; language: string; title: string; type: string }[];
|
|
117
|
+
currentPosition?: number;
|
|
118
|
+
duration?: number;
|
|
119
|
+
naturalSize?: { height: number; orientation: 'portrait' | 'landscape'; width: number };
|
|
120
|
+
textTracks?: { index: number; language: string; title: string; type: string }[];
|
|
121
|
+
videoTracks?: {
|
|
122
|
+
bitrate: number;
|
|
123
|
+
codecs: string;
|
|
124
|
+
height: number;
|
|
125
|
+
trackId: number;
|
|
126
|
+
width: number;
|
|
127
|
+
}[];
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
export type VideoType = {
|
|
131
|
+
paused: boolean;
|
|
132
|
+
uri: string;
|
|
133
|
+
videoRef: React.RefObject<VideoType>;
|
|
134
|
+
onBuffer?: (props: { isBuffering: boolean }) => void;
|
|
135
|
+
onEnd?: () => void;
|
|
136
|
+
onLoad?: (payload: VideoPayloadData) => void;
|
|
137
|
+
onLoadStart?: () => void;
|
|
138
|
+
onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;
|
|
139
|
+
onProgress?: (data: VideoProgressData) => void;
|
|
140
|
+
onReadyForDisplay?: () => void;
|
|
141
|
+
replayAsync?: () => void;
|
|
142
|
+
resizeMode?: string;
|
|
143
|
+
seek?: (progress: number) => void;
|
|
144
|
+
setPositionAsync?: (position: number) => void;
|
|
145
|
+
style?: StyleProp<ViewStyle>;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export let Video: React.ComponentType<VideoType> = fail;
|
|
149
|
+
|
|
97
150
|
type Handlers = {
|
|
98
151
|
compressImage?: CompressImage;
|
|
99
152
|
deleteFile?: DeleteFile;
|
|
@@ -107,6 +160,7 @@ type Handlers = {
|
|
|
107
160
|
shareImage?: ShareImage;
|
|
108
161
|
takePhoto?: TakePhoto;
|
|
109
162
|
triggerHaptic?: TriggerHaptic;
|
|
163
|
+
Video?: React.ComponentType<VideoType>;
|
|
110
164
|
};
|
|
111
165
|
|
|
112
166
|
export const registerNativeHandlers = (handlers: Handlers) => {
|
|
@@ -160,4 +214,8 @@ export const registerNativeHandlers = (handlers: Handlers) => {
|
|
|
160
214
|
if (handlers.triggerHaptic) {
|
|
161
215
|
triggerHaptic = handlers.triggerHaptic;
|
|
162
216
|
}
|
|
217
|
+
|
|
218
|
+
if (handlers.Video) {
|
|
219
|
+
Video = handlers.Video;
|
|
220
|
+
}
|
|
163
221
|
};
|
package/src/version.json
CHANGED