stream-chat-react-native-core 5.22.0-beta.1 → 5.22.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/README.md +10 -5
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js +12 -12
  3. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  4. package/lib/commonjs/components/Attachment/FileAttachment.js +10 -7
  5. package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
  6. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +8 -6
  7. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  8. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +24 -20
  9. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  10. package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js +26 -11
  11. package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js.map +1 -1
  12. package/lib/commonjs/components/Channel/Channel.js +65 -46
  13. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  14. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js +2 -0
  15. package/lib/commonjs/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  16. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  17. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  18. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
  19. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  20. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
  21. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  22. package/lib/commonjs/components/ImageGallery/ImageGallery.js +29 -32
  23. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  24. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
  25. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  26. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
  27. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  28. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +10 -8
  29. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  30. package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +17 -12
  31. package/lib/commonjs/components/Indicators/EmptyStateIndicator.js.map +1 -1
  32. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +20 -17
  33. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  34. package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +18 -17
  35. package/lib/commonjs/components/Message/MessageSimple/ReactionList.js.map +1 -1
  36. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js +7 -5
  37. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  38. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.test.js +8 -0
  39. package/lib/commonjs/components/Message/MessageSimple/utils/generateMarkdownText.test.js.map +1 -0
  40. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +25 -17
  41. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  42. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +30 -20
  43. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  44. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +13 -13
  45. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  46. package/lib/commonjs/components/MessageInput/MessageInput.js +1 -1
  47. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  48. package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  49. package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +13 -11
  50. package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js.map +1 -1
  51. package/lib/commonjs/components/MessageOverlay/MessageActionList.js +8 -14
  52. package/lib/commonjs/components/MessageOverlay/MessageActionList.js.map +1 -1
  53. package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +11 -8
  54. package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js.map +1 -1
  55. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +32 -29
  56. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  57. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +17 -15
  58. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  59. package/lib/commonjs/contexts/channelContext/ChannelContext.js +2 -2
  60. package/lib/commonjs/contexts/channelContext/ChannelContext.js.map +1 -1
  61. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +66 -45
  62. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  63. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  64. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  65. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  66. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  67. package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -4
  68. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  69. package/lib/commonjs/hooks/index.js +11 -0
  70. package/lib/commonjs/hooks/index.js.map +1 -1
  71. package/lib/commonjs/hooks/useViewport.js +47 -0
  72. package/lib/commonjs/hooks/useViewport.js.map +1 -0
  73. package/lib/commonjs/i18n/en.json +5 -0
  74. package/lib/commonjs/i18n/es.json +6 -1
  75. package/lib/commonjs/i18n/fr.json +20 -15
  76. package/lib/commonjs/i18n/he.json +6 -1
  77. package/lib/commonjs/i18n/hi.json +20 -15
  78. package/lib/commonjs/i18n/it.json +20 -15
  79. package/lib/commonjs/i18n/ja.json +6 -1
  80. package/lib/commonjs/i18n/ko.json +6 -1
  81. package/lib/commonjs/i18n/nl.json +20 -15
  82. package/lib/commonjs/i18n/ru.json +20 -15
  83. package/lib/commonjs/i18n/tr.json +20 -15
  84. package/lib/commonjs/native.js.map +1 -1
  85. package/lib/commonjs/types/types.js.map +1 -1
  86. package/lib/commonjs/utils/compressImage.js +37 -0
  87. package/lib/commonjs/utils/compressImage.js.map +1 -0
  88. package/lib/commonjs/utils/utils.js +1 -15
  89. package/lib/commonjs/utils/utils.js.map +1 -1
  90. package/lib/commonjs/version.json +1 -1
  91. package/lib/module/components/Attachment/AudioAttachment.js +12 -12
  92. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  93. package/lib/module/components/Attachment/FileAttachment.js +10 -7
  94. package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
  95. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +8 -6
  96. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  97. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +24 -20
  98. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  99. package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js +26 -11
  100. package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js.map +1 -1
  101. package/lib/module/components/Channel/Channel.js +65 -46
  102. package/lib/module/components/Channel/Channel.js.map +1 -1
  103. package/lib/module/components/Channel/hooks/useCreateChannelContext.js +2 -0
  104. package/lib/module/components/Channel/hooks/useCreateChannelContext.js.map +1 -1
  105. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -2
  106. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  107. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +16 -14
  108. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js.map +1 -1
  109. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +4 -2
  110. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  111. package/lib/module/components/ImageGallery/ImageGallery.js +29 -32
  112. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  113. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +7 -5
  114. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  115. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -8
  116. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  117. package/lib/module/components/ImageGallery/components/ImageGrid.js +10 -8
  118. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  119. package/lib/module/components/Indicators/EmptyStateIndicator.js +17 -12
  120. package/lib/module/components/Indicators/EmptyStateIndicator.js.map +1 -1
  121. package/lib/module/components/Message/MessageSimple/MessageContent.js +20 -17
  122. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  123. package/lib/module/components/Message/MessageSimple/ReactionList.js +18 -17
  124. package/lib/module/components/Message/MessageSimple/ReactionList.js.map +1 -1
  125. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js +7 -5
  126. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.js.map +1 -1
  127. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.test.js +8 -0
  128. package/lib/module/components/Message/MessageSimple/utils/generateMarkdownText.test.js.map +1 -0
  129. package/lib/module/components/Message/MessageSimple/utils/renderText.js +25 -17
  130. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  131. package/lib/module/components/MessageInput/FileUploadPreview.js +30 -20
  132. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  133. package/lib/module/components/MessageInput/ImageUploadPreview.js +13 -13
  134. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  135. package/lib/module/components/MessageInput/MessageInput.js +1 -1
  136. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  137. package/lib/module/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  138. package/lib/module/components/MessageList/InlineUnreadIndicator.js +13 -11
  139. package/lib/module/components/MessageList/InlineUnreadIndicator.js.map +1 -1
  140. package/lib/module/components/MessageOverlay/MessageActionList.js +8 -14
  141. package/lib/module/components/MessageOverlay/MessageActionList.js.map +1 -1
  142. package/lib/module/components/MessageOverlay/MessageActionListItem.js +11 -8
  143. package/lib/module/components/MessageOverlay/MessageActionListItem.js.map +1 -1
  144. package/lib/module/components/MessageOverlay/MessageOverlay.js +32 -29
  145. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  146. package/lib/module/components/Thread/components/ThreadFooterComponent.js +17 -15
  147. package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  148. package/lib/module/contexts/channelContext/ChannelContext.js +2 -2
  149. package/lib/module/contexts/channelContext/ChannelContext.js.map +1 -1
  150. package/lib/module/contexts/messageInputContext/MessageInputContext.js +66 -45
  151. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  152. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +2 -2
  153. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  154. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  155. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  156. package/lib/module/contexts/themeContext/utils/theme.js +1 -4
  157. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  158. package/lib/module/hooks/index.js +11 -0
  159. package/lib/module/hooks/index.js.map +1 -1
  160. package/lib/module/hooks/useViewport.js +47 -0
  161. package/lib/module/hooks/useViewport.js.map +1 -0
  162. package/lib/module/i18n/en.json +5 -0
  163. package/lib/module/i18n/es.json +6 -1
  164. package/lib/module/i18n/fr.json +20 -15
  165. package/lib/module/i18n/he.json +6 -1
  166. package/lib/module/i18n/hi.json +20 -15
  167. package/lib/module/i18n/it.json +20 -15
  168. package/lib/module/i18n/ja.json +6 -1
  169. package/lib/module/i18n/ko.json +6 -1
  170. package/lib/module/i18n/nl.json +20 -15
  171. package/lib/module/i18n/ru.json +20 -15
  172. package/lib/module/i18n/tr.json +20 -15
  173. package/lib/module/native.js.map +1 -1
  174. package/lib/module/types/types.js.map +1 -1
  175. package/lib/module/utils/compressImage.js +37 -0
  176. package/lib/module/utils/compressImage.js.map +1 -0
  177. package/lib/module/utils/utils.js +1 -15
  178. package/lib/module/utils/utils.js.map +1 -1
  179. package/lib/module/version.json +1 -1
  180. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +1 -1
  181. package/lib/typescript/components/Channel/hooks/useCreateChannelContext.d.ts +1 -1
  182. package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.d.ts +1 -3
  183. package/lib/typescript/components/Message/MessageSimple/utils/generateMarkdownText.test.d.ts +1 -0
  184. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
  185. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  186. package/lib/typescript/components/MessageInput/UploadProgressIndicator.d.ts +5 -2
  187. package/lib/typescript/contexts/channelContext/ChannelContext.d.ts +5 -0
  188. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
  189. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -23
  190. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +2 -2
  191. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -2
  192. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -3
  193. package/lib/typescript/hooks/index.d.ts +1 -0
  194. package/lib/typescript/hooks/useViewport.d.ts +11 -0
  195. package/lib/typescript/i18n/en.json +5 -0
  196. package/lib/typescript/i18n/es.json +6 -1
  197. package/lib/typescript/i18n/fr.json +20 -15
  198. package/lib/typescript/i18n/he.json +6 -1
  199. package/lib/typescript/i18n/hi.json +20 -15
  200. package/lib/typescript/i18n/it.json +20 -15
  201. package/lib/typescript/i18n/ja.json +6 -1
  202. package/lib/typescript/i18n/ko.json +6 -1
  203. package/lib/typescript/i18n/nl.json +20 -15
  204. package/lib/typescript/i18n/ru.json +20 -15
  205. package/lib/typescript/i18n/tr.json +20 -15
  206. package/lib/typescript/native.d.ts +2 -0
  207. package/lib/typescript/store/mappers/mapStorableToChannel.d.ts +1 -1
  208. package/lib/typescript/types/types.d.ts +27 -10
  209. package/lib/typescript/utils/Streami18n.d.ts +5 -5
  210. package/lib/typescript/utils/compressImage.d.ts +8 -0
  211. package/lib/typescript/utils/utils.d.ts +0 -2
  212. package/package.json +2 -2
  213. package/src/components/Attachment/AudioAttachment.tsx +2 -1
  214. package/src/components/Attachment/FileAttachment.tsx +12 -3
  215. package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -2
  216. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +7 -5
  217. package/src/components/AttachmentPicker/components/AttachmentSelectionBar.tsx +13 -1
  218. package/src/components/Channel/Channel.tsx +32 -8
  219. package/src/components/Channel/hooks/useCreateChannelContext.ts +2 -0
  220. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -9
  221. package/src/components/ChannelPreview/ChannelPreviewMessenger.tsx +4 -3
  222. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +4 -3
  223. package/src/components/ImageGallery/ImageGallery.tsx +9 -19
  224. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +5 -3
  225. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +5 -3
  226. package/src/components/ImageGallery/components/ImageGrid.tsx +2 -1
  227. package/src/components/Indicators/EmptyStateIndicator.tsx +8 -7
  228. package/src/components/Message/MessageSimple/MessageContent.tsx +3 -1
  229. package/src/components/Message/MessageSimple/ReactionList.tsx +2 -1
  230. package/src/components/Message/MessageSimple/utils/generateMarkdownText.test.ts +23 -0
  231. package/src/components/Message/MessageSimple/utils/generateMarkdownText.ts +12 -13
  232. package/src/components/Message/MessageSimple/utils/renderText.tsx +12 -2
  233. package/src/components/MessageInput/FileUploadPreview.tsx +17 -3
  234. package/src/components/MessageInput/ImageUploadPreview.tsx +1 -2
  235. package/src/components/MessageInput/MessageInput.tsx +1 -1
  236. package/src/components/MessageInput/UploadProgressIndicator.tsx +2 -2
  237. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +1 -1
  238. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +1 -1
  239. package/src/components/MessageInput/__tests__/MessageInput.test.js +2 -2
  240. package/src/components/MessageList/InlineUnreadIndicator.tsx +2 -1
  241. package/src/components/MessageOverlay/MessageActionList.tsx +3 -11
  242. package/src/components/MessageOverlay/MessageActionListItem.tsx +5 -2
  243. package/src/components/MessageOverlay/MessageOverlay.tsx +5 -3
  244. package/src/components/Thread/components/ThreadFooterComponent.tsx +2 -1
  245. package/src/contexts/channelContext/ChannelContext.tsx +5 -0
  246. package/src/contexts/messageInputContext/MessageInputContext.tsx +81 -69
  247. package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +3 -3
  248. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +2 -2
  249. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
  250. package/src/contexts/messagesContext/MessagesContext.tsx +2 -2
  251. package/src/contexts/themeContext/utils/theme.ts +2 -7
  252. package/src/hooks/index.ts +1 -0
  253. package/src/hooks/useViewport.ts +41 -0
  254. package/src/i18n/en.json +5 -0
  255. package/src/i18n/es.json +6 -1
  256. package/src/i18n/fr.json +20 -15
  257. package/src/i18n/he.json +6 -1
  258. package/src/i18n/hi.json +20 -15
  259. package/src/i18n/it.json +20 -15
  260. package/src/i18n/ja.json +6 -1
  261. package/src/i18n/ko.json +6 -1
  262. package/src/i18n/nl.json +20 -15
  263. package/src/i18n/ru.json +20 -15
  264. package/src/i18n/tr.json +20 -15
  265. package/src/native.ts +5 -1
  266. package/src/types/types.ts +29 -10
  267. package/src/utils/compressImage.ts +32 -0
  268. package/src/utils/utils.ts +0 -13
  269. package/src/version.json +1 -1
@@ -1,4 +1,4 @@
1
1
  import type { ChannelAPIResponse } from 'stream-chat';
2
2
  import type { DefaultStreamChatGenerics } from '../../types/types';
3
3
  import type { TableRow } from '../types';
4
- export declare const mapStorableToChannel: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channelRow: TableRow<'channels'>) => Omit<ChannelAPIResponse<StreamChatGenerics>, "members" | "duration" | "messages" | "pinned_messages">;
4
+ export declare const mapStorableToChannel: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channelRow: TableRow<'channels'>) => Omit<ChannelAPIResponse<StreamChatGenerics>, "duration" | "members" | "messages" | "pinned_messages">;
@@ -1,30 +1,47 @@
1
1
  import type { ExtendableGenerics, LiteralStringForUnion } from 'stream-chat';
2
+ import type { FileStateValue } from '../utils/utils';
2
3
  export declare type Asset = {
3
- duration: number | null;
4
- filename: string;
4
+ duration: number;
5
5
  height: number;
6
+ name: string;
6
7
  source: 'camera' | 'picker';
7
8
  type: string;
8
9
  uri: string;
9
10
  width: number;
10
- fileSize?: number;
11
11
  id?: string;
12
- size?: number | string;
12
+ size?: number;
13
13
  };
14
- export declare type FileAssetType = {
14
+ export declare type File = {
15
15
  name: string;
16
+ duration?: number;
17
+ id?: string;
16
18
  mimeType?: string;
17
- size?: number | string;
19
+ size?: number;
18
20
  uri?: string;
19
21
  };
20
- export declare type File = FileAssetType & {
21
- duration?: string | null;
22
- id?: string;
22
+ export declare type FileUpload = {
23
+ file: File;
24
+ id: string;
25
+ state: FileStateValue;
26
+ duration?: number;
27
+ paused?: boolean;
28
+ progress?: number;
29
+ thumb_url?: string;
30
+ url?: string;
31
+ };
32
+ export declare type ImageUpload = {
33
+ file: Partial<Asset>;
34
+ id: string;
35
+ state: FileStateValue;
36
+ height?: number;
37
+ url?: string;
38
+ width?: number;
23
39
  };
24
40
  export declare type DefaultAttachmentType = UnknownType & {
25
- file_size?: number | string;
41
+ file_size?: number;
26
42
  mime_type?: string;
27
43
  originalFile?: File;
44
+ originalImage?: Partial<Asset>;
28
45
  };
29
46
  interface DefaultUserType extends UnknownType {
30
47
  image?: string;
@@ -116,6 +116,7 @@ export declare class Streami18n {
116
116
  "1 Reply": string;
117
117
  "1 Thread Reply": string;
118
118
  "Allow access to your Gallery": string;
119
+ "Allow camera access in device settings": string;
119
120
  "Also send to channel": string;
120
121
  "Are you sure you want to permanently delete this message?": string;
121
122
  "Block User": string;
@@ -124,6 +125,7 @@ export declare class Streami18n {
124
125
  "Copy Message": string;
125
126
  Delete: string;
126
127
  "Delete Message": string;
128
+ "Device camera is used to take photos or videos.": string;
127
129
  "Do you want to send a copy of this message to a moderator for further investigation?": string;
128
130
  "Edit Message": string;
129
131
  "Editing Message": string;
@@ -135,14 +137,11 @@ export declare class Streami18n {
135
137
  "Error while loading, please reload/refresh": string;
136
138
  "File type not supported": string;
137
139
  Flag: string;
138
- /**
139
- * These locale imports also set these locales globally.
140
- * So as a last step we import the english locale to make
141
- * sure we don't mess up languages in other places in the app.
142
- */
143
140
  "Flag Message": string;
144
141
  "Flag action failed either due to a network issue or the message is already flagged": string;
142
+ "How about sending your first message to a friend?": string;
145
143
  "Instant Commands": string;
144
+ "Let's start chatting!": string;
146
145
  "Links are disabled": string;
147
146
  "Loading channels...": string;
148
147
  "Loading messages...": string;
@@ -156,6 +155,7 @@ export declare class Streami18n {
156
155
  "Nothing yet...": string;
157
156
  Ok: string;
158
157
  "Only visible to you": string;
158
+ "Open Settings": string;
159
159
  Photo: string;
160
160
  "Photos and Videos": string;
161
161
  "Pin to Conversation": string;
@@ -0,0 +1,8 @@
1
+ import type { Asset } from '../types/types';
2
+ /**
3
+ * Function to compress and Image and return the compressed Image URI
4
+ * @param image
5
+ * @param compressImageQuality
6
+ * @returns string
7
+ */
8
+ export declare const compressedImageURI: (image: Partial<Asset>, compressImageQuality?: number | undefined) => Promise<string>;
@@ -105,8 +105,6 @@ export declare const ACITriggerSettings: <StreamChatGenerics extends DefaultStre
105
105
  export declare const makeImageCompatibleUrl: (url: string) => string;
106
106
  export declare const getUrlWithoutParams: (url?: string | undefined) => string | undefined;
107
107
  export declare const isLocalUrl: (url: string) => boolean;
108
- export declare const vw: (percentageWidth: number, rounded?: boolean) => number;
109
- export declare const vh: (percentageHeight: number, rounded?: boolean) => number;
110
108
  export declare const generateRandomId: (a?: string) => string;
111
109
  export declare const emojiRegex: RegExp;
112
110
  export declare const urlRegex: RegExp;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-chat-react-native-core",
3
3
  "description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
4
- "version": "5.22.0-beta.1",
4
+ "version": "5.22.0-beta.10",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -79,7 +79,7 @@
79
79
  "path": "0.12.7",
80
80
  "react-native-markdown-package": "1.8.2",
81
81
  "react-native-url-polyfill": "^1.3.0",
82
- "stream-chat": "~8.14.0"
82
+ "stream-chat": "~8.14.3"
83
83
  },
84
84
  "peerDependencies": {
85
85
  "react-native-quick-sqlite": ">=5.1.0",
@@ -4,7 +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 { FileUpload, useTheme } from '../../contexts';
7
+ import { useTheme } from '../../contexts';
8
8
  import { Pause, Play } from '../../icons';
9
9
  import {
10
10
  PlaybackStatus,
@@ -13,6 +13,7 @@ import {
13
13
  VideoPayloadData,
14
14
  VideoProgressData,
15
15
  } from '../../native';
16
+ import type { FileUpload } from '../../types/types';
16
17
  import { ProgressControl } from '../ProgressControl/ProgressControl';
17
18
 
18
19
  dayjs.extend(duration);
@@ -24,8 +24,8 @@ import {
24
24
  useMessagesContext,
25
25
  } from '../../contexts/messagesContext/MessagesContext';
26
26
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
27
+ import { useViewport } from '../../hooks/useViewport';
27
28
  import type { DefaultStreamChatGenerics } from '../../types/types';
28
- import { vw } from '../../utils/utils';
29
29
 
30
30
  const styles = StyleSheet.create({
31
31
  container: {
@@ -35,7 +35,6 @@ const styles = StyleSheet.create({
35
35
  padding: 8,
36
36
  },
37
37
  details: {
38
- maxWidth: vw(60),
39
38
  paddingLeft: 16,
40
39
  },
41
40
  size: {
@@ -94,6 +93,7 @@ const FileAttachmentWithContext = <
94
93
  },
95
94
  },
96
95
  } = useTheme();
96
+ const { vw } = useViewport();
97
97
 
98
98
  const defaultOnPress = () => openUrlSafely(attachment.asset_url);
99
99
 
@@ -134,7 +134,16 @@ const FileAttachmentWithContext = <
134
134
  >
135
135
  <View style={[styles.container, { backgroundColor: white }, container, stylesProp.container]}>
136
136
  <FileAttachmentIcon mimeType={attachment.mime_type} size={attachmentSize} />
137
- <View style={[styles.details, details, stylesProp.details]}>
137
+ <View
138
+ style={[
139
+ styles.details,
140
+ {
141
+ maxWidth: vw(60),
142
+ },
143
+ details,
144
+ stylesProp.details,
145
+ ]}
146
+ >
138
147
  <Text numberOfLines={2} style={[styles.title, { color: black }, title, stylesProp.title]}>
139
148
  {attachment.title}
140
149
  </Text>
@@ -20,13 +20,13 @@ import { renderAttachmentPickerItem } from './components/AttachmentPickerItem';
20
20
  import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
21
21
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
22
  import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
23
+ import { useViewport } from '../../hooks/useViewport';
23
24
  import {
24
25
  getPhotos,
25
26
  iOS14RefreshGallerySelection,
26
27
  oniOS14GalleryLibrarySelectionChange,
27
28
  } from '../../native';
28
29
  import type { Asset } from '../../types/types';
29
- import { vh } from '../../utils/utils';
30
30
 
31
31
  dayjs.extend(duration);
32
32
 
@@ -36,7 +36,6 @@ const styles = StyleSheet.create({
36
36
  },
37
37
  });
38
38
 
39
- const screenHeight = vh(100);
40
39
  const fullScreenHeight = Dimensions.get('window').height;
41
40
 
42
41
  export type AttachmentPickerProps = {
@@ -106,6 +105,9 @@ export const AttachmentPicker = React.forwardRef(
106
105
  setSelectedPicker,
107
106
  topInset,
108
107
  } = useAttachmentPickerContext();
108
+ const { vh } = useViewport();
109
+
110
+ const screenHeight = vh(100);
109
111
 
110
112
  const [currentIndex, setCurrentIndex] = useState(-1);
111
113
  const endCursorRef = useRef<string>();
@@ -8,10 +8,10 @@ import { lookup } from 'mime-types';
8
8
 
9
9
  import type { AttachmentPickerContextValue } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
10
10
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
11
+ import { useViewport } from '../../../hooks/useViewport';
11
12
  import { Recorder } from '../../../icons';
12
13
  import { getLocalAssetUri } from '../../../native';
13
14
  import type { Asset, File } from '../../../types/types';
14
- import { vw } from '../../../utils/utils';
15
15
 
16
16
  type AttachmentPickerItemType = Pick<
17
17
  AttachmentPickerContextValue,
@@ -39,6 +39,7 @@ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
39
39
  selectedFiles,
40
40
  setSelectedFiles,
41
41
  } = props;
42
+ const { vw } = useViewport();
42
43
 
43
44
  const {
44
45
  theme: {
@@ -70,15 +71,15 @@ const AttachmentVideo: React.FC<AttachmentVideoProps> = (props) => {
70
71
  const localAssetURI = Platform.OS === 'ios' && asset.id && (await getLocalAssetUri(asset.id));
71
72
  const uri = localAssetURI || asset.uri || '';
72
73
  // We need a mime-type to upload a video file.
73
- const mimeType = lookup(asset.filename) || 'multipart/form-data';
74
+ const mimeType = lookup(asset.name) || 'multipart/form-data';
74
75
  return [
75
76
  ...files,
76
77
  {
77
- duration: durationLabel,
78
+ duration: asset.duration,
78
79
  id: asset.id,
79
80
  mimeType,
80
- name: asset.filename,
81
- size: asset.fileSize,
81
+ name: asset.name,
82
+ size: asset.size,
82
83
  uri,
83
84
  },
84
85
  ];
@@ -152,6 +153,7 @@ const AttachmentImage: React.FC<AttachmentImageProps> = (props) => {
152
153
  colors: { overlay },
153
154
  },
154
155
  } = useTheme();
156
+ const { vw } = useViewport();
155
157
 
156
158
  const size = vw(100) / (numberOfAttachmentPickerImageColumns || 3) - 2;
157
159
 
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
- import { StyleSheet, TouchableOpacity, View } from 'react-native';
2
+ import { Alert, Linking, StyleSheet, TouchableOpacity, View } from 'react-native';
3
3
 
4
4
  import { useAttachmentPickerContext } from '../../../contexts/attachmentPickerContext/AttachmentPickerContext';
5
5
  import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext';
6
6
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
7
+ import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
7
8
 
8
9
  import { takePhoto } from '../../../native';
9
10
 
@@ -29,6 +30,7 @@ export const AttachmentSelectionBar: React.FC = () => {
29
30
  setSelectedImages,
30
31
  setSelectedPicker,
31
32
  } = useAttachmentPickerContext();
33
+ const { t } = useTranslationContext();
32
34
 
33
35
  const { compressImageQuality, hasFilePicker, imageUploads, pickFile } = useMessageInputContext();
34
36
 
@@ -57,6 +59,16 @@ export const AttachmentSelectionBar: React.FC = () => {
57
59
  setSelectedPicker(undefined);
58
60
  closePicker();
59
61
  const photo = await takePhoto({ compressImageQuality });
62
+ if (photo.askToOpenSettings) {
63
+ Alert.alert(
64
+ t('Allow camera access in device settings'),
65
+ t('Device camera is used to take photos or videos.'),
66
+ [
67
+ { style: 'cancel', text: t('Cancel') },
68
+ { onPress: () => Linking.openSettings(), style: 'default', text: t('Open Settings') },
69
+ ],
70
+ );
71
+ }
60
72
  if (!photo.cancelled) {
61
73
  setSelectedImages((images) => [...images, photo]);
62
74
  }
@@ -78,6 +78,7 @@ import { FlatList as FlatListDefault, pickDocument } from '../../native';
78
78
  import * as dbApi from '../../store/apis';
79
79
  import type { DefaultStreamChatGenerics } from '../../types/types';
80
80
  import { addReactionToLocalState } from '../../utils/addReactionToLocalState';
81
+ import { compressedImageURI } from '../../utils/compressImage';
81
82
  import { DBSyncManager } from '../../utils/DBSyncManager';
82
83
  import { patchMessageTextCommand } from '../../utils/patchMessageTextCommand';
83
84
  import { removeReactionFromLocalState } from '../../utils/removeReactionFromLocalState';
@@ -589,6 +590,13 @@ const ChannelWithContext = <
589
590
 
590
591
  const { setTargetedMessage, targetedMessage } = useTargetedMessage();
591
592
 
593
+ /**
594
+ * This ref will hold the abort controllers for
595
+ * requests made for uploading images/files in the messageInputContext
596
+ * Its a map of filename to AbortController
597
+ */
598
+ const uploadAbortControllerRef = useRef<Map<string, AbortController>>(new Map());
599
+
592
600
  const channelId = channel?.id || '';
593
601
  useEffect(() => {
594
602
  const initChannel = () => {
@@ -1290,20 +1298,28 @@ const ChannelWithContext = <
1290
1298
  if (updatedMessage.attachments?.length) {
1291
1299
  for (let i = 0; i < updatedMessage.attachments?.length; i++) {
1292
1300
  const attachment = updatedMessage.attachments[i];
1301
+ const image = attachment.originalImage;
1293
1302
  const file = attachment.originalFile;
1294
1303
  // check if image_url is not a remote url
1295
1304
  if (
1296
1305
  attachment.type === 'image' &&
1297
- file?.uri &&
1306
+ image?.uri &&
1298
1307
  attachment.image_url &&
1299
1308
  isLocalUrl(attachment.image_url)
1300
1309
  ) {
1301
- const filename = file.name ?? file.uri.replace(/^(file:\/\/|content:\/\/)/, '');
1310
+ const filename = image.name ?? image.uri.replace(/^(file:\/\/|content:\/\/)/, '');
1311
+ // if any upload is in progress, cancel it
1312
+ const controller = uploadAbortControllerRef.current.get(filename);
1313
+ if (controller) {
1314
+ controller.abort();
1315
+ uploadAbortControllerRef.current.delete(filename);
1316
+ }
1317
+ const compressedUri = await compressedImageURI(image, compressImageQuality);
1302
1318
  const contentType = lookup(filename) || 'multipart/form-data';
1303
1319
 
1304
1320
  const uploadResponse = doImageUploadRequest
1305
- ? await doImageUploadRequest(file, channel)
1306
- : await channel.sendImage(file.uri, filename, contentType);
1321
+ ? await doImageUploadRequest(image, channel)
1322
+ : await channel.sendImage(compressedUri, filename, contentType);
1307
1323
 
1308
1324
  attachment.image_url = uploadResponse.file;
1309
1325
  delete attachment.originalFile;
@@ -1321,6 +1337,12 @@ const ChannelWithContext = <
1321
1337
  isLocalUrl(attachment.asset_url) &&
1322
1338
  file?.uri
1323
1339
  ) {
1340
+ // if any upload is in progress, cancel it
1341
+ const controller = uploadAbortControllerRef.current.get(file.name);
1342
+ if (controller) {
1343
+ controller.abort();
1344
+ uploadAbortControllerRef.current.delete(file.name);
1345
+ }
1324
1346
  const response = doDocUploadRequest
1325
1347
  ? await doDocUploadRequest(file, channel)
1326
1348
  : await channel.sendFile(file.uri, file.name, file.mimeType);
@@ -1587,15 +1609,16 @@ const ChannelWithContext = <
1587
1609
  : client.updateMessage(updatedMessage);
1588
1610
 
1589
1611
  const setEditingState: MessagesContextValue<StreamChatGenerics>['setEditingState'] = (
1590
- message,
1612
+ messageOrBoolean,
1591
1613
  ) => {
1592
- setEditing(message);
1614
+ clearQuotedMessageState();
1615
+ setEditing(messageOrBoolean);
1593
1616
  };
1594
1617
 
1595
1618
  const setQuotedMessageState: MessagesContextValue<StreamChatGenerics>['setQuotedMessageState'] = (
1596
- message,
1619
+ messageOrBoolean,
1597
1620
  ) => {
1598
- setQuotedMessage(message);
1621
+ setQuotedMessage(messageOrBoolean);
1599
1622
  };
1600
1623
 
1601
1624
  const clearEditingState: InputMessageInputContextValue<StreamChatGenerics>['clearEditingState'] =
@@ -1851,6 +1874,7 @@ const ChannelWithContext = <
1851
1874
  StickyHeader,
1852
1875
  targetedMessage,
1853
1876
  threadList,
1877
+ uploadAbortControllerRef,
1854
1878
  watcherCount,
1855
1879
  watchers,
1856
1880
  });
@@ -36,6 +36,7 @@ export const useCreateChannelContext = <
36
36
  StickyHeader,
37
37
  targetedMessage,
38
38
  threadList,
39
+ uploadAbortControllerRef,
39
40
  watcherCount,
40
41
  watchers,
41
42
  }: ChannelContextValue<StreamChatGenerics>) => {
@@ -79,6 +80,7 @@ export const useCreateChannelContext = <
79
80
  StickyHeader,
80
81
  targetedMessage,
81
82
  threadList,
83
+ uploadAbortControllerRef,
82
84
  watcherCount,
83
85
  watchers,
84
86
  }),
@@ -53,7 +53,7 @@ export const useCreateInputMessageInputContext = <
53
53
  */
54
54
  channelId?: string;
55
55
  }) => {
56
- const editingExists = !!editing;
56
+ const editingDep = typeof editing === 'boolean' ? editing : editing?.id;
57
57
  const quotedMessageId = quotedMessage
58
58
  ? typeof quotedMessage === 'boolean'
59
59
  ? ''
@@ -103,14 +103,7 @@ export const useCreateInputMessageInputContext = <
103
103
  ShowThreadMessageInChannelButton,
104
104
  UploadProgressIndicator,
105
105
  }),
106
- [
107
- compressImageQuality,
108
- channelId,
109
- editingExists,
110
- initialValue,
111
- maxMessageLength,
112
- quotedMessageId,
113
- ],
106
+ [compressImageQuality, channelId, editingDep, initialValue, maxMessageLength, quotedMessageId],
114
107
  );
115
108
 
116
109
  return inputMessageInputContext;
@@ -19,8 +19,8 @@ import {
19
19
  } from '../../contexts/channelsContext/ChannelsContext';
20
20
  import { useChatContext } from '../../contexts/chatContext/ChatContext';
21
21
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
22
+ import { useViewport } from '../../hooks/useViewport';
22
23
  import type { DefaultStreamChatGenerics } from '../../types/types';
23
- import { vw } from '../../utils/utils';
24
24
 
25
25
  const styles = StyleSheet.create({
26
26
  container: {
@@ -45,8 +45,6 @@ const styles = StyleSheet.create({
45
45
  title: { fontSize: 14, fontWeight: '700' },
46
46
  });
47
47
 
48
- const maxWidth = vw(80) - 16 - 40;
49
-
50
48
  export type ChannelPreviewMessengerPropsWithContext<
51
49
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
52
50
  > = Pick<ChannelPreviewProps<StreamChatGenerics>, 'channel'> &
@@ -120,6 +118,9 @@ const ChannelPreviewMessengerWithContext = <
120
118
  PreviewMutedStatus = ChannelPreviewMutedStatus,
121
119
  unread,
122
120
  } = props;
121
+ const { vw } = useViewport();
122
+
123
+ const maxWidth = vw(80) - 16 - 40;
123
124
 
124
125
  const {
125
126
  theme: {
@@ -3,11 +3,9 @@ import { useEffect, useState } from 'react';
3
3
  import type { Channel, ChannelMemberResponse } from 'stream-chat';
4
4
 
5
5
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
6
+ import { useViewport } from '../../../hooks/useViewport';
6
7
 
7
8
  import type { DefaultStreamChatGenerics } from '../../../types/types';
8
- import { vw } from '../../../utils/utils';
9
-
10
- const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
11
9
 
12
10
  const ELLIPSIS = `...`;
13
11
 
@@ -81,6 +79,9 @@ export const useChannelPreviewDisplayName = <
81
79
  characterLength?: number,
82
80
  ) => {
83
81
  const { client } = useChatContext<StreamChatGenerics>();
82
+ const { vw } = useViewport();
83
+
84
+ const DEFAULT_MAX_CHARACTER_LENGTH = (vw(100) - 16) / 6;
84
85
 
85
86
  const currentUserId = client?.userID;
86
87
  const members = channel?.state?.members;
@@ -55,18 +55,16 @@ import {
55
55
  useOverlayContext,
56
56
  } from '../../contexts/overlayContext/OverlayContext';
57
57
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
58
+ import { useViewport } from '../../hooks/useViewport';
58
59
  import { isVideoPackageAvailable, VideoType } from '../../native';
59
60
  import type { DefaultStreamChatGenerics } from '../../types/types';
60
61
  import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
61
62
  import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
62
- import { vh, vw } from '../../utils/utils';
63
63
  import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
64
64
 
65
65
  const isAndroid = Platform.OS === 'android';
66
66
  const fullScreenHeight = Dimensions.get('screen').height;
67
- const measuredScreenHeight = vh(100);
68
- const screenWidth = vw(100);
69
- const halfScreenWidth = vw(50);
67
+
70
68
  const MARGIN = 32;
71
69
 
72
70
  export enum HasPinched {
@@ -162,6 +160,12 @@ export const ImageGallery = <
162
160
  const { messages, selectedMessage, setSelectedMessage } =
163
161
  useImageGalleryContext<StreamChatGenerics>();
164
162
 
163
+ const { vh, vw } = useViewport();
164
+
165
+ const measuredScreenHeight = vh(100);
166
+ const screenWidth = vw(100);
167
+ const halfScreenWidth = vw(50);
168
+
165
169
  /**
166
170
  * Height constants
167
171
  */
@@ -571,21 +575,7 @@ export const ImageGallery = <
571
575
  simultaneousHandlers={[pinchRef]}
572
576
  >
573
577
  <Animated.View style={StyleSheet.absoluteFill}>
574
- <Animated.View
575
- style={[
576
- styles.animatedContainer,
577
- pagerStyle,
578
- pager,
579
- {
580
- transform: [
581
- { scaleX: -1 }, // Also only here for opening, wrong direction when not included
582
- {
583
- translateX: translationX.value, // Only here for opening, wrong index when this is not included
584
- },
585
- ],
586
- },
587
- ]}
588
- >
578
+ <Animated.View style={[styles.animatedContainer, pagerStyle, pager]}>
589
579
  {imageGalleryAttachments.map((photo, i) =>
590
580
  photo.type === 'video' ? (
591
581
  <AnimatedGalleryVideo
@@ -3,10 +3,8 @@ import { View } from 'react-native';
3
3
  import type { ImageStyle, StyleProp } from 'react-native';
4
4
  import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5
5
 
6
- import { vw } from '../../../utils/utils';
6
+ import { useViewport } from '../../../hooks/useViewport';
7
7
 
8
- const screenWidth = vw(100);
9
- const halfScreenWidth = vw(50);
10
8
  const oneEighth = 1 / 8;
11
9
 
12
10
  type Props = {
@@ -40,6 +38,10 @@ export const AnimatedGalleryImage: React.FC<Props> = React.memo(
40
38
  translateX,
41
39
  translateY,
42
40
  } = props;
41
+ const { vw } = useViewport();
42
+
43
+ const screenWidth = vw(100);
44
+ const halfScreenWidth = vw(50);
43
45
 
44
46
  /**
45
47
  * The current image, designated by selected is scaled and translated
@@ -3,6 +3,7 @@ import { StyleSheet, View, ViewStyle } from 'react-native';
3
3
  import type { StyleProp } from 'react-native';
4
4
  import Animated, { useAnimatedStyle } from 'react-native-reanimated';
5
5
 
6
+ import { useViewport } from '../../../hooks/useViewport';
6
7
  import {
7
8
  isVideoPackageAvailable,
8
9
  PlaybackStatus,
@@ -12,11 +13,8 @@ import {
12
13
  VideoType,
13
14
  } from '../../../native';
14
15
 
15
- import { vw } from '../../../utils/utils';
16
16
  import { Spinner } from '../../Spinner/Spinner';
17
17
 
18
- const screenWidth = vw(100);
19
- const halfScreenWidth = vw(50);
20
18
  const oneEighth = 1 / 8;
21
19
 
22
20
  export type AnimatedGalleryVideoType = {
@@ -74,6 +72,10 @@ export const AnimatedGalleryVideo: React.FC<AnimatedGalleryVideoType> = React.me
74
72
  translateY,
75
73
  videoRef,
76
74
  } = props;
75
+ const { vw } = useViewport();
76
+
77
+ const screenWidth = vw(100);
78
+ const halfScreenWidth = vw(50);
77
79
 
78
80
  const onLoadStart = () => {
79
81
  setOpacity(1);
@@ -5,8 +5,8 @@ import { BottomSheetFlatList, TouchableOpacity } from '@gorhom/bottom-sheet';
5
5
 
6
6
  import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
7
7
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
8
+ import { useViewport } from '../../../hooks/useViewport';
8
9
  import type { DefaultStreamChatGenerics } from '../../../types/types';
9
- import { vw } from '../../../utils/utils';
10
10
 
11
11
  import type { Photo } from '../ImageGallery';
12
12
 
@@ -71,6 +71,7 @@ const GridImage = <
71
71
  },
72
72
  },
73
73
  } = useTheme();
74
+ const { vw } = useViewport();
74
75
  const { imageComponent, ...restItem } = item;
75
76
 
76
77
  const { numberOfImageGalleryGridColumns, selectAndClose, type, uri } = restItem;