stream-chat-react-native-core 5.0.0-offline-support.12 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/lib/commonjs/components/{MessageInput/AudioAttachmentUploadPreview.js → Attachment/AudioAttachment.js} +38 -64
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -0
  3. package/lib/commonjs/components/Attachment/Card.js +1 -0
  4. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/FileAttachment.js +16 -7
  6. package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +132 -12
  8. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  9. package/lib/commonjs/components/Attachment/Gallery.js +41 -35
  10. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/Giphy.js +17 -13
  12. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  13. package/lib/commonjs/components/Attachment/VideoThumbnail.js +12 -6
  14. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
  15. package/lib/commonjs/components/Attachment/utils/getGiphyMimeType.js +15 -0
  16. package/lib/commonjs/components/Attachment/utils/getGiphyMimeType.js.map +1 -0
  17. package/lib/commonjs/components/Channel/Channel.js +19 -19
  18. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  19. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
  20. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  21. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  22. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  23. package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js +16 -4
  24. package/lib/commonjs/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
  25. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js +12 -7
  26. package/lib/commonjs/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  27. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +10 -6
  28. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
  29. package/lib/commonjs/components/ImageGallery/ImageGallery.js +38 -30
  30. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  31. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -10
  32. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  33. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +2 -2
  34. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  35. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +6 -0
  36. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -1
  37. package/lib/commonjs/components/Message/Message.js +7 -7
  38. package/lib/commonjs/components/Message/Message.js.map +1 -1
  39. package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +7 -3
  40. package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  41. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.js +1 -1
  42. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.js.map +1 -1
  43. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.test.js +1 -1
  44. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.test.js.map +1 -1
  45. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +1 -1
  46. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  47. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +38 -44
  48. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  49. package/lib/commonjs/components/MessageList/MessageList.js +5 -5
  50. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  51. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +10 -9
  52. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  53. package/lib/commonjs/components/index.js +13 -13
  54. package/lib/commonjs/components/index.js.map +1 -1
  55. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +13 -14
  56. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  57. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  58. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +2 -2
  59. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  60. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
  61. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  62. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  63. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  64. package/lib/commonjs/contexts/themeContext/utils/theme.js +2 -2
  65. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  66. package/lib/commonjs/index.js +13 -1
  67. package/lib/commonjs/index.js.map +1 -1
  68. package/lib/commonjs/mock-builders/DB/mock.js +1 -13
  69. package/lib/commonjs/mock-builders/DB/mock.js.map +1 -1
  70. package/lib/commonjs/mock-builders/event/messageNew.js +2 -0
  71. package/lib/commonjs/mock-builders/event/messageNew.js.map +1 -1
  72. package/lib/commonjs/store/QuickSqliteClient.js +7 -3
  73. package/lib/commonjs/store/QuickSqliteClient.js.map +1 -1
  74. package/lib/commonjs/store/apis/getChannels.js +2 -15
  75. package/lib/commonjs/store/apis/getChannels.js.map +1 -1
  76. package/lib/commonjs/store/apis/getChannelsForFilterSort.js +37 -0
  77. package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -0
  78. package/lib/commonjs/store/apis/index.js +264 -0
  79. package/lib/commonjs/store/apis/index.js.map +1 -0
  80. package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js +1 -1
  81. package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
  82. package/lib/commonjs/store/apis/queries/selectChannels.js +2 -2
  83. package/lib/commonjs/store/apis/queries/selectChannels.js.map +1 -1
  84. package/lib/commonjs/store/sqlite-utils/appendWhereCluase.js +1 -2
  85. package/lib/commonjs/store/sqlite-utils/appendWhereCluase.js.map +1 -1
  86. package/lib/commonjs/test-utils/BetterSqlite.js +54 -0
  87. package/lib/commonjs/test-utils/BetterSqlite.js.map +1 -0
  88. package/lib/commonjs/version.json +1 -1
  89. package/lib/module/components/{MessageInput/AudioAttachmentUploadPreview.js → Attachment/AudioAttachment.js} +38 -64
  90. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -0
  91. package/lib/module/components/Attachment/Card.js +1 -0
  92. package/lib/module/components/Attachment/Card.js.map +1 -1
  93. package/lib/module/components/Attachment/FileAttachment.js +16 -7
  94. package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
  95. package/lib/module/components/Attachment/FileAttachmentGroup.js +132 -12
  96. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  97. package/lib/module/components/Attachment/Gallery.js +41 -35
  98. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  99. package/lib/module/components/Attachment/Giphy.js +17 -13
  100. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  101. package/lib/module/components/Attachment/VideoThumbnail.js +12 -6
  102. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
  103. package/lib/module/components/Attachment/utils/getGiphyMimeType.js +15 -0
  104. package/lib/module/components/Attachment/utils/getGiphyMimeType.js.map +1 -0
  105. package/lib/module/components/Channel/Channel.js +19 -19
  106. package/lib/module/components/Channel/Channel.js.map +1 -1
  107. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +0 -2
  108. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  109. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  110. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  111. package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js +16 -4
  112. package/lib/module/components/ChannelList/hooks/listeners/useNewMessage.js.map +1 -1
  113. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js +12 -7
  114. package/lib/module/components/ChannelList/hooks/usePaginatedChannels.js.map +1 -1
  115. package/lib/module/components/ChannelPreview/ChannelPreview.js +10 -6
  116. package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
  117. package/lib/module/components/ImageGallery/ImageGallery.js +38 -30
  118. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  119. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -10
  120. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  121. package/lib/module/components/ImageGallery/components/ImageGrid.js +2 -2
  122. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  123. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +6 -0
  124. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -1
  125. package/lib/module/components/Message/Message.js +7 -7
  126. package/lib/module/components/Message/Message.js.map +1 -1
  127. package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +7 -3
  128. package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  129. package/lib/module/components/Message/MessageSimple/utils/parseLinks.js +1 -1
  130. package/lib/module/components/Message/MessageSimple/utils/parseLinks.js.map +1 -1
  131. package/lib/module/components/Message/MessageSimple/utils/parseLinks.test.js +1 -1
  132. package/lib/module/components/Message/MessageSimple/utils/parseLinks.test.js.map +1 -1
  133. package/lib/module/components/Message/MessageSimple/utils/renderText.js +1 -1
  134. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  135. package/lib/module/components/MessageInput/FileUploadPreview.js +38 -44
  136. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  137. package/lib/module/components/MessageList/MessageList.js +5 -5
  138. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  139. package/lib/module/components/MessageOverlay/MessageOverlay.js +10 -9
  140. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  141. package/lib/module/components/index.js +13 -13
  142. package/lib/module/components/index.js.map +1 -1
  143. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +13 -14
  144. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  145. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  146. package/lib/module/contexts/messageInputContext/MessageInputContext.js +2 -2
  147. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  148. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +0 -2
  149. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  150. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  151. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  152. package/lib/module/contexts/themeContext/utils/theme.js +2 -2
  153. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  154. package/lib/module/index.js +13 -1
  155. package/lib/module/index.js.map +1 -1
  156. package/lib/module/mock-builders/DB/mock.js +1 -13
  157. package/lib/module/mock-builders/DB/mock.js.map +1 -1
  158. package/lib/module/mock-builders/event/messageNew.js +2 -0
  159. package/lib/module/mock-builders/event/messageNew.js.map +1 -1
  160. package/lib/module/store/QuickSqliteClient.js +7 -3
  161. package/lib/module/store/QuickSqliteClient.js.map +1 -1
  162. package/lib/module/store/apis/getChannels.js +2 -15
  163. package/lib/module/store/apis/getChannels.js.map +1 -1
  164. package/lib/module/store/apis/getChannelsForFilterSort.js +37 -0
  165. package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -0
  166. package/lib/module/store/apis/index.js +264 -0
  167. package/lib/module/store/apis/index.js.map +1 -0
  168. package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js +1 -1
  169. package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
  170. package/lib/module/store/apis/queries/selectChannels.js +2 -2
  171. package/lib/module/store/apis/queries/selectChannels.js.map +1 -1
  172. package/lib/module/store/sqlite-utils/appendWhereCluase.js +1 -2
  173. package/lib/module/store/sqlite-utils/appendWhereCluase.js.map +1 -1
  174. package/lib/module/test-utils/BetterSqlite.js +54 -0
  175. package/lib/module/test-utils/BetterSqlite.js.map +1 -0
  176. package/lib/module/version.json +1 -1
  177. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +23 -0
  178. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -1
  179. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  180. package/lib/typescript/components/Attachment/Giphy.d.ts +1 -1
  181. package/lib/typescript/components/Attachment/utils/getGiphyMimeType.d.ts +6 -0
  182. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  183. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  184. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  185. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -1
  186. package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +2 -1
  187. package/lib/typescript/components/Message/Message.d.ts +9 -3
  188. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
  189. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  190. package/lib/typescript/components/index.d.ts +1 -1
  191. package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +9 -10
  192. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
  193. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +1 -4
  194. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  195. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +3 -0
  196. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +2 -2
  197. package/lib/typescript/index.d.ts +2 -0
  198. package/lib/typescript/store/QuickSqliteClient.d.ts +4 -0
  199. package/lib/typescript/store/apis/getChannels.d.ts +13 -5
  200. package/lib/typescript/store/apis/getChannelsForFilterSort.d.ts +17 -0
  201. package/lib/typescript/store/apis/index.d.ts +20 -0
  202. package/lib/typescript/store/apis/queries/selectChannelIdsForFilterSort.d.ts +10 -1
  203. package/lib/typescript/{__tests__/utils → test-utils}/BetterSqlite.d.ts +1 -1
  204. package/package.json +5 -4
  205. package/src/__tests__/offline-feature.test.js +1 -2
  206. package/src/components/{MessageInput/AudioAttachmentUploadPreview.tsx → Attachment/AudioAttachment.tsx} +82 -131
  207. package/src/components/Attachment/Card.tsx +1 -0
  208. package/src/components/Attachment/FileAttachment.tsx +3 -0
  209. package/src/components/Attachment/FileAttachmentGroup.tsx +119 -9
  210. package/src/components/Attachment/Gallery.tsx +30 -19
  211. package/src/components/Attachment/Giphy.tsx +15 -8
  212. package/src/components/Attachment/VideoThumbnail.tsx +3 -2
  213. package/src/components/Attachment/utils/getGiphyMimeType.ts +13 -0
  214. package/src/components/Channel/Channel.tsx +5 -4
  215. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +0 -2
  216. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  217. package/src/components/ChannelList/__tests__/ChannelList.test.js +28 -0
  218. package/src/components/ChannelList/hooks/listeners/useNewMessage.ts +18 -5
  219. package/src/components/ChannelList/hooks/usePaginatedChannels.ts +19 -10
  220. package/src/components/ChannelPreview/ChannelPreview.tsx +6 -3
  221. package/src/components/ImageGallery/ImageGallery.tsx +32 -19
  222. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +6 -6
  223. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +3 -3
  224. package/src/components/ImageGallery/__tests__/ImageGalleryGrid.test.tsx +3 -3
  225. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +3 -3
  226. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +12 -7
  227. package/src/components/ImageGallery/components/ImageGrid.tsx +3 -3
  228. package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +16 -0
  229. package/src/components/Message/Message.tsx +10 -2
  230. package/src/components/Message/MessageSimple/MessageTextContainer.tsx +22 -2
  231. package/src/components/Message/MessageSimple/__tests__/MessageContent.test.js +4 -2
  232. package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageAvatar.test.js.snap +1 -0
  233. package/src/components/Message/MessageSimple/utils/parseLinks.test.ts +4 -0
  234. package/src/components/Message/MessageSimple/utils/parseLinks.ts +1 -1
  235. package/src/components/Message/MessageSimple/utils/renderText.tsx +1 -1
  236. package/src/components/MessageInput/FileUploadPreview.tsx +34 -26
  237. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +15 -8
  238. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +15 -8
  239. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +5 -5
  240. package/src/components/MessageList/MessageList.tsx +6 -6
  241. package/src/components/MessageOverlay/MessageOverlay.tsx +1 -0
  242. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +4 -0
  243. package/src/components/index.ts +1 -1
  244. package/src/contexts/imageGalleryContext/ImageGalleryContext.md +1 -1
  245. package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +19 -14
  246. package/src/contexts/messageInputContext/MessageInputContext.tsx +0 -6
  247. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +0 -2
  248. package/src/contexts/messagesContext/MessagesContext.tsx +3 -0
  249. package/src/contexts/themeContext/utils/theme.ts +4 -4
  250. package/src/index.ts +3 -0
  251. package/src/mock-builders/DB/mock.ts +4 -9
  252. package/src/mock-builders/event/messageNew.js +2 -0
  253. package/src/store/QuickSqliteClient.ts +11 -7
  254. package/src/store/apis/getChannels.ts +17 -14
  255. package/src/store/apis/getChannelsForFilterSort.ts +45 -0
  256. package/src/store/apis/index.ts +20 -0
  257. package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +12 -2
  258. package/src/store/apis/queries/selectChannels.ts +9 -3
  259. package/src/store/sqlite-utils/appendWhereCluase.ts +1 -2
  260. package/src/{__tests__/utils → test-utils}/BetterSqlite.js +1 -1
  261. package/src/version.json +1 -1
  262. package/lib/commonjs/components/MessageInput/AudioAttachmentUploadPreview.js.map +0 -1
  263. package/lib/module/components/MessageInput/AudioAttachmentUploadPreview.js.map +0 -1
  264. package/lib/typescript/components/MessageInput/AudioAttachmentUploadPreview.d.ts +0 -26
@@ -4,12 +4,7 @@ import { I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-nat
4
4
  import dayjs from 'dayjs';
5
5
  import duration from 'dayjs/plugin/duration';
6
6
 
7
- import {
8
- FileUpload,
9
- MessageInputContextValue,
10
- useMessageInputContext,
11
- useTheme,
12
- } from '../../contexts';
7
+ import { FileUpload, useTheme } from '../../contexts';
13
8
  import { Pause, Play } from '../../icons';
14
9
  import {
15
10
  PlaybackStatus,
@@ -18,7 +13,6 @@ import {
18
13
  VideoPayloadData,
19
14
  VideoProgressData,
20
15
  } from '../../native';
21
- import type { DefaultStreamChatGenerics } from '../../types/types';
22
16
  import { ProgressControl } from '../ProgressControl/ProgressControl';
23
17
 
24
18
  dayjs.extend(duration);
@@ -34,7 +28,7 @@ const styles = StyleSheet.create({
34
28
  paddingLeft: 8,
35
29
  paddingRight: 8,
36
30
  },
37
- fileContentContainer: { flexDirection: 'row' },
31
+ fileContentContainer: { flexDirection: 'row', paddingRight: 40 },
38
32
  filenameText: {
39
33
  fontSize: 14,
40
34
  fontWeight: 'bold',
@@ -76,27 +70,17 @@ const styles = StyleSheet.create({
76
70
  },
77
71
  });
78
72
 
79
- export type AudioAttachmentUploadPreviewPropsWithContext<
80
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
81
- > = Pick<
82
- MessageInputContextValue<StreamChatGenerics>,
83
- 'fileUploads' | 'removeFile' | 'uploadFile'
84
- > & {
85
- index: number;
86
- item: FileUpload;
73
+ export type AudioAttachmentPropsWithContext = {
74
+ item: Omit<FileUpload, 'state'>;
87
75
  onLoad: (index: string, duration: number) => void;
88
- onPlayPause: (index: string, status?: boolean) => void;
76
+ onPlayPause: (index: string, pausedStatus?: boolean) => void;
89
77
  onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;
90
- testID: string;
78
+ testID?: string;
91
79
  };
92
80
 
93
- const AudioAttachmentUploadPreviewWithContext = <
94
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
95
- >(
96
- props: AudioAttachmentUploadPreviewPropsWithContext<StreamChatGenerics>,
97
- ) => {
81
+ const AudioAttachmentWithContext = (props: AudioAttachmentPropsWithContext) => {
98
82
  const soundRef = React.useRef<SoundReturnType | null>(null);
99
- const { fileUploads, index, item, onLoad, onPlayPause, onProgress } = props;
83
+ const { item, onLoad, onPlayPause, onProgress } = props;
100
84
 
101
85
  const handleLoad = (payload: VideoPayloadData) => {
102
86
  onLoad(item.id, payload.duration);
@@ -212,11 +196,10 @@ const AudioAttachmentUploadPreviewWithContext = <
212
196
 
213
197
  const {
214
198
  theme: {
215
- colors: { accent_blue, black, grey_dark, grey_whisper, static_black, static_white },
199
+ colors: { accent_blue, black, grey_dark, static_black, static_white },
216
200
  messageInput: {
217
201
  fileUploadPreview: {
218
- audioAttachmentUploadPreview: { progressControlView, progressDurationText, roundedView },
219
- fileContainer,
202
+ audioAttachment: { progressControlView, progressDurationText, roundedView },
220
203
  fileContentContainer,
221
204
  filenameText,
222
205
  fileTextContainer,
@@ -236,91 +219,74 @@ const AudioAttachmentUploadPreviewWithContext = <
236
219
  const lastIndexOfDot = item.file.name.lastIndexOf('.');
237
220
 
238
221
  return (
239
- <View
240
- style={[
241
- styles.fileContainer,
242
- index === fileUploads.length - 1
243
- ? {
244
- marginBottom: 0,
245
- }
246
- : {},
247
- {
248
- borderColor: grey_whisper,
249
- width: -16,
250
- },
251
- fileContainer,
252
- ]}
253
- testID='audio-attachment-upload-preview'
254
- >
255
- <View style={[styles.fileContentContainer, fileContentContainer]}>
256
- <TouchableOpacity
257
- accessibilityLabel='Play Pause Button'
258
- onPress={() => handlePlayPause()}
222
+ <View style={[styles.fileContentContainer, fileContentContainer]}>
223
+ <TouchableOpacity
224
+ accessibilityLabel='Play Pause Button'
225
+ onPress={() => handlePlayPause()}
226
+ style={[
227
+ styles.roundedView,
228
+ roundedView,
229
+ { backgroundColor: static_white, shadowColor: black },
230
+ ]}
231
+ >
232
+ {item.paused ? (
233
+ <Play height={24} pathFill={static_black} width={24} />
234
+ ) : (
235
+ <Pause height={24} pathFill={static_black} width={24} />
236
+ )}
237
+ </TouchableOpacity>
238
+ <View style={[styles.fileTextContainer, fileTextContainer]}>
239
+ <Text
240
+ accessibilityLabel='File Name'
241
+ numberOfLines={1}
259
242
  style={[
260
- styles.roundedView,
261
- roundedView,
262
- { backgroundColor: static_white, shadowColor: black },
243
+ styles.filenameText,
244
+ {
245
+ color: black,
246
+ width:
247
+ 16 - // 16 = horizontal padding
248
+ 40 - // 40 = file icon size
249
+ 24 - // 24 = close icon size
250
+ 24, // 24 = internal padding
251
+ },
252
+ I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },
253
+ filenameText,
263
254
  ]}
264
255
  >
265
- {item.paused ? (
266
- <Play height={24} pathFill={static_black} width={24} />
267
- ) : (
268
- <Pause height={24} pathFill={static_black} width={24} />
256
+ {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}
257
+ </Text>
258
+ <View
259
+ style={{
260
+ alignItems: 'center',
261
+ display: 'flex',
262
+ flexDirection: 'row',
263
+ }}
264
+ >
265
+ {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}
266
+ {Sound.Player && (
267
+ <Sound.Player
268
+ onEnd={handleEnd}
269
+ onLoad={handleLoad}
270
+ onProgress={handleProgress}
271
+ paused={item.paused as boolean}
272
+ soundRef={soundRef}
273
+ testID='sound-player'
274
+ uri={item.file.uri}
275
+ />
269
276
  )}
270
- </TouchableOpacity>
271
- <View style={[styles.fileTextContainer, fileTextContainer]}>
272
- <Text
273
- accessibilityLabel='File Name'
274
- numberOfLines={1}
275
- style={[
276
- styles.filenameText,
277
- {
278
- color: black,
279
- width:
280
- 16 - // 16 = horizontal padding
281
- 40 - // 40 = file icon size
282
- 24 - // 24 = close icon size
283
- 24, // 24 = internal padding
284
- },
285
- I18nManager.isRTL ? { writingDirection: 'rtl' } : { writingDirection: 'ltr' },
286
- filenameText,
287
- ]}
288
- >
289
- {item.file.name.slice(0, 12) + '...' + item.file.name.slice(lastIndexOfDot)}
277
+ <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>
278
+ {progressDuration}
290
279
  </Text>
291
- <View
292
- style={{
293
- alignItems: 'center',
294
- display: 'flex',
295
- flexDirection: 'row',
296
- }}
297
- >
298
- {/* <ExpoSoundPlayer filePaused={!!item.paused} soundRef={soundRef} /> */}
299
- {Sound.Player && (
300
- <Sound.Player
301
- onEnd={handleEnd}
302
- onLoad={handleLoad}
303
- onProgress={handleProgress}
304
- paused={item.paused as boolean}
305
- soundRef={soundRef}
306
- testID='sound-player'
307
- uri={item.file.uri}
308
- />
309
- )}
310
- <Text style={[styles.progressDurationText, { color: grey_dark }, progressDurationText]}>
311
- {progressDuration}
312
- </Text>
313
- <View style={[styles.progressControlView, progressControlView]}>
314
- <ProgressControl
315
- duration={item.duration as number}
316
- filledColor={accent_blue}
317
- onPlayPause={handlePlayPause}
318
- onProgressDrag={handleProgressDrag}
319
- progress={item.progress as number}
320
- testID='progress-control'
321
- width={110}
322
- />
323
- </View>
280
+ <View style={[styles.progressControlView, progressControlView]}>
281
+ <ProgressControl
282
+ duration={item.duration as number}
283
+ filledColor={accent_blue}
284
+ onPlayPause={handlePlayPause}
285
+ onProgressDrag={handleProgressDrag}
286
+ progress={item.progress as number}
287
+ testID='progress-control'
288
+ width={120}
289
+ />
324
290
  </View>
325
291
  </View>
326
292
  </View>
@@ -328,35 +294,20 @@ const AudioAttachmentUploadPreviewWithContext = <
328
294
  );
329
295
  };
330
296
 
331
- export type AudioAttachmentUploadPreviewProps<
332
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
333
- > = Partial<AudioAttachmentUploadPreviewPropsWithContext<StreamChatGenerics>> & {
334
- index: number;
335
- item: FileUpload;
297
+ export type AudioAttachmentProps = Partial<AudioAttachmentPropsWithContext> & {
298
+ item: Omit<FileUpload, 'state'>;
336
299
  onLoad: (index: string, duration: number) => void;
337
- onPlayPause: (index: string, status?: boolean) => void;
300
+ onPlayPause: (index: string, pausedStatus?: boolean) => void;
338
301
  onProgress: (index: string, currentTime?: number, hasEnd?: boolean) => void;
339
302
  testID: string;
340
303
  };
341
304
 
342
305
  /**
343
- * AudioAttachmentUploadPreview
344
- * UI Component to preview the audio files set for upload
306
+ * AudioAttachment
307
+ * UI Component to preview the audio files
345
308
  */
346
- export const AudioAttachmentUploadPreview = <
347
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
348
- >(
349
- props: AudioAttachmentUploadPreviewProps<StreamChatGenerics>,
350
- ) => {
351
- const { fileUploads, removeFile, uploadFile } = useMessageInputContext<StreamChatGenerics>();
352
-
353
- return (
354
- <AudioAttachmentUploadPreviewWithContext
355
- {...{ fileUploads, removeFile, uploadFile }}
356
- {...props}
357
- />
358
- );
359
- };
309
+ export const AudioAttachment = (props: AudioAttachmentProps) => (
310
+ <AudioAttachmentWithContext {...props} />
311
+ );
360
312
 
361
- AudioAttachmentUploadPreview.displayName =
362
- 'AudioAttachmentUploadPreview{messageInput{autoAttachmentUploadPreview}}';
313
+ AudioAttachment.displayName = 'AudioAttachment{messageInput{autoAttachment}}';
@@ -309,6 +309,7 @@ export const Card = <
309
309
 
310
310
  return (
311
311
  <MemoizedCard
312
+ key={`${message?.id}${message?.updated_at}`} // press listeners must change on message update, updating key ensures this
312
313
  {...{
313
314
  additionalTouchableProps,
314
315
  CardCover,
@@ -103,6 +103,7 @@ const FileAttachmentWithContext = <
103
103
  onLongPress={(event) => {
104
104
  if (onLongPress) {
105
105
  onLongPress({
106
+ additionalInfo: { attachment },
106
107
  emitter: 'fileAttachment',
107
108
  event,
108
109
  });
@@ -111,6 +112,7 @@ const FileAttachmentWithContext = <
111
112
  onPress={(event) => {
112
113
  if (onPress) {
113
114
  onPress({
115
+ additionalInfo: { attachment },
114
116
  defaultHandler: defaultOnPress,
115
117
  emitter: 'fileAttachment',
116
118
  event,
@@ -120,6 +122,7 @@ const FileAttachmentWithContext = <
120
122
  onPressIn={(event) => {
121
123
  if (onPressIn) {
122
124
  onPressIn({
125
+ additionalInfo: { attachment },
123
126
  defaultHandler: defaultOnPress,
124
127
  emitter: 'fileAttachment',
125
128
  event,
@@ -1,30 +1,45 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
3
3
 
4
+ import type { Attachment } from 'stream-chat';
5
+
4
6
  import { Attachment as AttachmentDefault } from './Attachment';
5
7
 
6
8
  import {
7
9
  MessageContextValue,
8
10
  useMessageContext,
9
11
  } from '../../contexts/messageContext/MessageContext';
12
+
10
13
  import {
11
14
  MessagesContextValue,
12
15
  useMessagesContext,
13
16
  } from '../../contexts/messagesContext/MessagesContext';
14
17
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
18
+ import { isAudioPackageAvailable } from '../../native';
15
19
 
16
20
  import type { DefaultStreamChatGenerics } from '../../types/types';
17
21
 
22
+ const FILE_PREVIEW_HEIGHT = 60;
23
+
18
24
  const styles = StyleSheet.create({
19
25
  container: {
20
26
  padding: 4,
21
27
  },
28
+ fileContainer: {
29
+ borderRadius: 12,
30
+ borderWidth: 1,
31
+ flexDirection: 'row',
32
+ height: FILE_PREVIEW_HEIGHT,
33
+ justifyContent: 'space-between',
34
+ paddingLeft: 8,
35
+ paddingRight: 8,
36
+ },
22
37
  });
23
38
 
24
39
  export type FileAttachmentGroupPropsWithContext<
25
40
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
26
41
  > = Pick<MessageContextValue<StreamChatGenerics>, 'files'> &
27
- Pick<MessagesContextValue<StreamChatGenerics>, 'Attachment'> & {
42
+ Pick<MessagesContextValue<StreamChatGenerics>, 'Attachment' | 'AudioAttachment'> & {
28
43
  /**
29
44
  * The unique id for the message with file attachments
30
45
  */
@@ -35,15 +50,77 @@ export type FileAttachmentGroupPropsWithContext<
35
50
  }>;
36
51
  };
37
52
 
53
+ type FilesToDisplayType<
54
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
55
+ > = Attachment<StreamChatGenerics> & {
56
+ duration: number;
57
+ paused: boolean;
58
+ progress: number;
59
+ };
60
+
38
61
  const FileAttachmentGroupWithContext = <
39
62
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
40
63
  >(
41
64
  props: FileAttachmentGroupPropsWithContext<StreamChatGenerics>,
42
65
  ) => {
43
- const { Attachment, files, messageId, styles: stylesProp = {} } = props;
66
+ const { Attachment, AudioAttachment, files, messageId, styles: stylesProp = {} } = props;
67
+ const [filesToDisplay, setFilesToDisplay] = useState<FilesToDisplayType[]>([]);
68
+
69
+ useEffect(() => {
70
+ setFilesToDisplay(files.map((file) => ({ ...file, duration: 0, paused: true, progress: 0 })));
71
+ }, [files]);
72
+
73
+ // Handler triggered when an audio is loaded in the message input. The initial state is defined for the audio here and the duration is set.
74
+ const onLoad = (index: string, duration: number) => {
75
+ setFilesToDisplay((prevFilesToDisplay) =>
76
+ prevFilesToDisplay.map((fileToDisplay, id) => ({
77
+ ...fileToDisplay,
78
+ duration: id.toString() === index ? duration : fileToDisplay.duration,
79
+ })),
80
+ );
81
+ };
82
+
83
+ // The handler which is triggered when the audio progresses/ the thumb is dragged in the progress control. The progressed duration is set here.
84
+ const onProgress = (index: string, currentTime?: number, hasEnd?: boolean) => {
85
+ setFilesToDisplay((prevFileUploads) =>
86
+ prevFileUploads.map((fileUpload, id) => ({
87
+ ...fileUpload,
88
+ progress:
89
+ id.toString() === index
90
+ ? hasEnd
91
+ ? 1
92
+ : currentTime
93
+ ? currentTime / (fileUpload.duration as number)
94
+ : 0
95
+ : fileUpload.progress,
96
+ })),
97
+ );
98
+ };
99
+
100
+ // The handler which controls or sets the paused/played state of the audio.
101
+ const onPlayPause = (index: string, pausedStatus?: boolean) => {
102
+ if (pausedStatus === false) {
103
+ // If the status is false we set the audio with the index as playing and the others as paused.
104
+ setFilesToDisplay((prevFileUploads) =>
105
+ prevFileUploads.map((fileUpload, id) => ({
106
+ ...fileUpload,
107
+ paused: id.toString() === index ? false : true,
108
+ })),
109
+ );
110
+ } else {
111
+ // If the status is true we simply set all the audio's paused state as true.
112
+ setFilesToDisplay((prevFileUploads) =>
113
+ prevFileUploads.map((fileUpload) => ({
114
+ ...fileUpload,
115
+ paused: true,
116
+ })),
117
+ );
118
+ }
119
+ };
44
120
 
45
121
  const {
46
122
  theme: {
123
+ colors: { grey_whisper, white },
47
124
  messageSimple: {
48
125
  fileAttachmentGroup: { container },
49
126
  },
@@ -52,7 +129,7 @@ const FileAttachmentGroupWithContext = <
52
129
 
53
130
  return (
54
131
  <View style={[styles.container, container, stylesProp.container]}>
55
- {files.map((file, index) => (
132
+ {filesToDisplay.map((file, index) => (
56
133
  <View
57
134
  key={`${messageId}-${index}`}
58
135
  style={[
@@ -60,7 +137,40 @@ const FileAttachmentGroupWithContext = <
60
137
  stylesProp.attachmentContainer,
61
138
  ]}
62
139
  >
63
- <Attachment attachment={file} />
140
+ {file.type === 'audio' && isAudioPackageAvailable() ? (
141
+ <View
142
+ accessibilityLabel='audio-attachment-preview'
143
+ style={[
144
+ styles.fileContainer,
145
+ index === filesToDisplay.length - 1
146
+ ? {
147
+ marginBottom: 0,
148
+ }
149
+ : {},
150
+ {
151
+ backgroundColor: white,
152
+ borderColor: grey_whisper,
153
+ width: -16,
154
+ },
155
+ ]}
156
+ >
157
+ <AudioAttachment
158
+ item={{
159
+ duration: file.duration,
160
+ file: { name: file.title as string, uri: file.asset_url },
161
+ id: index.toString(),
162
+ paused: file.paused,
163
+ progress: file.progress,
164
+ }}
165
+ onLoad={onLoad}
166
+ onPlayPause={onPlayPause}
167
+ onProgress={onProgress}
168
+ testID='audio-attachment-preview'
169
+ />
170
+ </View>
171
+ ) : (
172
+ <Attachment attachment={file} />
173
+ )}
64
174
  </View>
65
175
  ))}
66
176
  </View>
@@ -74,9 +184,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
74
184
  const { files: prevFiles } = prevProps;
75
185
  const { files: nextFiles } = nextProps;
76
186
 
77
- const filesEqual = prevFiles.length === nextFiles.length;
78
-
79
- return filesEqual;
187
+ return prevFiles.length === nextFiles.length;
80
188
  };
81
189
 
82
190
  const MemoizedFileAttachmentGroup = React.memo(
@@ -98,7 +206,8 @@ export const FileAttachmentGroup = <
98
206
 
99
207
  const { files: contextFiles } = useMessageContext<StreamChatGenerics>();
100
208
 
101
- const { Attachment = AttachmentDefault } = useMessagesContext<StreamChatGenerics>();
209
+ const { Attachment = AttachmentDefault, AudioAttachment } =
210
+ useMessagesContext<StreamChatGenerics>();
102
211
 
103
212
  const files = propFiles || contextFiles;
104
213
 
@@ -108,6 +217,7 @@ export const FileAttachmentGroup = <
108
217
  <MemoizedFileAttachmentGroup
109
218
  {...{
110
219
  Attachment,
220
+ AudioAttachment,
111
221
  files,
112
222
  messageId,
113
223
  }}
@@ -62,6 +62,12 @@ const styles = StyleSheet.create({
62
62
  left: 4,
63
63
  position: 'absolute',
64
64
  },
65
+ imageLoadingIndicatorContainer: {
66
+ height: '100%',
67
+ justifyContent: 'center',
68
+ position: 'absolute',
69
+ width: '100%',
70
+ },
65
71
  imageLoadingIndicatorStyle: {
66
72
  alignItems: 'center',
67
73
  justifyContent: 'center',
@@ -77,7 +83,7 @@ const styles = StyleSheet.create({
77
83
 
78
84
  export type GalleryPropsWithContext<
79
85
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
80
- > = Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setImage' | 'setImages'> &
86
+ > = Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setSelectedMessage' | 'setMessages'> &
81
87
  Pick<
82
88
  MessageContextValue<StreamChatGenerics>,
83
89
  | 'alignment'
@@ -135,9 +141,9 @@ const GalleryWithContext = <
135
141
  onPress,
136
142
  onPressIn,
137
143
  preventPress,
138
- setImage,
139
- setImages,
144
+ setMessages,
140
145
  setOverlay,
146
+ setSelectedMessage,
141
147
  threadList,
142
148
  videos,
143
149
  VideoThumbnail,
@@ -250,9 +256,9 @@ const GalleryWithContext = <
250
256
  onPressIn={onPressIn}
251
257
  preventPress={preventPress}
252
258
  rowIndex={rowIndex}
253
- setImage={setImage}
254
- setImages={setImages}
259
+ setMessages={setMessages}
255
260
  setOverlay={setOverlay}
261
+ setSelectedMessage={setSelectedMessage}
256
262
  thumbnail={thumbnail}
257
263
  VideoThumbnail={VideoThumbnail}
258
264
  />
@@ -290,7 +296,7 @@ type GalleryThumbnailProps<
290
296
  | 'ImageLoadingIndicator'
291
297
  | 'ImageLoadingFailedIndicator'
292
298
  > &
293
- Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setImage' | 'setImages'> &
299
+ Pick<ImageGalleryContextValue<StreamChatGenerics>, 'setSelectedMessage' | 'setMessages'> &
294
300
  Pick<
295
301
  MessageContextValue<StreamChatGenerics>,
296
302
  'onLongPress' | 'onPress' | 'onPressIn' | 'preventPress'
@@ -316,9 +322,9 @@ const GalleryThumbnail = <
316
322
  onPressIn,
317
323
  preventPress,
318
324
  rowIndex,
319
- setImage,
320
- setImages,
325
+ setMessages,
321
326
  setOverlay,
327
+ setSelectedMessage,
322
328
  thumbnail,
323
329
  VideoThumbnail,
324
330
  }: GalleryThumbnailProps<StreamChatGenerics>) => {
@@ -336,11 +342,11 @@ const GalleryThumbnail = <
336
342
  // Added if-else to keep the logic readable, instead of DRY.
337
343
  // if - legacyImageViewerSwipeBehaviour is disabled
338
344
  // else - legacyImageViewerSwipeBehaviour is enabled
339
- setImages([message]);
340
- setImage({ messageId: message.id, url: thumbnail.url });
345
+ setMessages([message]);
346
+ setSelectedMessage({ messageId: message.id, url: thumbnail.url });
341
347
  setOverlay('gallery');
342
348
  } else if (legacyImageViewerSwipeBehaviour) {
343
- setImage({ messageId: message?.id, url: thumbnail.url });
349
+ setSelectedMessage({ messageId: message?.id, url: thumbnail.url });
344
350
  setOverlay('gallery');
345
351
  }
346
352
  };
@@ -490,7 +496,7 @@ const GalleryImageThumbnail = <
490
496
  uri={thumbnail.url}
491
497
  />
492
498
  {isLoadingImage && (
493
- <View style={{ position: 'absolute' }}>
499
+ <View style={[styles.imageLoadingIndicatorContainer]}>
494
500
  <ImageLoadingIndicator style={styles.imageLoadingIndicatorStyle} />
495
501
  </View>
496
502
  )}
@@ -519,7 +525,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
519
525
  videos: nextVideos,
520
526
  } = nextProps;
521
527
 
522
- const messageEqual = prevMessage?.id === nextMessage?.id;
528
+ const messageEqual =
529
+ prevMessage?.id === nextMessage?.id &&
530
+ `${prevMessage?.updated_at}` === `${nextMessage?.updated_at}`;
523
531
  if (!messageEqual) return false;
524
532
 
525
533
  const groupStylesEqual =
@@ -572,23 +580,25 @@ export const Gallery = <
572
580
  ImageLoadingFailedIndicator: PropImageLoadingFailedIndicator,
573
581
  ImageLoadingIndicator: PropImageLoadingIndicator,
574
582
  images: propImages,
583
+ message: propMessage,
575
584
  onLongPress: propOnLongPress,
576
585
  onPress: propOnPress,
577
586
  onPressIn: propOnPressIn,
578
587
  preventPress: propPreventPress,
579
- setImage: propSetImage,
580
588
  setOverlay: propSetOverlay,
589
+ setSelectedMessage: propSetSelectedMessage,
581
590
  threadList: propThreadList,
582
591
  videos: propVideos,
583
592
  VideoThumbnail: PropVideoThumbnail,
584
593
  } = props;
585
594
 
586
- const { setImage: contextSetImage, setImages } = useImageGalleryContext<StreamChatGenerics>();
595
+ const { setMessages, setSelectedMessage: contextSetSelectedMessage } =
596
+ useImageGalleryContext<StreamChatGenerics>();
587
597
  const {
588
598
  alignment: contextAlignment,
589
599
  groupStyles: contextGroupStyles,
590
600
  images: contextImages,
591
- message,
601
+ message: contextMessage,
592
602
  onLongPress: contextOnLongPress,
593
603
  onPress: contextOnPress,
594
604
  onPressIn: contextOnPressIn,
@@ -607,6 +617,7 @@ export const Gallery = <
607
617
 
608
618
  const images = propImages || contextImages;
609
619
  const videos = propVideos || contextVideos;
620
+ const message = propMessage || contextMessage;
610
621
 
611
622
  if (!images.length && !videos.length) return null;
612
623
 
@@ -618,7 +629,7 @@ export const Gallery = <
618
629
  const onPress = propOnPress || contextOnPress;
619
630
  const preventPress =
620
631
  typeof propPreventPress === 'boolean' ? propPreventPress : contextPreventPress;
621
- const setImage = propSetImage || contextSetImage;
632
+ const setSelectedMessage = propSetSelectedMessage || contextSetSelectedMessage;
622
633
  const setOverlay = propSetOverlay || contextSetOverlay;
623
634
  const threadList = propThreadList || contextThreadList;
624
635
  const VideoThumbnail = PropVideoThumbnail || ContextVideoThumnbnail;
@@ -643,9 +654,9 @@ export const Gallery = <
643
654
  onPress,
644
655
  onPressIn,
645
656
  preventPress,
646
- setImage,
647
- setImages,
657
+ setMessages,
648
658
  setOverlay,
659
+ setSelectedMessage,
649
660
  threadList,
650
661
  videos,
651
662
  VideoThumbnail,