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
@@ -2,10 +2,9 @@ import React from 'react';
2
2
  import { StyleSheet, Text, View } from 'react-native';
3
3
 
4
4
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
5
+ import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
6
+ import { useViewport } from '../../hooks/useViewport';
5
7
  import { MessageIcon } from '../../icons/MessageIcon';
6
- import { vw } from '../../utils/utils';
7
-
8
- const width = vw(33);
9
8
 
10
9
  const styles = StyleSheet.create({
11
10
  channelContainer: {
@@ -16,7 +15,6 @@ const styles = StyleSheet.create({
16
15
  channelDetails: {
17
16
  fontSize: 14,
18
17
  textAlign: 'center',
19
- width: vw(66),
20
18
  },
21
19
  channelTitle: {
22
20
  fontSize: 16,
@@ -36,6 +34,9 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
36
34
  emptyStateIndicator: { channelContainer, channelDetails, channelTitle },
37
35
  },
38
36
  } = useTheme();
37
+ const { vw } = useViewport();
38
+ const width = vw(33);
39
+ const { t } = useTranslationContext();
39
40
 
40
41
  switch (listType) {
41
42
  case 'channel':
@@ -46,13 +47,13 @@ export const EmptyStateIndicator: React.FC<EmptyStateProps> = ({ listType }) =>
46
47
  style={[styles.channelTitle, { color: black }, channelTitle]}
47
48
  testID='empty-channel-state-title'
48
49
  >
49
- {"Let's start chatting!"}
50
+ {t("Let's start chatting!")}
50
51
  </Text>
51
52
  <Text
52
- style={[styles.channelDetails, { color: grey }, channelDetails]}
53
+ style={[styles.channelDetails, { color: grey, width: vw(66) }, channelDetails]}
53
54
  testID='empty-channel-state-details'
54
55
  >
55
- {'How about sending your first message to a friend?'}
56
+ {t('How about sending your first message to a friend?')}
56
57
  </Text>
57
58
  </View>
58
59
  );
@@ -19,8 +19,9 @@ import {
19
19
  useTranslationContext,
20
20
  } from '../../../contexts/translationContext/TranslationContext';
21
21
 
22
+ import { useViewport } from '../../../hooks/useViewport';
22
23
  import type { DefaultStreamChatGenerics } from '../../../types/types';
23
- import { MessageStatusTypes, vw } from '../../../utils/utils';
24
+ import { MessageStatusTypes } from '../../../utils/utils';
24
25
 
25
26
  const styles = StyleSheet.create({
26
27
  containerInner: {
@@ -164,6 +165,7 @@ const MessageContentWithContext = <
164
165
  },
165
166
  },
166
167
  } = useTheme();
168
+ const { vw } = useViewport();
167
169
 
168
170
  const getDateText = (formatter?: (date: TDateTimeParserInput) => string) => {
169
171
  if (!message.created_at) return '';
@@ -121,6 +121,7 @@ const ReactionListWithContext = <
121
121
  avatarWrapper: { leftAlign, spacer },
122
122
  reactionList: {
123
123
  container,
124
+ iconFillColor,
124
125
  middleIcon,
125
126
  radius: themeRadius,
126
127
  reactionBubble,
@@ -263,7 +264,7 @@ const ReactionListWithContext = <
263
264
  {reactions.map((reaction) => (
264
265
  <Icon
265
266
  key={reaction.type}
266
- pathFill={reaction.own ? accent_blue : grey}
267
+ pathFill={reaction.own ? iconFillColor || accent_blue : grey}
267
268
  size={reactionSize / 2}
268
269
  style={middleIcon}
269
270
  supportedReactions={supportedReactions}
@@ -0,0 +1,23 @@
1
+ import { generateMarkdownText } from './generateMarkdownText';
2
+
3
+ describe('generateMarkdownText', () => {
4
+ it.each([
5
+ ['', null],
6
+ [' test message ', 'test message'],
7
+ ['https://www.getstream.io', '[https://www.getstream.io](https://www.getstream.io)'],
8
+ [
9
+ 'https://getstream-production.s3-accelerate.amazonaws.com/N336903591601695/33e78ef89e64642862a75c5cca2541eaf6b1c924/trimmedVideos/alert/2_270_881/outputVideo.mp4?AWSAccessKeyId=AKIAVJAW2AD2SQVQCBXV&Expires=1699998768&Signature=zdEMCGzf4Pq++16YkPprvN5NAds=',
10
+ '[https://getstream-production.s3-accelerate.amazonaws.com/N336903591601695/33e78ef89e64642862a75c5cca2541eaf6b1c924/trimmedVideos/alert/2_270_881/outputVideo.mp4?AWSAccessKeyId=AKIAVJAW2AD2SQVQCBXV&...](https://getstream-production.s3-accelerate.amazonaws.com/N336903591601695/33e78ef89e64642862a75c5cca2541eaf6b1c924/trimmedVideos/alert/2_270_881/outputVideo.mp4?AWSAccessKeyId=AKIAVJAW2AD2SQVQCBXV&Expires=1699998768&Signature=zdEMCGzf4Pq++16YkPprvN5NAds=)',
11
+ ],
12
+ ['Hi @getstream.io', 'Hi @getstream.io'],
13
+ [
14
+ 'Hi test@gmail.com @test@gmail.com',
15
+ 'Hi [test@gmail.com](mailto:test@gmail.com) @test@gmail.com',
16
+ ],
17
+ ['Hi @getstream.io getstream.io', 'Hi @getstream.io [getstream.io](http://getstream.io)'],
18
+ ['Hi <Stream>', 'Hi \\<Stream\\>'],
19
+ ])('Returns the generated markdown text for %p and %p', (text, expected) => {
20
+ const result = generateMarkdownText(text);
21
+ expect(result).toBe(expected);
22
+ });
23
+ });
@@ -2,16 +2,12 @@ import truncate from 'lodash/truncate';
2
2
 
3
3
  import { parseLinksFromText } from './parseLinks';
4
4
 
5
- import type { DefaultStreamChatGenerics } from '../../../../types/types';
6
- import type { MessageType } from '../../../MessageList/hooks/useMessageList';
7
-
8
- export const generateMarkdownText = <
9
- StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
10
- >(
11
- message: MessageType<StreamChatGenerics>,
12
- ) => {
13
- const { text } = message;
5
+ // If you need to use any of the special characters literally (actually searching for a "*", for instance), you must escape it by putting a backslash in front of it.
6
+ function escapeRegExp(text: string) {
7
+ return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
8
+ }
14
9
 
10
+ export const generateMarkdownText = (text?: string) => {
15
11
  if (!text) return null;
16
12
 
17
13
  // Trim the extra spaces from the text.
@@ -26,18 +22,21 @@ export const generateMarkdownText = <
26
22
  omission: '...',
27
23
  });
28
24
  // Convert raw links/emails in the text to respective markdown syntax.
29
- // Eg: Hi getstream.io -> Hi [getstream.io](getstream.io).
30
- const normalRegEx = new RegExp(linkInfo.raw, 'g');
25
+ // Eg: Hi @getstream.io -> Hi @[getstream.io](getstream.io).
26
+ const normalRegEx = new RegExp(escapeRegExp(linkInfo.raw), 'g');
31
27
  const markdown = `[${displayLink}](${linkInfo.encodedUrl})`;
32
28
  resultText = text.replace(normalRegEx, markdown);
33
29
 
34
30
  // After previous step, in some cases, the mentioned user after `@` might have a link/email so we convert it back to normal raw text.
35
31
  // Eg: Hi, @[test.user@gmail.com](mailto:test.user@gmail.com) to @test.user@gmail.com.
36
- const mentionsRegex = new RegExp(`@\\[${displayLink}\\]\\(${linkInfo.encodedUrl}\\)`, 'g');
32
+ const mentionsRegex = new RegExp(
33
+ `@\\[${escapeRegExp(displayLink)}\\]\\(${escapeRegExp(linkInfo.encodedUrl)}\\)`,
34
+ 'g',
35
+ );
37
36
  resultText = resultText.replace(mentionsRegex, `@${displayLink}`);
38
37
  }
39
38
 
40
- resultText = resultText.replace(/[<&"'>]/g, '\\$&');
39
+ resultText = resultText.replace(/[<"'>]/g, '\\$&');
41
40
 
42
41
  return resultText;
43
42
  };
@@ -100,8 +100,9 @@ export const renderText = <
100
100
  onPress: onPressParam,
101
101
  preventPress,
102
102
  } = params;
103
+ const { text } = message;
103
104
 
104
- const markdownText = generateMarkdownText<StreamChatGenerics>(message);
105
+ const markdownText = generateMarkdownText(text);
105
106
 
106
107
  const styles: MarkdownStyle = {
107
108
  ...defaultMarkdownStyles,
@@ -141,8 +142,17 @@ export const renderText = <
141
142
  : Linking.canOpenURL(url).then((canOpenUrl) => canOpenUrl && Linking.openURL(url));
142
143
  };
143
144
 
145
+ let previousLink: string | undefined;
144
146
  const linkReact: ReactNodeOutput = (node, output, { ...state }) => {
145
- const url = node.target;
147
+ let url: string;
148
+ // Some long URLs with `&` separated parameters are trimmed and the url only until first param is taken.
149
+ // This is done because of internal link been taken from the original URL in react-native-markdown-package. So, we check for `withinLink` and take the previous full URL.
150
+ if (state?.withinLink && previousLink) {
151
+ url = previousLink;
152
+ } else {
153
+ url = node.target;
154
+ previousLink = node.target;
155
+ }
146
156
  const onPress = (event: GestureResponderEvent) => {
147
157
  if (!preventPress && onPressParam) {
148
158
  onPressParam({
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import { FlatList, I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
3
 
4
+ import dayjs from 'dayjs';
5
+
4
6
  import { UploadProgressIndicator } from './UploadProgressIndicator';
5
7
 
6
8
  import { ChatContextValue, useChatContext } from '../../contexts';
7
9
  import {
8
- FileUpload,
9
10
  MessageInputContextValue,
10
11
  useMessageInputContext,
11
12
  } from '../../contexts/messageInputContext/MessageInputContext';
@@ -18,7 +19,7 @@ import { useTranslationContext } from '../../contexts/translationContext/Transla
18
19
  import { Close } from '../../icons/Close';
19
20
  import { Warning } from '../../icons/Warning';
20
21
  import { isAudioPackageAvailable } from '../../native';
21
- import type { DefaultStreamChatGenerics } from '../../types/types';
22
+ import type { DefaultStreamChatGenerics, FileUpload } from '../../types/types';
22
23
  import { FileState, getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
23
24
  import { getFileSizeDisplayText } from '../Attachment/FileAttachment';
24
25
  import { WritingDirectionAwareText } from '../RTLComponents/WritingDirectionAwareText';
@@ -101,6 +102,19 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
101
102
  },
102
103
  } = useTheme();
103
104
 
105
+ const ONE_HOUR_IN_SECONDS = 3600;
106
+ let durationLabel = '00:00';
107
+ const videoDuration = item.file.duration;
108
+
109
+ if (videoDuration) {
110
+ const isDurationLongerThanHour = videoDuration / ONE_HOUR_IN_SECONDS >= 1;
111
+ const formattedDurationParam = isDurationLongerThanHour ? 'HH:mm:ss' : 'mm:ss';
112
+ const formattedVideoDuration = dayjs
113
+ .duration(videoDuration, 'second')
114
+ .format(formattedDurationParam);
115
+ durationLabel = formattedVideoDuration;
116
+ }
117
+
104
118
  const { t } = useTranslationContext();
105
119
 
106
120
  return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (
@@ -117,7 +131,7 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
117
131
  </View>
118
132
  ) : (
119
133
  <WritingDirectionAwareText style={[styles.fileSizeText, { color: grey }, fileSizeText]}>
120
- {item.file.duration || getFileSizeDisplayText(item.file.size)}
134
+ {videoDuration ? durationLabel : getFileSizeDisplayText(item.file.size)}
121
135
  </WritingDirectionAwareText>
122
136
  );
123
137
  };
@@ -13,7 +13,6 @@ import { UploadProgressIndicator } from './UploadProgressIndicator';
13
13
 
14
14
  import { ChatContextValue, useChatContext } from '../../contexts';
15
15
  import {
16
- ImageUpload,
17
16
  MessageInputContextValue,
18
17
  useMessageInputContext,
19
18
  } from '../../contexts/messageInputContext/MessageInputContext';
@@ -21,7 +20,7 @@ import { useTheme } from '../../contexts/themeContext/ThemeContext';
21
20
  import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
22
21
  import { Close } from '../../icons/Close';
23
22
  import { Warning } from '../../icons/Warning';
24
- import type { DefaultStreamChatGenerics } from '../../types/types';
23
+ import type { DefaultStreamChatGenerics, ImageUpload } from '../../types/types';
25
24
  import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
26
25
 
27
26
  const IMAGE_PREVIEW_SIZE = 100;
@@ -288,7 +288,7 @@ const MessageInputWithContext = <
288
288
  // Check if the file size of the image exceeds the threshold of 100MB
289
289
  if (
290
290
  imageToUpload &&
291
- Number(imageToUpload.fileSize) / MEGA_BYTES_TO_BYTES > MAX_FILE_SIZE_TO_UPLOAD_IN_MB
291
+ Number(imageToUpload.size) / MEGA_BYTES_TO_BYTES > MAX_FILE_SIZE_TO_UPLOAD_IN_MB
292
292
  ) {
293
293
  Alert.alert(
294
294
  t(
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import {
3
3
  ActivityIndicator,
4
4
  GestureResponderEvent,
@@ -24,7 +24,7 @@ export type UploadProgressIndicatorProps = {
24
24
  type?: 'in_progress' | 'retry' | 'not_supported' | 'inactive' | null;
25
25
  };
26
26
 
27
- export const UploadProgressIndicator: React.FC<UploadProgressIndicatorProps> = (props) => {
27
+ export const UploadProgressIndicator = (props: PropsWithChildren<UploadProgressIndicatorProps>) => {
28
28
  const { action, children, style, type } = props;
29
29
 
30
30
  const {
@@ -5,7 +5,6 @@ import { act } from 'react-test-renderer';
5
5
  import { fireEvent, render } from '@testing-library/react-native';
6
6
 
7
7
  import {
8
- FileUpload,
9
8
  MessageInputContext,
10
9
  MessageInputContextValue,
11
10
  } from '../../../contexts/messageInputContext/MessageInputContext';
@@ -13,6 +12,7 @@ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
13
12
  import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
14
13
 
15
14
  import { generateFileUploadPreview } from '../../../mock-builders/generator/attachment';
15
+ import type { FileUpload } from '../../../types/types';
16
16
  import { AudioAttachment, AudioAttachmentProps } from '../../Attachment/AudioAttachment';
17
17
 
18
18
  jest.mock('../../../native.ts', () => ({
@@ -5,7 +5,6 @@ import { act } from 'react-test-renderer';
5
5
  import { fireEvent, render } from '@testing-library/react-native';
6
6
 
7
7
  import {
8
- FileUpload,
9
8
  MessageInputContext,
10
9
  MessageInputContextValue,
11
10
  } from '../../../contexts/messageInputContext/MessageInputContext';
@@ -13,6 +12,7 @@ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
13
12
  import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
14
13
 
15
14
  import { generateFileUploadPreview } from '../../../mock-builders/generator/attachment';
15
+ import type { FileUpload } from '../../../types/types';
16
16
  import { AudioAttachment, AudioAttachmentProps } from '../../Attachment/AudioAttachment';
17
17
 
18
18
  jest.mock('../../../native.ts', () => {
@@ -39,12 +39,12 @@ describe('MessageInput', () => {
39
39
  selectedImages: [
40
40
  generateImageAttachment({
41
41
  file: { height: 100, uri: 'https://picsum.photos/200/300', width: 100 },
42
- fileSize: 500000000,
42
+ size: 500000000,
43
43
  uri: 'https://picsum.photos/200/300',
44
44
  }),
45
45
  generateImageAttachment({
46
46
  file: { height: 100, uri: 'https://picsum.photos/200/300', width: 100 },
47
- fileSize: 600000000,
47
+ size: 600000000,
48
48
  uri: 'https://picsum.photos/200/300',
49
49
  }),
50
50
  ],
@@ -4,7 +4,7 @@ import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
4
4
 
5
5
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
6
6
  import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
7
- import { vw } from '../../utils/utils';
7
+ import { useViewport } from '../../hooks/useViewport';
8
8
 
9
9
  const styles = StyleSheet.create({
10
10
  container: {
@@ -28,6 +28,7 @@ export const InlineUnreadIndicator: React.FC = () => {
28
28
  },
29
29
  } = useTheme();
30
30
  const { t } = useTranslationContext();
31
+ const { vw } = useViewport();
31
32
 
32
33
  return (
33
34
  <View style={[styles.container, container]}>
@@ -10,8 +10,8 @@ import {
10
10
  } from '../../contexts/messageOverlayContext/MessageOverlayContext';
11
11
  import type { OverlayProviderProps } from '../../contexts/overlayContext/OverlayContext';
12
12
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
13
+ import { useViewport } from '../../hooks/useViewport';
13
14
  import type { DefaultStreamChatGenerics } from '../../types/types';
14
- import { vw } from '../../utils/utils';
15
15
 
16
16
  export type MessageActionListPropsWithContext<
17
17
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -52,6 +52,7 @@ const MessageActionListWithContext = <
52
52
  message,
53
53
  messageReactions,
54
54
  };
55
+ const { vw } = useViewport();
55
56
 
56
57
  const {
57
58
  theme: {
@@ -89,7 +90,7 @@ const MessageActionListWithContext = <
89
90
  width.value = layout.width;
90
91
  height.value = layout.height;
91
92
  }}
92
- style={[styles.container, { backgroundColor: white_snow }, showScreenStyle]}
93
+ style={[styles.container, { backgroundColor: white_snow, minWidth: vw(65) }, showScreenStyle]}
93
94
  testID='message-action-list'
94
95
  >
95
96
  {messageActions?.map((messageAction, index) => (
@@ -154,17 +155,8 @@ const styles = StyleSheet.create({
154
155
  container: {
155
156
  borderRadius: 16,
156
157
  marginTop: 8,
157
- minWidth: vw(65),
158
158
  overflow: 'hidden',
159
159
  },
160
- row: {
161
- alignItems: 'center',
162
- flexDirection: 'row',
163
- justifyContent: 'flex-start',
164
- minWidth: vw(65),
165
- paddingHorizontal: 20,
166
- paddingVertical: 10,
167
- },
168
160
  titleStyle: {
169
161
  paddingLeft: 20,
170
162
  },
@@ -6,8 +6,8 @@ import Animated from 'react-native-reanimated';
6
6
  import { useMessageActionAnimation } from './hooks/useMessageActionAnimation';
7
7
 
8
8
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
9
+ import { useViewport } from '../../hooks/useViewport';
9
10
  import type { DefaultStreamChatGenerics } from '../../types/types';
10
- import { vw } from '../../utils/utils';
11
11
  import type { MessageOverlayPropsWithContext } from '../MessageOverlay/MessageOverlay';
12
12
 
13
13
  export type ActionType =
@@ -50,6 +50,7 @@ const MessageActionListItemWithContext = <
50
50
  props: MessageActionListItemProps<StreamChatGenerics>,
51
51
  ) => {
52
52
  const { action, actionType, icon, index, length, title, titleStyle } = props;
53
+ const { vw } = useViewport();
53
54
 
54
55
  const {
55
56
  theme: {
@@ -65,6 +66,9 @@ const MessageActionListItemWithContext = <
65
66
  <Animated.View
66
67
  style={[
67
68
  styles.row,
69
+ {
70
+ minWidth: vw(65),
71
+ },
68
72
  index !== length - 1 ? { ...styles.bottomBorder, borderBottomColor: border } : {},
69
73
  animatedStyle,
70
74
  messageActions.actionContainer,
@@ -114,7 +118,6 @@ const styles = StyleSheet.create({
114
118
  alignItems: 'center',
115
119
  flexDirection: 'row',
116
120
  justifyContent: 'flex-start',
117
- minWidth: vw(65),
118
121
  paddingHorizontal: 20,
119
122
  paddingVertical: 10,
120
123
  },
@@ -41,8 +41,8 @@ import {
41
41
  } from '../../contexts/overlayContext/OverlayContext';
42
42
  import { mergeThemes, ThemeProvider, useTheme } from '../../contexts/themeContext/ThemeContext';
43
43
 
44
+ import { useViewport } from '../../hooks/useViewport';
44
45
  import type { DefaultStreamChatGenerics } from '../../types/types';
45
- import { vh, vw } from '../../utils/utils';
46
46
  import { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';
47
47
  import {
48
48
  OverlayReactions as DefaultOverlayReactions,
@@ -78,8 +78,6 @@ const styles = StyleSheet.create({
78
78
  scrollView: { overflow: Platform.OS === 'ios' ? 'visible' : 'scroll' },
79
79
  });
80
80
 
81
- const screenHeight = vh(100);
82
- const halfScreenHeight = vh(50);
83
81
  const DefaultMessageTextNumberOfLines = 5;
84
82
 
85
83
  export type MessageOverlayPropsWithContext<
@@ -154,6 +152,10 @@ const MessageOverlayWithContext = <
154
152
  };
155
153
 
156
154
  const { theme } = useTheme();
155
+ const { vh, vw } = useViewport();
156
+
157
+ const screenHeight = vh(100);
158
+ const halfScreenHeight = vh(50);
157
159
 
158
160
  const myMessageTheme = messagesContext?.myMessageTheme;
159
161
  const wrapMessageInTheme = clientId === message?.user?.id && !!myMessageTheme;
@@ -12,8 +12,8 @@ import {
12
12
  useThreadContext,
13
13
  } from '../../../contexts/threadContext/ThreadContext';
14
14
  import { useTranslationContext } from '../../../contexts/translationContext/TranslationContext';
15
+ import { useViewport } from '../../../hooks/useViewport';
15
16
  import type { DefaultStreamChatGenerics } from '../../../types/types';
16
- import { vw } from '../../../utils/utils';
17
17
 
18
18
  const styles = StyleSheet.create({
19
19
  absolute: { position: 'absolute' },
@@ -47,6 +47,7 @@ const ThreadFooterComponentWithContext = <
47
47
  ) => {
48
48
  const { Message, thread } = props;
49
49
  const { t } = useTranslationContext();
50
+ const { vw } = useViewport();
50
51
 
51
52
  const {
52
53
  theme: {
@@ -137,6 +137,11 @@ export type ChannelContextValue<
137
137
  scrollToFirstUnreadThreshold: number;
138
138
  setLastRead: React.Dispatch<React.SetStateAction<Date | undefined>>;
139
139
  setTargetedMessage: (messageId: string) => void;
140
+ /**
141
+ * Abort controller for cancelling async requests made for uploading images/files
142
+ * Its a map of filename and AbortController
143
+ */
144
+ uploadAbortControllerRef: React.MutableRefObject<Map<string, AbortController>>;
140
145
  /**
141
146
  *
142
147
  * ```json