stream-chat-react-native-core 4.3.1 → 4.4.0-beta.3

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 (186) hide show
  1. package/README.md +3 -3
  2. package/lib/commonjs/components/Attachment/Card.js +25 -28
  3. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  4. package/lib/commonjs/components/Attachment/FileAttachment.js +19 -24
  5. package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
  6. package/lib/commonjs/components/Attachment/Giphy.js +27 -25
  7. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  8. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +42 -0
  9. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -0
  10. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +11 -7
  11. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  12. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  13. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
  14. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  15. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js +4 -12
  16. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  17. package/lib/commonjs/components/Chat/Chat.js +8 -4
  18. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  19. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +80 -0
  20. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -0
  21. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +3 -1
  22. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  23. package/lib/commonjs/components/Message/Message.js +27 -22
  24. package/lib/commonjs/components/Message/Message.js.map +1 -1
  25. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +28 -14
  26. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  27. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +108 -40
  28. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  29. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +117 -24
  30. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  31. package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js +52 -20
  32. package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  33. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +8 -6
  34. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js.map +1 -1
  35. package/lib/commonjs/contexts/chatContext/ChatContext.js +2 -2
  36. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  37. package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
  38. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  39. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +145 -119
  40. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  41. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  42. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  43. package/lib/commonjs/i18n/en.json +2 -0
  44. package/lib/commonjs/i18n/fr.json +2 -0
  45. package/lib/commonjs/i18n/hi.json +2 -0
  46. package/lib/commonjs/i18n/it.json +2 -0
  47. package/lib/commonjs/i18n/ja.json +3 -1
  48. package/lib/commonjs/i18n/ko.json +3 -1
  49. package/lib/commonjs/i18n/nl.json +2 -0
  50. package/lib/commonjs/i18n/ru.json +2 -0
  51. package/lib/commonjs/i18n/tr.json +2 -0
  52. package/lib/commonjs/icons/Warning.js +38 -0
  53. package/lib/commonjs/icons/Warning.js.map +1 -0
  54. package/lib/commonjs/icons/index.js +13 -0
  55. package/lib/commonjs/icons/index.js.map +1 -1
  56. package/lib/commonjs/utils/utils.js +33 -2
  57. package/lib/commonjs/utils/utils.js.map +1 -1
  58. package/lib/commonjs/version.json +1 -1
  59. package/lib/module/components/Attachment/Card.js +25 -28
  60. package/lib/module/components/Attachment/Card.js.map +1 -1
  61. package/lib/module/components/Attachment/FileAttachment.js +19 -24
  62. package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
  63. package/lib/module/components/Attachment/Giphy.js +27 -25
  64. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  65. package/lib/module/components/Attachment/hooks/useGoToURL.js +42 -0
  66. package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -0
  67. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +11 -7
  68. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  69. package/lib/module/components/Channel/Channel.js.map +1 -1
  70. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
  71. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  72. package/lib/module/components/Channel/hooks/useCreateThreadContext.js +4 -12
  73. package/lib/module/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  74. package/lib/module/components/Chat/Chat.js +8 -4
  75. package/lib/module/components/Chat/Chat.js.map +1 -1
  76. package/lib/module/components/Chat/hooks/useAppSettings.js +80 -0
  77. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -0
  78. package/lib/module/components/Chat/hooks/useCreateChatContext.js +3 -1
  79. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  80. package/lib/module/components/Message/Message.js +27 -22
  81. package/lib/module/components/Message/Message.js.map +1 -1
  82. package/lib/module/components/Message/MessageSimple/utils/renderText.js +28 -14
  83. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  84. package/lib/module/components/MessageInput/FileUploadPreview.js +108 -40
  85. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  86. package/lib/module/components/MessageInput/ImageUploadPreview.js +117 -24
  87. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  88. package/lib/module/components/MessageInput/UploadProgressIndicator.js +52 -20
  89. package/lib/module/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  90. package/lib/module/components/MessageList/ScrollToBottomButton.js +8 -6
  91. package/lib/module/components/MessageList/ScrollToBottomButton.js.map +1 -1
  92. package/lib/module/contexts/chatContext/ChatContext.js +2 -2
  93. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  94. package/lib/module/contexts/messageContext/MessageContext.js +2 -2
  95. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  96. package/lib/module/contexts/messageInputContext/MessageInputContext.js +145 -119
  97. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  98. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  99. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  100. package/lib/module/i18n/en.json +2 -0
  101. package/lib/module/i18n/fr.json +2 -0
  102. package/lib/module/i18n/hi.json +2 -0
  103. package/lib/module/i18n/it.json +2 -0
  104. package/lib/module/i18n/ja.json +3 -1
  105. package/lib/module/i18n/ko.json +3 -1
  106. package/lib/module/i18n/nl.json +2 -0
  107. package/lib/module/i18n/ru.json +2 -0
  108. package/lib/module/i18n/tr.json +2 -0
  109. package/lib/module/icons/Warning.js +38 -0
  110. package/lib/module/icons/Warning.js.map +1 -0
  111. package/lib/module/icons/index.js +13 -0
  112. package/lib/module/icons/index.js.map +1 -1
  113. package/lib/module/utils/utils.js +33 -2
  114. package/lib/module/utils/utils.js.map +1 -1
  115. package/lib/module/version.json +1 -1
  116. package/lib/typescript/components/Attachment/FileAttachment.d.ts +0 -1
  117. package/lib/typescript/components/Attachment/hooks/useGoToURL.d.ts +2 -0
  118. package/lib/typescript/components/Chat/hooks/__tests__/useAppSettings.test.d.ts +1 -0
  119. package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts +3 -0
  120. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  121. package/lib/typescript/components/Message/Message.d.ts +12 -2
  122. package/lib/typescript/components/MessageInput/UploadProgressIndicator.d.ts +1 -3
  123. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +5 -1
  124. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -4
  125. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -3
  126. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -0
  127. package/lib/typescript/i18n/en.json +2 -0
  128. package/lib/typescript/i18n/fr.json +2 -0
  129. package/lib/typescript/i18n/hi.json +2 -0
  130. package/lib/typescript/i18n/it.json +2 -0
  131. package/lib/typescript/i18n/ja.json +3 -1
  132. package/lib/typescript/i18n/ko.json +3 -1
  133. package/lib/typescript/i18n/nl.json +2 -0
  134. package/lib/typescript/i18n/ru.json +2 -0
  135. package/lib/typescript/i18n/tr.json +2 -0
  136. package/lib/typescript/icons/Warning.d.ts +3 -0
  137. package/lib/typescript/icons/index.d.ts +1 -0
  138. package/lib/typescript/utils/Streami18n.d.ts +6 -0
  139. package/lib/typescript/utils/utils.d.ts +15 -2
  140. package/package.json +2 -2
  141. package/src/components/Attachment/Card.tsx +5 -13
  142. package/src/components/Attachment/FileAttachment.tsx +5 -13
  143. package/src/components/Attachment/Giphy.tsx +3 -1
  144. package/src/components/Attachment/__tests__/Attachment.test.js +39 -0
  145. package/src/components/Attachment/hooks/useGoToURL.ts +27 -0
  146. package/src/components/AttachmentPicker/AttachmentPicker.tsx +23 -13
  147. package/src/components/Channel/Channel.tsx +1 -1
  148. package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -9
  149. package/src/components/Channel/hooks/useCreateThreadContext.ts +3 -9
  150. package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +1 -0
  151. package/src/components/Chat/Chat.tsx +4 -0
  152. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +34 -0
  153. package/src/components/Chat/hooks/useAppSettings.ts +39 -0
  154. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  155. package/src/components/Message/Message.tsx +56 -48
  156. package/src/components/Message/MessageSimple/utils/renderText.tsx +17 -2
  157. package/src/components/MessageInput/FileUploadPreview.tsx +60 -14
  158. package/src/components/MessageInput/ImageUploadPreview.tsx +95 -42
  159. package/src/components/MessageInput/UploadProgressIndicator.tsx +49 -22
  160. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +50 -80
  161. package/src/components/MessageInput/__tests__/ImageUploadPreview.test.js +49 -74
  162. package/src/components/MessageInput/__tests__/UploadProgressIndicator.test.js +36 -13
  163. package/src/components/MessageInput/__tests__/__snapshots__/MessageInput.test.js.snap +2 -2
  164. package/src/components/MessageInput/__tests__/__snapshots__/UploadProgressIndicator.test.js.snap +122 -17
  165. package/src/components/MessageList/ScrollToBottomButton.tsx +2 -1
  166. package/src/components/MessageList/__tests__/__snapshots__/ScrollToBottomButton.test.js.snap +1 -0
  167. package/src/contexts/chatContext/ChatContext.tsx +5 -1
  168. package/src/contexts/messageContext/MessageContext.tsx +7 -4
  169. package/src/contexts/messageInputContext/MessageInputContext.tsx +127 -96
  170. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
  171. package/src/contexts/themeContext/utils/theme.ts +1 -0
  172. package/src/i18n/en.json +2 -0
  173. package/src/i18n/fr.json +2 -0
  174. package/src/i18n/hi.json +2 -0
  175. package/src/i18n/it.json +2 -0
  176. package/src/i18n/ja.json +3 -1
  177. package/src/i18n/ko.json +3 -1
  178. package/src/i18n/nl.json +2 -0
  179. package/src/i18n/ru.json +2 -0
  180. package/src/i18n/tr.json +2 -0
  181. package/src/icons/Warning.tsx +12 -0
  182. package/src/icons/index.ts +1 -0
  183. package/src/utils/utils.ts +53 -1
  184. package/src/version.json +1 -1
  185. package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +0 -4413
  186. package/src/components/MessageInput/__tests__/__snapshots__/ImageUploadPreview.test.js.snap +0 -2373
@@ -1,7 +1,7 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import type { Attachment } from 'stream-chat';
3
3
  import type { ActionHandler } from '../../components/Attachment/Attachment';
4
- import type { TouchableHandlerPayload } from '../../components/Message/Message';
4
+ import type { MessageTouchableHandlerPayload, TouchableHandlerPayload } from '../../components/Message/Message';
5
5
  import type { GroupType, MessageType } from '../../components/MessageList/hooks/useMessageList';
6
6
  import type { ChannelContextValue } from '../../contexts/channelContext/ChannelContext';
7
7
  import type { MessageContentType } from '../../contexts/messagesContext/MessagesContext';
@@ -54,7 +54,7 @@ export declare type MessageContextValue<StreamChatGenerics extends DefaultStream
54
54
  *
55
55
  * By default, we show the overlay with all the message actions on long press.
56
56
  *
57
- * @param event Event object for onLongPress event
57
+ * @param payload Payload object for onLongPress event
58
58
  */
59
59
  onLongPress: (payload: TouchableHandlerPayload) => void;
60
60
  /** Whether the message is only text and the text is only emojis */
@@ -69,9 +69,9 @@ export declare type MessageContextValue<StreamChatGenerics extends DefaultStream
69
69
  *
70
70
  * By default, we will dismiss the keyboard on press.
71
71
  *
72
- * @param event Event object for onPress event
72
+ * @param payload Payload object for onPress event
73
73
  */
74
- onPress: (payload: TouchableHandlerPayload) => void;
74
+ onPress: (payload: MessageTouchableHandlerPayload) => void;
75
75
  onPressIn: ((payload: TouchableHandlerPayload) => void) | null;
76
76
  /** The images attached to a message */
77
77
  otherAttachments: Attachment<StreamChatGenerics>[];
@@ -17,7 +17,7 @@ import type { UploadProgressIndicatorProps } from '../../components/MessageInput
17
17
  import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
18
18
  import { Asset } from '../../native';
19
19
  import type { DefaultStreamChatGenerics, UnknownType } from '../../types/types';
20
- import { ACITriggerSettingsParams, TriggerSettings } from '../../utils/utils';
20
+ import { ACITriggerSettingsParams, FileStateValue, TriggerSettings } from '../../utils/utils';
21
21
  import { ChannelContextValue } from '../channelContext/ChannelContext';
22
22
  export declare type FileUpload = {
23
23
  file: {
@@ -27,7 +27,7 @@ export declare type FileUpload = {
27
27
  uri?: string;
28
28
  };
29
29
  id: string;
30
- state: string;
30
+ state: FileStateValue;
31
31
  url?: string;
32
32
  };
33
33
  export declare type ImageUpload = {
@@ -35,7 +35,7 @@ export declare type ImageUpload = {
35
35
  name?: string;
36
36
  };
37
37
  id: string;
38
- state: string;
38
+ state: FileStateValue;
39
39
  height?: number;
40
40
  url?: string;
41
41
  width?: number;
@@ -330,6 +330,7 @@ export declare type Theme = {
330
330
  unreadCountNotificationContainer: ViewStyle;
331
331
  unreadCountNotificationText: TextStyle;
332
332
  wrapper: ViewStyle;
333
+ chevronColor?: Color;
333
334
  };
334
335
  typingIndicatorContainer: ViewStyle;
335
336
  };
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Error loading channel list...",
20
20
  "Error loading messages for this channel...": "Error loading messages for this channel...",
21
21
  "Error while loading, please reload/refresh": "Error while loading, please reload/refresh",
22
+ "File type not supported": "File type not supported",
22
23
  "Flag": "Flag",
23
24
  "Flag Message": "Flag Message",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "Flag action failed either due to a network issue or the message is already flagged.",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Message deleted",
32
33
  "Message flagged": "Message flagged",
33
34
  "Mute User": "Mute User",
35
+ "Not supported": "Not supported",
34
36
  "Nothing yet...": "Nothing yet...",
35
37
  "Ok": "Ok",
36
38
  "Only visible to you": "Only visible to you",
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Erreur lors du chargement de la liste de canaux...",
20
20
  "Error loading messages for this channel...": "Erreur lors du chargement des messages de ce canal...",
21
21
  "Error while loading, please reload/refresh": "Erreur lors du chargement, veuillez recharger/rafraîchir",
22
+ "File type not supported": "Le type de fichier n'est pas pris en charge",
22
23
  "Flag": "Signaler",
23
24
  "Flag Message": "Signaler le message",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "L'action de signalisation a échoué en raison d'un problème de réseau ou le message est déjà signalé.",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Message supprimé",
32
33
  "Message flagged": "Message signalé",
33
34
  "Mute User": "Utilisateur muet",
35
+ "Not supported": "Non pris en charge",
34
36
  "Nothing yet...": "Aucun message...",
35
37
  "Ok": "Ok",
36
38
  "Only visible to you": "Seulement visible par vous",
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "चैनल सूची लोड करने में त्रुटि...",
20
20
  "Error loading messages for this channel...": "इस चैनल के लिए मेसेजेस लोड करने में त्रुटि हुई...",
21
21
  "Error while loading, please reload/refresh": "एरर, रिफ्रेश करे",
22
+ "File type not supported": "फ़ाइल प्रकार समर्थित नहीं है",
22
23
  "Flag": "झंडा",
23
24
  "Flag Message": "झंडा संदेश",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "फ़्लैग कार्रवाई या तो नेटवर्क समस्या के कारण विफल हो गई या संदेश पहले से फ़्लैग किया गया है।",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "मैसेज हटा दिया गया",
32
33
  "Message flagged": "संदेश को ध्वजांकित किया गया",
33
34
  "Mute User": "उपयोगकर्ता को म्यूट करें",
35
+ "Not supported": "समर्थित नहीं",
34
36
  "Nothing yet...": "कोई मैसेज नहीं है...",
35
37
  "Ok": "ठीक",
36
38
  "Only visible to you": "केवल आपको दिखाई दे रहा है",
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Errore durante il caricamento della lista dei canali...",
20
20
  "Error loading messages for this channel...": "Errore durante il caricamento dei messaggi per questo canale...",
21
21
  "Error while loading, please reload/refresh": "Errore durante il caricamento, per favore ricarica la pagina",
22
+ "File type not supported": "Tipo di file non supportato",
22
23
  "Flag": "Contrassegna",
23
24
  "Flag Message": "Contrassegna Messaggio",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "L'azione di segnalazione non è riuscita a causa di un problema di rete o il messaggio è già segnalato.",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Messaggio cancellato",
32
33
  "Message flagged": "Messaggio contrassegnato",
33
34
  "Mute User": "Utente Muto",
35
+ "Not supported": "non supportato",
34
36
  "Nothing yet...": "Ancora niente...",
35
37
  "Ok": "Ok",
36
38
  "Only visible to you": "Visibile solo a te",
@@ -63,5 +63,7 @@
63
63
  "Only visible to you": "あなただけに見える",
64
64
  "Reply": "返事",
65
65
  "Reply to Message": "メッセージに返信",
66
- "🏙 Attachment...": "🏙 アタッチメント..."
66
+ "🏙 Attachment...": "🏙 アタッチメント...",
67
+ "Not supported": "サポートしていません",
68
+ "File type not supported": "サポートされていないファイルです"
67
69
  }
@@ -63,5 +63,7 @@
63
63
  "Only visible to you": "당신만 볼 수 있습니다",
64
64
  "Reply": "답장",
65
65
  "Reply to Message": "메시지에 답장",
66
- "🏙 Attachment...": "🏙 부착..."
66
+ "🏙 Attachment...": "🏙 부착...",
67
+ "File type not supported": "지원하지 않는 파일입니다.",
68
+ "Not supported": "지원하지 않습니다"
67
69
  }
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Probleem bij het laden van de kanalen...",
20
20
  "Error loading messages for this channel...": "Probleem bij het laden van de berichten in dit kanaal...",
21
21
  "Error while loading, please reload/refresh": "Probleem bij het laden, probeer opnieuw",
22
+ "File type not supported": "Bestandstype niet ondersteund",
22
23
  "Flag": "Markeer",
23
24
  "Flag Message": "Markeer bericht",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "Rapporteren mislukt door een netwerk fout of het berich is al gerapporteerd",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Bericht verwijderd",
32
33
  "Message flagged": "Bericht gemarkeerd",
33
34
  "Mute User": "Gebruiker dempen",
35
+ "Not supported": "niet ondersteund",
34
36
  "Nothing yet...": "Nog niets...",
35
37
  "Ok": "Oké",
36
38
  "Only visible to you": "Alleen zichtbaar voor jou",
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Ошибка загрузки списка каналов...",
20
20
  "Error loading messages for this channel...": "Ошибка загрузки сообщений для этого канала...",
21
21
  "Error while loading, please reload/refresh": "Ошибка загрузки, пожалуйста перезагрузите или обновите",
22
+ "File type not supported": "Тип файла не поддерживается",
22
23
  "Flag": "Пометить",
23
24
  "Flag Message": "Пометить сообщение",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "Не удалось отправить жалобу. Возможные причины: проблема с подключением к интернету или ваша жалоба уже была принята.",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Сообщение удалено",
32
33
  "Message flagged": "Сообщение отмечено",
33
34
  "Mute User": "Отключить пользователя",
35
+ "Not supported": "не поддерживается",
34
36
  "Nothing yet...": "Пока ничего нет...",
35
37
  "Ok": "Oк",
36
38
  "Only visible to you": "Видно только вам",
@@ -19,6 +19,7 @@
19
19
  "Error loading channel list...": "Kanal listesi yüklenirken hata oluştu...",
20
20
  "Error loading messages for this channel...": "Bu kanal için mesajlar yüklenirken hata oluştu...",
21
21
  "Error while loading, please reload/refresh": "Yüklenirken hata oluştu, lütfen tekrar deneyin",
22
+ "File type not supported": "Dosya türü desteklenmiyor",
22
23
  "Flag": "Raporla",
23
24
  "Flag Message": "Mesajı İşaretle",
24
25
  "Flag action failed either due to a network issue or the message is already flagged": "Raporlama, mesajın raporlanmış olması veya bağlantı hatası sebebiyle başarısız oldu.",
@@ -31,6 +32,7 @@
31
32
  "Message deleted": "Mesaj silindi",
32
33
  "Message flagged": "Mesaj işaretlendi",
33
34
  "Mute User": "Kullanıcının Sesini Kapat",
35
+ "Not supported": "Desteklenmiyor",
34
36
  "Nothing yet...": "Şimdilik hiçbir şey...",
35
37
  "Ok": "Tamam",
36
38
  "Only visible to you": "Sadece siz görebilirsiniz",
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './utils/base';
3
+ export declare const Warning: React.FC<IconProps>;
@@ -73,6 +73,7 @@ export * from './User';
73
73
  export * from './UserAdd';
74
74
  export * from './UserDelete';
75
75
  export * from './UserMinus';
76
+ export * from './Warning';
76
77
  export * from './WutReaction';
77
78
  export * from './XLS';
78
79
  export * from './XLSX';
@@ -131,6 +131,7 @@ export declare class Streami18n {
131
131
  "Error loading channel list...": string;
132
132
  "Error loading messages for this channel...": string;
133
133
  "Error while loading, please reload/refresh": string;
134
+ "File type not supported": string;
134
135
  Flag: string;
135
136
  "Flag Message": string;
136
137
  "Flag action failed either due to a network issue or the message is already flagged": string;
@@ -143,6 +144,7 @@ export declare class Streami18n {
143
144
  "Message deleted": string;
144
145
  "Message flagged": string;
145
146
  "Mute User": string;
147
+ "Not supported": string;
146
148
  "Nothing yet...": string;
147
149
  Ok: string;
148
150
  "Only visible to you": string;
@@ -152,6 +154,10 @@ export declare class Streami18n {
152
154
  "Please enable access to your photos and videos so you can share them.": string;
153
155
  "Please select a channel first": string;
154
156
  "Reconnecting...": string;
157
+ /**
158
+ * Hindi notation for meridiems are quite fuzzy in practice. While there exists
159
+ * a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
160
+ */
155
161
  Reply: string;
156
162
  "Reply to Message": string;
157
163
  Resend: string;
@@ -1,6 +1,6 @@
1
1
  import type React from 'react';
2
2
  import type { DebouncedFunc } from 'lodash';
3
- import type { Channel, CommandResponse, StreamChat } from 'stream-chat';
3
+ import type { Channel, CommandResponse, FormatMessageResponse, StreamChat } from 'stream-chat';
4
4
  import type { MentionAllAppUsersQuery } from '../contexts/messageInputContext/MessageInputContext';
5
5
  import type { SuggestionCommand, SuggestionComponentType, SuggestionUser } from '../contexts/suggestionsContext/SuggestionsContext';
6
6
  import { Emoji } from '../emoji-data/compiled';
@@ -12,13 +12,15 @@ export declare type ReactionData = {
12
12
  };
13
13
  export declare const FileState: Readonly<{
14
14
  FINISHED: string;
15
- NO_FILE: string;
15
+ NOT_SUPPORTED: string;
16
16
  UPLOAD_FAILED: string;
17
17
  UPLOADED: string;
18
18
  UPLOADING: string;
19
19
  }>;
20
20
  export declare const ProgressIndicatorTypes: {
21
21
  IN_PROGRESS: 'in_progress';
22
+ INACTIVE: 'inactive';
23
+ NOT_SUPPORTED: 'not_supported';
22
24
  RETRY: 'retry';
23
25
  };
24
26
  export declare const MessageStatusTypes: {
@@ -26,6 +28,10 @@ export declare const MessageStatusTypes: {
26
28
  RECEIVED: string;
27
29
  SENDING: string;
28
30
  };
31
+ export declare type FileStateValue = typeof FileState[keyof typeof FileState];
32
+ declare type ValueOf<T> = T[keyof T];
33
+ declare type Progress = ValueOf<typeof ProgressIndicatorTypes>;
34
+ export declare const getIndicatorTypeForFileState: (fileState: FileStateValue) => Progress | null;
29
35
  export declare const queryMembersDebounced: DebouncedFunc<(<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(channel: Channel<StreamChatGenerics>, query: SuggestionUser<StreamChatGenerics>["name"], onReady?: ((users: SuggestionUser<StreamChatGenerics>[]) => void) | undefined, options?: {
30
36
  limit?: number;
31
37
  }) => Promise<void>)>;
@@ -104,3 +110,10 @@ export declare const vh: (percentageHeight: number, rounded?: boolean) => number
104
110
  export declare const generateRandomId: (a?: string) => string;
105
111
  export declare const emojiRegex: RegExp;
106
112
  export declare const urlRegex: RegExp;
113
+ /**
114
+ * Reduces a list of messages to strings that are used in useEffect & useMemo
115
+ * @param {messages} messages - the array of messages to be compared
116
+ * @returns {string} The mapped message string
117
+ */
118
+ export declare const reduceMessagesToString: <StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics>(messages: FormatMessageResponse<StreamChatGenerics>[]) => string;
119
+ export {};
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": "4.3.1",
4
+ "version": "4.4.0-beta.3",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -126,7 +126,7 @@
126
126
  "eslint-plugin-sort-destructure-keys": "1.3.5",
127
127
  "eslint-plugin-typescript-sort-keys": "1.6.0",
128
128
  "jest": "26.6.3",
129
- "moment": "2.29.1",
129
+ "moment": "2.29.2",
130
130
  "prettier": "2.3.0",
131
131
  "react": "17.0.2",
132
132
  "react-docgen-typescript": "1.22.0",
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import {
3
3
  Image,
4
4
  ImageStyle,
5
- Linking,
6
5
  StyleProp,
7
6
  StyleSheet,
8
7
  Text,
@@ -14,6 +13,8 @@ import {
14
13
 
15
14
  import type { Attachment } from 'stream-chat';
16
15
 
16
+ import { useGoToURL } from './hooks/useGoToURL';
17
+
17
18
  import {
18
19
  MessageContextValue,
19
20
  useMessageContext,
@@ -67,17 +68,6 @@ const styles = StyleSheet.create({
67
68
  },
68
69
  });
69
70
 
70
- const goToURL = (url?: string) => {
71
- if (!url) return;
72
- Linking.canOpenURL(url).then((supported) => {
73
- if (supported) {
74
- Linking.openURL(url);
75
- } else {
76
- console.log(`Don't know how to open URI: ${url}`);
77
- }
78
- });
79
- };
80
-
81
71
  export type CardPropsWithContext<
82
72
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
83
73
  > = Attachment<StreamChatGenerics> &
@@ -149,7 +139,9 @@ const CardWithContext = <
149
139
 
150
140
  const uri = image_url || thumb_url;
151
141
 
152
- const defaultOnPress = () => goToURL(og_scrape_url || uri);
142
+ const [error, openURL] = useGoToURL(og_scrape_url || uri);
143
+
144
+ const defaultOnPress = () => !error && openURL && openURL();
153
145
 
154
146
  return (
155
147
  <TouchableOpacity
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import {
3
- Linking,
4
3
  StyleProp,
5
4
  StyleSheet,
6
5
  Text,
@@ -12,6 +11,8 @@ import {
12
11
 
13
12
  import type { Attachment } from 'stream-chat';
14
13
 
14
+ import { useGoToURL } from './hooks/useGoToURL';
15
+
15
16
  import { AttachmentActions as AttachmentActionsDefault } from '../../components/Attachment/AttachmentActions';
16
17
  import { FileIcon as FileIconDefault } from '../../components/Attachment/FileIcon';
17
18
  import {
@@ -94,7 +95,9 @@ const FileAttachmentWithContext = <
94
95
  },
95
96
  } = useTheme();
96
97
 
97
- const defaultOnPress = () => goToURL(attachment.asset_url);
98
+ const [error, openURL] = useGoToURL(attachment.asset_url);
99
+
100
+ const defaultOnPress = () => !error && openURL && openURL();
98
101
 
99
102
  return (
100
103
  <TouchableOpacity
@@ -190,15 +193,4 @@ export const getFileSizeDisplayText = (size?: number | string) => {
190
193
  return `${Math.floor(Math.floor(size / 10000) / 100)} MB`;
191
194
  };
192
195
 
193
- export const goToURL = (url?: string) => {
194
- if (!url) return;
195
- Linking.canOpenURL(url).then((supported) => {
196
- if (supported) {
197
- Linking.openURL(url);
198
- } else {
199
- console.log(`Don't know how to open URI: ${url}`);
200
- }
201
- });
202
- };
203
-
204
196
  FileAttachment.displayName = 'FileAttachment{messageSimple{file}}';
@@ -65,6 +65,7 @@ const styles = StyleSheet.create({
65
65
  },
66
66
  giphyHeaderTitle: {
67
67
  fontSize: 14,
68
+ marginLeft: 8,
68
69
  },
69
70
  giphyMask: {
70
71
  bottom: 8,
@@ -84,7 +85,8 @@ const styles = StyleSheet.create({
84
85
  width: '60%',
85
86
  },
86
87
  selectionContainer: {
87
- borderBottomLeftRadius: 8,
88
+ borderBottomRightRadius: 0,
89
+ borderRadius: 16,
88
90
  borderWidth: 1,
89
91
  overflow: 'hidden',
90
92
  width: 272,
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
2
 
3
+ import { Linking } from 'react-native';
4
+
5
+ import { act, renderHook } from '@testing-library/react-hooks';
3
6
  import { fireEvent, render, waitFor } from '@testing-library/react-native';
4
7
  import { v4 as uuidv4 } from 'uuid';
5
8
 
@@ -15,6 +18,7 @@ import {
15
18
  import { generateMessage } from '../../../mock-builders/generator/message';
16
19
  import { Attachment } from '../Attachment';
17
20
  import { AttachmentActions } from '../AttachmentActions';
21
+ import { useGoToURL } from '../hooks/useGoToURL';
18
22
 
19
23
  const getAttachmentComponent = (props) => {
20
24
  const message = generateMessage();
@@ -120,4 +124,39 @@ describe('Attachment', () => {
120
124
  expect(getByTestId('card-attachment')).toBeTruthy();
121
125
  });
122
126
  });
127
+
128
+ it('should open the URL in the browser', async () => {
129
+ jest.spyOn(Linking, 'canOpenURL').mockImplementation(jest.fn().mockResolvedValue(true));
130
+
131
+ jest.spyOn(Linking, 'openURL').mockImplementation(jest.fn().mockResolvedValue(false));
132
+
133
+ const { result, waitFor } = renderHook(() => useGoToURL('www.google.com'));
134
+
135
+ const [error, openURL] = result.current;
136
+
137
+ await act(openURL);
138
+
139
+ await waitFor(() => {
140
+ expect(Linking.canOpenURL).toHaveBeenCalled();
141
+ expect(error).not.toBeTruthy();
142
+ expect(Linking.openURL).toHaveBeenCalled();
143
+ });
144
+ });
145
+
146
+ it('should open the URL in the browser when no url', async () => {
147
+ jest.spyOn(Linking, 'canOpenURL').mockImplementation(jest.fn().mockResolvedValue(false));
148
+
149
+ jest.spyOn(Linking, 'openURL').mockImplementation(jest.fn().mockResolvedValue(true));
150
+
151
+ const { result, waitForNextUpdate } = await renderHook(() => useGoToURL());
152
+ const [error, openURL] = result.current;
153
+
154
+ act(openURL);
155
+
156
+ await waitForNextUpdate(() => {
157
+ expect(Linking.canOpenURL).toHaveBeenCalled();
158
+ expect(error).toBeTruthy();
159
+ expect(Linking.openURL).not.toHaveBeenCalled();
160
+ });
161
+ });
123
162
  });
@@ -0,0 +1,27 @@
1
+ import { useState } from 'react';
2
+ import { Linking } from 'react-native';
3
+
4
+ export type UseGoToURLType = (url?: string) => [boolean, () => Promise<void>];
5
+
6
+ export const useGoToURL: UseGoToURLType = (url?: string) => {
7
+ const [error, setError] = useState<boolean>(false);
8
+
9
+ let finalUrl = url as string;
10
+ const pattern = new RegExp(/^\S+:\/\//);
11
+
12
+ if (!pattern.test(finalUrl)) {
13
+ finalUrl = 'http://' + url;
14
+ }
15
+
16
+ const openURL = () =>
17
+ Linking.canOpenURL(finalUrl).then((supported) => {
18
+ if (supported) {
19
+ Linking.openURL(finalUrl);
20
+ } else {
21
+ setError(true);
22
+ console.log(`Don't know how to open URI: ${finalUrl}`);
23
+ }
24
+ });
25
+
26
+ return [error, openURL];
27
+ };
@@ -34,7 +34,7 @@ const styles = StyleSheet.create({
34
34
  });
35
35
 
36
36
  const screenHeight = vh(100);
37
- const fullScreenHeight = Dimensions.get('screen').height;
37
+ const fullScreenHeight = Dimensions.get('window').height;
38
38
 
39
39
  type AttachmentImageProps = {
40
40
  ImageOverlaySelectedComponent: React.ComponentType;
@@ -326,26 +326,36 @@ export const AttachmentPicker = React.forwardRef(
326
326
  : statusBarHeight
327
327
  : 0;
328
328
 
329
- /**
330
- * Snap points changing cause a rerender of the position,
331
- * this is an issue if you are calling close on the bottom sheet.
332
- */
333
- const snapPoints = useMemo(
334
- () => [
335
- attachmentPickerBottomSheetHeight ??
336
- 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) - handleHeight,
337
- fullScreenHeight - topInset - handleHeight,
338
- ],
329
+ const initialSnapPoint = useMemo(
330
+ () =>
331
+ attachmentPickerBottomSheetHeight ?? Platform.OS === 'android'
332
+ ? 308 +
333
+ (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) -
334
+ handleHeight
335
+ : 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment),
339
336
  [
340
- androidBottomBarHeightAdjustment,
341
337
  attachmentPickerBottomSheetHeight,
338
+ androidBottomBarHeightAdjustment,
342
339
  fullScreenHeight,
343
340
  handleHeight,
344
341
  screenHeight,
345
- topInset,
346
342
  ],
347
343
  );
348
344
 
345
+ const finalSnapPoint = useMemo(
346
+ () =>
347
+ Platform.OS === 'android'
348
+ ? fullScreenHeight - topInset - handleHeight
349
+ : fullScreenHeight - topInset,
350
+ [fullScreenHeight, handleHeight, topInset],
351
+ );
352
+
353
+ /**
354
+ * Snap points changing cause a rerender of the position,
355
+ * this is an issue if you are calling close on the bottom sheet.
356
+ */
357
+ const snapPoints = [initialSnapPoint, finalSnapPoint];
358
+
349
359
  return (
350
360
  <>
351
361
  <BottomSheet
@@ -1606,7 +1606,7 @@ const ChannelWithContext = <
1606
1606
  watchers,
1607
1607
  });
1608
1608
 
1609
- const inputMessageInputContext = useCreateInputMessageInputContext({
1609
+ const inputMessageInputContext = useCreateInputMessageInputContext<StreamChatGenerics>({
1610
1610
  additionalTextInputProps,
1611
1611
  AttachButton,
1612
1612
  autoCompleteSuggestionsLimit,
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
2
2
 
3
3
  import type { PaginatedMessageListContextValue } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';
4
4
  import type { DefaultStreamChatGenerics } from '../../../types/types';
5
+ import { reduceMessagesToString } from '../../../utils/utils';
5
6
 
6
7
  export const useCreatePaginatedMessageListContext = <
7
8
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -18,14 +19,7 @@ export const useCreatePaginatedMessageListContext = <
18
19
  }: PaginatedMessageListContextValue<StreamChatGenerics> & {
19
20
  channelId?: string;
20
21
  }) => {
21
- const messagesUpdated = messages
22
- .map(
23
- ({ deleted_at, latest_reactions, reply_count, status, updated_at }) =>
24
- `${deleted_at}${
25
- latest_reactions ? latest_reactions.map(({ type }) => type).join() : ''
26
- }${reply_count}${status}${updated_at?.toISOString?.() || updated_at}`,
27
- )
28
- .join();
22
+ const messagesStr = reduceMessagesToString(messages);
29
23
 
30
24
  const paginatedMessagesContext: PaginatedMessageListContextValue<StreamChatGenerics> = useMemo(
31
25
  () => ({
@@ -38,7 +32,7 @@ export const useCreatePaginatedMessageListContext = <
38
32
  setLoadingMore,
39
33
  setLoadingMoreRecent,
40
34
  }),
41
- [channelId, hasMore, loadingMoreRecent, loadingMore, messagesUpdated],
35
+ [channelId, hasMore, loadingMoreRecent, loadingMore, messagesStr],
42
36
  );
43
37
 
44
38
  return paginatedMessagesContext;
@@ -2,6 +2,7 @@ import { useMemo } from 'react';
2
2
 
3
3
  import type { ThreadContextValue } from '../../../contexts/threadContext/ThreadContext';
4
4
  import type { DefaultStreamChatGenerics } from '../../../types/types';
5
+ import { reduceMessagesToString } from '../../../utils/utils';
5
6
 
6
7
  export const useCreateThreadContext = <
7
8
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -19,14 +20,7 @@ export const useCreateThreadContext = <
19
20
  }: ThreadContextValue<StreamChatGenerics>) => {
20
21
  const threadId = thread?.id;
21
22
  const threadReplyCount = thread?.reply_count;
22
- const threadMessagesUpdated = threadMessages
23
- .map(
24
- ({ deleted_at, latest_reactions, reply_count, status, updated_at }) =>
25
- `${deleted_at}${
26
- latest_reactions ? latest_reactions.map(({ type }) => type).join() : ''
27
- }${reply_count}${status}${updated_at.toISOString()}`,
28
- )
29
- .join();
23
+ const threadMessagesStr = reduceMessagesToString(threadMessages);
30
24
 
31
25
  const threadContext: ThreadContextValue<StreamChatGenerics> = useMemo(
32
26
  () => ({
@@ -46,7 +40,7 @@ export const useCreateThreadContext = <
46
40
  threadHasMore,
47
41
  threadId,
48
42
  threadLoadingMore,
49
- threadMessagesUpdated,
43
+ threadMessagesStr,
50
44
  threadReplyCount,
51
45
  ],
52
46
  );
@@ -55,6 +55,7 @@ describe('useChannelUpdated', () => {
55
55
  render(
56
56
  <ChatContext.Provider
57
57
  value={{
58
+ appSettings: null,
58
59
  client: mockClient,
59
60
  connectionRecovering: false,
60
61
  isOnline: true,