stream-chat-react-native-core 4.6.0 → 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.
Files changed (206) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +22 -13
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Gallery.js +72 -37
  4. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/VideoThumbnail.js +83 -0
  6. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -0
  7. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +1 -1
  8. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -1
  9. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  10. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +5 -5
  12. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
  13. package/lib/commonjs/components/Channel/Channel.js +19 -14
  14. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  15. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  16. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  17. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  18. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  19. package/lib/commonjs/components/ImageGallery/ImageGallery.js +167 -345
  20. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  21. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  22. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  23. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  24. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  25. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  26. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  27. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  28. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  29. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +31 -34
  30. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  31. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +153 -0
  32. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +1 -0
  33. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  34. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  35. package/lib/commonjs/components/Message/Message.js +23 -13
  36. package/lib/commonjs/components/Message/Message.js.map +1 -1
  37. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +58 -33
  38. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  39. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +4 -2
  40. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  41. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +25 -23
  42. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  43. package/lib/commonjs/components/Reply/Reply.js +32 -12
  44. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  45. package/lib/commonjs/components/Spinner/Spinner.js +12 -4
  46. package/lib/commonjs/components/Spinner/Spinner.js.map +1 -1
  47. package/lib/commonjs/components/index.js +26 -0
  48. package/lib/commonjs/components/index.js.map +1 -1
  49. package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
  50. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  51. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  52. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  53. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  54. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  55. package/lib/commonjs/contexts/themeContext/utils/theme.js +10 -1
  56. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  57. package/lib/commonjs/icons/Pause.js +61 -0
  58. package/lib/commonjs/icons/Pause.js.map +1 -0
  59. package/lib/commonjs/icons/Play.js +42 -0
  60. package/lib/commonjs/icons/Play.js.map +1 -0
  61. package/lib/commonjs/icons/index.js +26 -0
  62. package/lib/commonjs/icons/index.js.map +1 -1
  63. package/lib/commonjs/mock-builders/api/queryMembers.js +98 -1
  64. package/lib/commonjs/mock-builders/api/queryMembers.js.map +1 -1
  65. package/lib/commonjs/native.js +7 -1
  66. package/lib/commonjs/native.js.map +1 -1
  67. package/lib/commonjs/utils/getUrlOfImageAttachment.js +1 -1
  68. package/lib/commonjs/utils/getUrlOfImageAttachment.js.map +1 -1
  69. package/lib/commonjs/version.json +1 -1
  70. package/lib/module/components/Attachment/Attachment.js +22 -13
  71. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  72. package/lib/module/components/Attachment/Gallery.js +72 -37
  73. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  74. package/lib/module/components/Attachment/VideoThumbnail.js +83 -0
  75. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -0
  76. package/lib/module/components/Attachment/hooks/useGoToURL.js +1 -1
  77. package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -1
  78. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  79. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  80. package/lib/module/components/Attachment/utils/getAspectRatio.js +5 -5
  81. package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
  82. package/lib/module/components/Channel/Channel.js +19 -14
  83. package/lib/module/components/Channel/Channel.js.map +1 -1
  84. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  85. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  86. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  87. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  88. package/lib/module/components/ImageGallery/ImageGallery.js +167 -345
  89. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  90. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  91. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  92. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  93. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  94. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  95. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  96. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  97. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  98. package/lib/module/components/ImageGallery/components/ImageGrid.js +31 -34
  99. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  100. package/lib/module/components/ImageGallery/components/ProgressControl.js +153 -0
  101. package/lib/module/components/ImageGallery/components/ProgressControl.js.map +1 -0
  102. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  103. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  104. package/lib/module/components/Message/Message.js +23 -13
  105. package/lib/module/components/Message/Message.js.map +1 -1
  106. package/lib/module/components/Message/MessageSimple/MessageContent.js +58 -33
  107. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  108. package/lib/module/components/Message/hooks/useCreateMessageContext.js +4 -2
  109. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  110. package/lib/module/components/MessageOverlay/MessageOverlay.js +25 -23
  111. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  112. package/lib/module/components/Reply/Reply.js +32 -12
  113. package/lib/module/components/Reply/Reply.js.map +1 -1
  114. package/lib/module/components/Spinner/Spinner.js +12 -4
  115. package/lib/module/components/Spinner/Spinner.js.map +1 -1
  116. package/lib/module/components/index.js +26 -0
  117. package/lib/module/components/index.js.map +1 -1
  118. package/lib/module/contexts/messageContext/MessageContext.js +2 -2
  119. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  120. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  121. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  122. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  123. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  124. package/lib/module/contexts/themeContext/utils/theme.js +10 -1
  125. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  126. package/lib/module/icons/Pause.js +61 -0
  127. package/lib/module/icons/Pause.js.map +1 -0
  128. package/lib/module/icons/Play.js +42 -0
  129. package/lib/module/icons/Play.js.map +1 -0
  130. package/lib/module/icons/index.js +26 -0
  131. package/lib/module/icons/index.js.map +1 -1
  132. package/lib/module/mock-builders/api/queryMembers.js +98 -1
  133. package/lib/module/mock-builders/api/queryMembers.js.map +1 -1
  134. package/lib/module/native.js +7 -1
  135. package/lib/module/native.js.map +1 -1
  136. package/lib/module/utils/getUrlOfImageAttachment.js +1 -1
  137. package/lib/module/utils/getUrlOfImageAttachment.js.map +1 -1
  138. package/lib/module/version.json +1 -1
  139. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  140. package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
  141. package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +1 -0
  142. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
  143. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  144. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  145. package/lib/typescript/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.d.ts +1 -0
  146. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayName.d.ts +4 -4
  147. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -0
  148. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +27 -0
  149. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +18 -2
  150. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +3 -0
  151. package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +5 -0
  152. package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +36 -0
  153. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  154. package/lib/typescript/components/Spinner/Spinner.d.ts +7 -1
  155. package/lib/typescript/components/index.d.ts +2 -0
  156. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +3 -1
  157. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +1 -0
  158. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
  159. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
  160. package/lib/typescript/icons/Pause.d.ts +3 -0
  161. package/lib/typescript/icons/Play.d.ts +3 -0
  162. package/lib/typescript/icons/index.d.ts +2 -0
  163. package/lib/typescript/mock-builders/api/queryMembers.d.ts +161 -0
  164. package/lib/typescript/mock-builders/api/utils.d.ts +7 -0
  165. package/lib/typescript/mock-builders/generator/user.d.ts +30 -0
  166. package/lib/typescript/mock-builders/mock.d.ts +3 -0
  167. package/lib/typescript/native.d.ts +66 -1
  168. package/package.json +1 -1
  169. package/src/components/Attachment/Attachment.tsx +11 -7
  170. package/src/components/Attachment/Gallery.tsx +75 -36
  171. package/src/components/Attachment/VideoThumbnail.tsx +45 -0
  172. package/src/components/Attachment/hooks/useGoToURL.ts +1 -1
  173. package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +1 -0
  174. package/src/components/Attachment/utils/buildGallery/types.ts +1 -0
  175. package/src/components/Attachment/utils/getAspectRatio.ts +7 -5
  176. package/src/components/Channel/Channel.tsx +4 -0
  177. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  178. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +83 -0
  179. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +43 -26
  180. package/src/components/ImageGallery/ImageGallery.tsx +145 -667
  181. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +4 -4
  182. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +224 -0
  183. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +114 -19
  184. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +103 -0
  185. package/src/components/ImageGallery/components/ImageGrid.tsx +12 -25
  186. package/src/components/ImageGallery/components/ProgressControl.tsx +107 -0
  187. package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +722 -0
  188. package/src/components/Message/Message.tsx +10 -3
  189. package/src/components/Message/MessageSimple/MessageContent.tsx +50 -16
  190. package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
  191. package/src/components/MessageOverlay/MessageOverlay.tsx +2 -0
  192. package/src/components/Reply/Reply.tsx +36 -23
  193. package/src/components/Spinner/Spinner.tsx +11 -4
  194. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +0 -12
  195. package/src/components/index.ts +2 -0
  196. package/src/contexts/messageContext/MessageContext.tsx +2 -0
  197. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +1 -0
  198. package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
  199. package/src/contexts/themeContext/utils/theme.ts +18 -0
  200. package/src/icons/Pause.tsx +14 -0
  201. package/src/icons/Play.tsx +17 -0
  202. package/src/icons/index.ts +2 -0
  203. package/src/mock-builders/api/queryMembers.js +98 -0
  204. package/src/native.ts +59 -1
  205. package/src/utils/getUrlOfImageAttachment.ts +1 -1
  206. 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' || cur.type === 'video') {
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;
@@ -143,7 +143,16 @@ const MessageContentWithContext = <
143
143
  colors: { accent_red, blue_alice, grey_gainsboro, grey_whisper, transparent, white },
144
144
  messageSimple: {
145
145
  content: {
146
- container: { borderRadius, borderRadiusL, borderRadiusS, ...container },
146
+ container: {
147
+ borderBottomLeftRadius,
148
+ borderBottomRightRadius,
149
+ borderRadius,
150
+ borderRadiusL,
151
+ borderRadiusS,
152
+ borderTopLeftRadius,
153
+ borderTopRightRadius,
154
+ ...container
155
+ },
147
156
  containerInner,
148
157
  errorContainer,
149
158
  errorIcon,
@@ -225,18 +234,46 @@ const MessageContentWithContext = <
225
234
 
226
235
  const isBorderColor = isMyMessage && !error;
227
236
 
228
- const shouldApplyBorderRadius = (firstGroupStyle: string, secondGroupStyle: string): boolean =>
229
- (groupStyle === firstGroupStyle || groupStyle === secondGroupStyle) &&
230
- (!hasThreadReplies || threadList);
237
+ const getBorderRadius = () => {
238
+ // enum('top', 'middle', 'bottom', 'single')
239
+ const groupPosition = groupStyles?.[0];
240
+
241
+ const isBottomOrSingle = groupPosition === 'single' || groupPosition === 'bottom';
242
+ let borderBottomLeftRadius = borderRadiusL;
243
+ let borderBottomRightRadius = borderRadiusL;
244
+
245
+ if (isBottomOrSingle && (!hasThreadReplies || threadList)) {
246
+ // add relevant sharp corner
247
+ if (alignment === 'left') {
248
+ borderBottomLeftRadius = borderRadiusS;
249
+ } else {
250
+ borderBottomRightRadius = borderRadiusS;
251
+ }
252
+ }
253
+
254
+ return {
255
+ borderBottomLeftRadius,
256
+ borderBottomRightRadius,
257
+ };
258
+ };
231
259
 
232
- const applyBorderRadius = (
233
- firstGroupStyle: string,
234
- secondGroupStyle: string,
235
- ): number | undefined => {
236
- if (shouldApplyBorderRadius(firstGroupStyle, secondGroupStyle)) {
237
- return borderRadiusS;
260
+ const getBorderRadiusFromTheme = () => {
261
+ const bordersFromTheme: Record<string, number | undefined> = {
262
+ borderBottomLeftRadius,
263
+ borderBottomRightRadius,
264
+ borderRadius,
265
+ borderTopLeftRadius,
266
+ borderTopRightRadius,
267
+ };
268
+
269
+ // filter out undefined values
270
+ for (const key in bordersFromTheme) {
271
+ if (bordersFromTheme[key] === undefined) {
272
+ delete bordersFromTheme[key];
273
+ }
238
274
  }
239
- return borderRadiusL;
275
+
276
+ return bordersFromTheme;
240
277
  };
241
278
 
242
279
  return (
@@ -313,12 +350,9 @@ const MessageContentWithContext = <
313
350
  styles.containerInner,
314
351
  {
315
352
  backgroundColor,
316
- borderBottomLeftRadius: applyBorderRadius('left_bottom', 'left_single'),
317
- borderBottomRightRadius: applyBorderRadius('right_bottom', 'right_single'),
318
353
  borderColor: isBorderColor ? backgroundColor : grey_whisper,
319
- borderRadius,
320
- borderTopLeftRadius: applyBorderRadius('left_top', 'right_single'),
321
- borderTopRightRadius: applyBorderRadius('right_top', 'right_single'),
354
+ ...getBorderRadius(),
355
+ ...getBorderRadiusFromTheme(),
322
356
  },
323
357
  noBorder ? { borderWidth: 0 } : {},
324
358
  containerInner,
@@ -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
- lastAttachment.type === 'file' ||
81
- lastAttachment.type === 'audio' ||
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: hasImage
222
- ? Number(
223
- stylesProp.imageAttachment?.height ||
224
- imageAttachment.height ||
225
- styles.imageAttachment.height,
226
- ) +
227
- Number(
228
- stylesProp.imageAttachment?.marginLeft ||
229
- imageAttachment.marginLeft ||
230
- styles.imageAttachment.marginLeft,
231
- )
232
- : messageType === 'file'
233
- ? attachmentSize +
234
- Number(
235
- stylesProp.fileAttachmentContainer?.paddingLeft ||
236
- fileAttachmentContainer.paddingLeft ||
237
- styles.fileAttachmentContainer.paddingLeft,
238
- )
239
- : undefined,
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 const Spinner: React.FC = () => {
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
  };
@@ -369,9 +369,6 @@ exports[`Thread should match thread snapshot 1`] = `
369
369
  "borderBottomLeftRadius": 0,
370
370
  "borderBottomRightRadius": 16,
371
371
  "borderColor": "#ECEBEB",
372
- "borderRadius": undefined,
373
- "borderTopLeftRadius": 16,
374
- "borderTopRightRadius": 16,
375
372
  },
376
373
  Object {},
377
374
  Object {},
@@ -620,9 +617,6 @@ exports[`Thread should match thread snapshot 1`] = `
620
617
  "borderBottomLeftRadius": 0,
621
618
  "borderBottomRightRadius": 16,
622
619
  "borderColor": "#ECEBEB",
623
- "borderRadius": undefined,
624
- "borderTopLeftRadius": 16,
625
- "borderTopRightRadius": 16,
626
620
  },
627
621
  Object {},
628
622
  Object {},
@@ -871,9 +865,6 @@ exports[`Thread should match thread snapshot 1`] = `
871
865
  "borderBottomLeftRadius": 0,
872
866
  "borderBottomRightRadius": 16,
873
867
  "borderColor": "#ECEBEB",
874
- "borderRadius": undefined,
875
- "borderTopLeftRadius": 16,
876
- "borderTopRightRadius": 16,
877
868
  },
878
869
  Object {},
879
870
  Object {},
@@ -1170,9 +1161,6 @@ exports[`Thread should match thread snapshot 1`] = `
1170
1161
  "borderBottomLeftRadius": 0,
1171
1162
  "borderBottomRightRadius": 16,
1172
1163
  "borderColor": "#ECEBEB",
1173
- "borderRadius": undefined,
1174
- "borderTopLeftRadius": 16,
1175
- "borderTopRightRadius": 16,
1176
1164
  },
1177
1165
  Object {},
1178
1166
  Object {},
@@ -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;
@@ -40,6 +40,7 @@ export type MessageOverlayData<
40
40
  ownCapabilities?: OwnCapabilitiesContextValue;
41
41
  supportedReactions?: ReactionData[];
42
42
  threadList?: boolean;
43
+ videos?: Attachment<StreamChatGenerics>[];
43
44
  };
44
45
 
45
46
  export type MessageOverlayContextValue<
@@ -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
+ );
@@ -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
+ };