stream-chat-react-native-core 4.4.0 → 4.5.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (571) hide show
  1. package/README.md +2 -2
  2. package/lib/commonjs/components/Attachment/Attachment.js +1 -1
  3. package/lib/commonjs/components/Attachment/AttachmentActions.js +1 -1
  4. package/lib/commonjs/components/Attachment/Card.js +26 -29
  5. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  6. package/lib/commonjs/components/Attachment/FileAttachment.js +20 -25
  7. package/lib/commonjs/components/Attachment/FileAttachment.js.map +1 -1
  8. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +1 -1
  9. package/lib/commonjs/components/Attachment/FileIcon.js +1 -1
  10. package/lib/commonjs/components/Attachment/Gallery.js +1 -1
  11. package/lib/commonjs/components/Attachment/Giphy.js +1 -1
  12. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +42 -0
  13. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -0
  14. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +25 -18
  15. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  16. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
  17. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
  18. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
  19. package/lib/commonjs/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
  20. package/lib/commonjs/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
  21. package/lib/commonjs/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
  22. package/lib/commonjs/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
  23. package/lib/commonjs/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
  24. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
  25. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
  26. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
  27. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
  28. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  29. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  30. package/lib/commonjs/components/Avatar/GroupAvatar.js +1 -1
  31. package/lib/commonjs/components/Channel/Channel.js +1 -1
  32. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  33. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
  34. package/lib/commonjs/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  35. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js +4 -12
  36. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  37. package/lib/commonjs/components/ChannelList/ChannelList.js +1 -1
  38. package/lib/commonjs/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
  39. package/lib/commonjs/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
  40. package/lib/commonjs/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
  41. package/lib/commonjs/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
  42. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +1 -1
  43. package/lib/commonjs/components/ChannelList/Skeleton.js +1 -1
  44. package/lib/commonjs/components/ChannelPreview/ChannelAvatar.js +1 -1
  45. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +1 -1
  46. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessage.js +1 -1
  47. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
  48. package/lib/commonjs/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
  49. package/lib/commonjs/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
  50. package/lib/commonjs/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
  51. package/lib/commonjs/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
  52. package/lib/commonjs/components/Chat/Chat.js +9 -5
  53. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  54. package/lib/commonjs/components/Chat/hooks/useAppSettings.js +80 -0
  55. package/lib/commonjs/components/Chat/hooks/useAppSettings.js.map +1 -0
  56. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js +3 -1
  57. package/lib/commonjs/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  58. package/lib/commonjs/components/ImageGallery/ImageGallery.js +1 -1
  59. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
  60. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
  61. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
  62. package/lib/commonjs/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
  63. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +1 -1
  64. package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js +1 -1
  65. package/lib/commonjs/components/Indicators/EmptyStateIndicator.js +1 -1
  66. package/lib/commonjs/components/Indicators/LoadingDot.js +1 -1
  67. package/lib/commonjs/components/Indicators/LoadingDots.js +1 -1
  68. package/lib/commonjs/components/Indicators/LoadingErrorIndicator.js +1 -1
  69. package/lib/commonjs/components/Indicators/LoadingIndicator.js +1 -1
  70. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
  71. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
  72. package/lib/commonjs/components/Message/Message.js +28 -23
  73. package/lib/commonjs/components/Message/Message.js.map +1 -1
  74. package/lib/commonjs/components/Message/MessageSimple/MessageAvatar.js +1 -1
  75. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +1 -1
  76. package/lib/commonjs/components/Message/MessageSimple/MessageDeleted.js +1 -1
  77. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js +1 -1
  78. package/lib/commonjs/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
  79. package/lib/commonjs/components/Message/MessageSimple/MessageReplies.js +1 -1
  80. package/lib/commonjs/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
  81. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +1 -1
  82. package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +1 -1
  83. package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js +1 -1
  84. package/lib/commonjs/components/Message/MessageSimple/ReactionList.js +1 -1
  85. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +29 -15
  86. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  87. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.test.js +1 -1
  88. package/lib/commonjs/components/Message/hooks/useMessageActions.js +1 -1
  89. package/lib/commonjs/components/MessageInput/AttachButton.js +1 -1
  90. package/lib/commonjs/components/MessageInput/CommandsButton.js +1 -1
  91. package/lib/commonjs/components/MessageInput/CooldownTimer.js +1 -1
  92. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +109 -41
  93. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  94. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js +118 -25
  95. package/lib/commonjs/components/MessageInput/ImageUploadPreview.js.map +1 -1
  96. package/lib/commonjs/components/MessageInput/InputButtons.js +1 -1
  97. package/lib/commonjs/components/MessageInput/MessageInput.js +1 -1
  98. package/lib/commonjs/components/MessageInput/MoreOptionsButton.js +1 -1
  99. package/lib/commonjs/components/MessageInput/SendButton.js +1 -1
  100. package/lib/commonjs/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
  101. package/lib/commonjs/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
  102. package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js +53 -21
  103. package/lib/commonjs/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  104. package/lib/commonjs/components/MessageInput/components/InputEditingStateHeader.js +1 -1
  105. package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +1 -1
  106. package/lib/commonjs/components/MessageInput/components/InputReplyStateHeader.js +1 -1
  107. package/lib/commonjs/components/MessageList/DateHeader.js +1 -1
  108. package/lib/commonjs/components/MessageList/InlineDateSeparator.js +1 -1
  109. package/lib/commonjs/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
  110. package/lib/commonjs/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
  111. package/lib/commonjs/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
  112. package/lib/commonjs/components/MessageList/InlineUnreadIndicator.js +1 -1
  113. package/lib/commonjs/components/MessageList/MessageList.js +1 -1
  114. package/lib/commonjs/components/MessageList/MessageSystem.js +1 -1
  115. package/lib/commonjs/components/MessageList/NetworkDownIndicator.js +1 -1
  116. package/lib/commonjs/components/MessageList/ScrollToBottomButton.js +1 -1
  117. package/lib/commonjs/components/MessageList/TypingIndicator.js +1 -1
  118. package/lib/commonjs/components/MessageList/TypingIndicatorContainer.js +1 -1
  119. package/lib/commonjs/components/MessageOverlay/MessageActionList.js +1 -1
  120. package/lib/commonjs/components/MessageOverlay/MessageActionListItem.js +1 -1
  121. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +1 -1
  122. package/lib/commonjs/components/MessageOverlay/OverlayBackdrop.js +1 -1
  123. package/lib/commonjs/components/MessageOverlay/OverlayReactionList.js +1 -1
  124. package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +1 -1
  125. package/lib/commonjs/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
  126. package/lib/commonjs/components/Reply/Reply.js +1 -1
  127. package/lib/commonjs/components/Spinner/Spinner.js +1 -1
  128. package/lib/commonjs/components/Thread/Thread.js +1 -1
  129. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +1 -1
  130. package/lib/commonjs/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
  131. package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
  132. package/lib/commonjs/contexts/channelContext/ChannelContext.js +1 -1
  133. package/lib/commonjs/contexts/channelsContext/ChannelsContext.js +1 -1
  134. package/lib/commonjs/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
  135. package/lib/commonjs/contexts/chatContext/ChatContext.js +3 -3
  136. package/lib/commonjs/contexts/chatContext/ChatContext.js.map +1 -1
  137. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
  138. package/lib/commonjs/contexts/keyboardContext/KeyboardContext.js +1 -1
  139. package/lib/commonjs/contexts/messageContext/MessageContext.js +3 -3
  140. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  141. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +146 -120
  142. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  143. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  144. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
  145. package/lib/commonjs/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
  146. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +1 -1
  147. package/lib/commonjs/contexts/overlayContext/OverlayContext.js +1 -1
  148. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +1 -1
  149. package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
  150. package/lib/commonjs/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +1 -1
  151. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +1 -1
  152. package/lib/commonjs/contexts/themeContext/ThemeContext.js +1 -1
  153. package/lib/commonjs/contexts/threadContext/ThreadContext.js +1 -1
  154. package/lib/commonjs/contexts/translationContext/TranslationContext.js +1 -1
  155. package/lib/commonjs/contexts/typingContext/TypingContext.js +1 -1
  156. package/lib/commonjs/i18n/en.json +2 -0
  157. package/lib/commonjs/i18n/fr.json +2 -0
  158. package/lib/commonjs/i18n/hi.json +2 -0
  159. package/lib/commonjs/i18n/it.json +2 -0
  160. package/lib/commonjs/i18n/ja.json +3 -1
  161. package/lib/commonjs/i18n/ko.json +3 -1
  162. package/lib/commonjs/i18n/nl.json +2 -0
  163. package/lib/commonjs/i18n/ru.json +2 -0
  164. package/lib/commonjs/i18n/tr.json +2 -0
  165. package/lib/commonjs/icons/ArrowRight.js +1 -1
  166. package/lib/commonjs/icons/AtMentions.js +1 -1
  167. package/lib/commonjs/icons/Attach.js +1 -1
  168. package/lib/commonjs/icons/Audio.js +1 -1
  169. package/lib/commonjs/icons/CSV.js +1 -1
  170. package/lib/commonjs/icons/Camera.js +1 -1
  171. package/lib/commonjs/icons/Check.js +1 -1
  172. package/lib/commonjs/icons/CheckAll.js +1 -1
  173. package/lib/commonjs/icons/CheckSend.js +1 -1
  174. package/lib/commonjs/icons/CircleClose.js +1 -1
  175. package/lib/commonjs/icons/CirclePlus.js +1 -1
  176. package/lib/commonjs/icons/CircleRight.js +1 -1
  177. package/lib/commonjs/icons/Close.js +1 -1
  178. package/lib/commonjs/icons/Copy.js +1 -1
  179. package/lib/commonjs/icons/CurveLineLeftUp.js +1 -1
  180. package/lib/commonjs/icons/DOC.js +1 -1
  181. package/lib/commonjs/icons/DOCX.js +1 -1
  182. package/lib/commonjs/icons/Delete.js +1 -1
  183. package/lib/commonjs/icons/Down.js +1 -1
  184. package/lib/commonjs/icons/DownloadArrow.js +1 -1
  185. package/lib/commonjs/icons/DownloadCloud.js +1 -1
  186. package/lib/commonjs/icons/Edit.js +1 -1
  187. package/lib/commonjs/icons/Error.js +1 -1
  188. package/lib/commonjs/icons/Eye.js +1 -1
  189. package/lib/commonjs/icons/Flag.js +1 -1
  190. package/lib/commonjs/icons/Folder.js +1 -1
  191. package/lib/commonjs/icons/GenericFile.js +1 -1
  192. package/lib/commonjs/icons/GiphyIcon.js +1 -1
  193. package/lib/commonjs/icons/Grid.js +1 -1
  194. package/lib/commonjs/icons/Group.js +1 -1
  195. package/lib/commonjs/icons/HTML.js +1 -1
  196. package/lib/commonjs/icons/Imgur.js +1 -1
  197. package/lib/commonjs/icons/LOLReaction.js +1 -1
  198. package/lib/commonjs/icons/Lightning.js +1 -1
  199. package/lib/commonjs/icons/Link.js +1 -1
  200. package/lib/commonjs/icons/Loading.js +1 -1
  201. package/lib/commonjs/icons/Logo.js +1 -1
  202. package/lib/commonjs/icons/LoveReaction.js +1 -1
  203. package/lib/commonjs/icons/MD.js +1 -1
  204. package/lib/commonjs/icons/MailOpen.js +1 -1
  205. package/lib/commonjs/icons/MenuPointHorizontal.js +1 -1
  206. package/lib/commonjs/icons/MenuPointVertical.js +1 -1
  207. package/lib/commonjs/icons/MessageFlag.js +1 -1
  208. package/lib/commonjs/icons/MessageIcon.js +1 -1
  209. package/lib/commonjs/icons/Mute.js +1 -1
  210. package/lib/commonjs/icons/Notification.js +1 -1
  211. package/lib/commonjs/icons/ODT.js +1 -1
  212. package/lib/commonjs/icons/PDF.js +1 -1
  213. package/lib/commonjs/icons/PPT.js +1 -1
  214. package/lib/commonjs/icons/PPTX.js +1 -1
  215. package/lib/commonjs/icons/Picture.js +1 -1
  216. package/lib/commonjs/icons/Pin.js +1 -1
  217. package/lib/commonjs/icons/PinHeader.js +1 -1
  218. package/lib/commonjs/icons/RAR.js +1 -1
  219. package/lib/commonjs/icons/RTF.js +1 -1
  220. package/lib/commonjs/icons/Refresh.js +1 -1
  221. package/lib/commonjs/icons/SEVEN_Z.js +1 -1
  222. package/lib/commonjs/icons/Search.js +1 -1
  223. package/lib/commonjs/icons/SendRight.js +1 -1
  224. package/lib/commonjs/icons/SendUp.js +1 -1
  225. package/lib/commonjs/icons/Share.js +1 -1
  226. package/lib/commonjs/icons/ShareRightArrow.js +1 -1
  227. package/lib/commonjs/icons/Smile.js +1 -1
  228. package/lib/commonjs/icons/Sound.js +1 -1
  229. package/lib/commonjs/icons/TAR.js +1 -1
  230. package/lib/commonjs/icons/TXT.js +1 -1
  231. package/lib/commonjs/icons/ThreadReply.js +1 -1
  232. package/lib/commonjs/icons/ThumbsDownReaction.js +1 -1
  233. package/lib/commonjs/icons/ThumbsUpReaction.js +1 -1
  234. package/lib/commonjs/icons/Time.js +1 -1
  235. package/lib/commonjs/icons/Unknown.js +1 -1
  236. package/lib/commonjs/icons/Unpin.js +1 -1
  237. package/lib/commonjs/icons/User.js +1 -1
  238. package/lib/commonjs/icons/UserAdd.js +1 -1
  239. package/lib/commonjs/icons/UserAdmin.js +1 -1
  240. package/lib/commonjs/icons/UserDelete.js +1 -1
  241. package/lib/commonjs/icons/UserMinus.js +1 -1
  242. package/lib/commonjs/icons/Warning.js +38 -0
  243. package/lib/commonjs/icons/Warning.js.map +1 -0
  244. package/lib/commonjs/icons/WutReaction.js +1 -1
  245. package/lib/commonjs/icons/XLS.js +1 -1
  246. package/lib/commonjs/icons/XLSX.js +1 -1
  247. package/lib/commonjs/icons/ZIP.js +1 -1
  248. package/lib/commonjs/icons/index.js +13 -0
  249. package/lib/commonjs/icons/index.js.map +1 -1
  250. package/lib/commonjs/icons/utils/base.js +1 -1
  251. package/lib/commonjs/utils/utils.js +33 -2
  252. package/lib/commonjs/utils/utils.js.map +1 -1
  253. package/lib/commonjs/version.json +1 -1
  254. package/lib/module/components/Attachment/Attachment.js +1 -1
  255. package/lib/module/components/Attachment/AttachmentActions.js +1 -1
  256. package/lib/module/components/Attachment/Card.js +26 -29
  257. package/lib/module/components/Attachment/Card.js.map +1 -1
  258. package/lib/module/components/Attachment/FileAttachment.js +20 -25
  259. package/lib/module/components/Attachment/FileAttachment.js.map +1 -1
  260. package/lib/module/components/Attachment/FileAttachmentGroup.js +1 -1
  261. package/lib/module/components/Attachment/FileIcon.js +1 -1
  262. package/lib/module/components/Attachment/Gallery.js +1 -1
  263. package/lib/module/components/Attachment/Giphy.js +1 -1
  264. package/lib/module/components/Attachment/hooks/useGoToURL.js +42 -0
  265. package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -0
  266. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +25 -18
  267. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  268. package/lib/module/components/AttachmentPicker/components/AttachmentPickerBottomSheetHandle.js +1 -1
  269. package/lib/module/components/AttachmentPicker/components/AttachmentPickerError.js +1 -1
  270. package/lib/module/components/AttachmentPicker/components/AttachmentPickerErrorImage.js +1 -1
  271. package/lib/module/components/AttachmentPicker/components/AttachmentSelectionBar.js +1 -1
  272. package/lib/module/components/AttachmentPicker/components/CameraSelectorIcon.js +1 -1
  273. package/lib/module/components/AttachmentPicker/components/FileSelectorIcon.js +1 -1
  274. package/lib/module/components/AttachmentPicker/components/ImageOverlaySelectedComponent.js +1 -1
  275. package/lib/module/components/AttachmentPicker/components/ImageSelectorIcon.js +1 -1
  276. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
  277. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +1 -1
  278. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +1 -1
  279. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionItem.js +1 -1
  280. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionList.js +1 -1
  281. package/lib/module/components/Avatar/Avatar.js +1 -1
  282. package/lib/module/components/Avatar/GroupAvatar.js +1 -1
  283. package/lib/module/components/Channel/Channel.js +1 -1
  284. package/lib/module/components/Channel/Channel.js.map +1 -1
  285. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js +4 -12
  286. package/lib/module/components/Channel/hooks/useCreatePaginatedMessageListContext.js.map +1 -1
  287. package/lib/module/components/Channel/hooks/useCreateThreadContext.js +4 -12
  288. package/lib/module/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  289. package/lib/module/components/ChannelList/ChannelList.js +1 -1
  290. package/lib/module/components/ChannelList/ChannelListFooterLoadingIndicator.js +1 -1
  291. package/lib/module/components/ChannelList/ChannelListHeaderErrorIndicator.js +1 -1
  292. package/lib/module/components/ChannelList/ChannelListHeaderNetworkDownIndicator.js +1 -1
  293. package/lib/module/components/ChannelList/ChannelListLoadingIndicator.js +1 -1
  294. package/lib/module/components/ChannelList/ChannelListMessenger.js +1 -1
  295. package/lib/module/components/ChannelList/Skeleton.js +1 -1
  296. package/lib/module/components/ChannelPreview/ChannelAvatar.js +1 -1
  297. package/lib/module/components/ChannelPreview/ChannelPreview.js +1 -1
  298. package/lib/module/components/ChannelPreview/ChannelPreviewMessage.js +1 -1
  299. package/lib/module/components/ChannelPreview/ChannelPreviewMessenger.js +1 -1
  300. package/lib/module/components/ChannelPreview/ChannelPreviewMutedStatus.js +1 -1
  301. package/lib/module/components/ChannelPreview/ChannelPreviewStatus.js +1 -1
  302. package/lib/module/components/ChannelPreview/ChannelPreviewTitle.js +1 -1
  303. package/lib/module/components/ChannelPreview/ChannelPreviewUnreadCount.js +1 -1
  304. package/lib/module/components/Chat/Chat.js +9 -5
  305. package/lib/module/components/Chat/Chat.js.map +1 -1
  306. package/lib/module/components/Chat/hooks/useAppSettings.js +80 -0
  307. package/lib/module/components/Chat/hooks/useAppSettings.js.map +1 -0
  308. package/lib/module/components/Chat/hooks/useCreateChatContext.js +3 -1
  309. package/lib/module/components/Chat/hooks/useCreateChatContext.js.map +1 -1
  310. package/lib/module/components/ImageGallery/ImageGallery.js +1 -1
  311. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +1 -1
  312. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +1 -1
  313. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -1
  314. package/lib/module/components/ImageGallery/components/ImageGalleryOverlay.js +1 -1
  315. package/lib/module/components/ImageGallery/components/ImageGrid.js +1 -1
  316. package/lib/module/components/ImageGallery/components/ImageGridHandle.js +1 -1
  317. package/lib/module/components/Indicators/EmptyStateIndicator.js +1 -1
  318. package/lib/module/components/Indicators/LoadingDot.js +1 -1
  319. package/lib/module/components/Indicators/LoadingDots.js +1 -1
  320. package/lib/module/components/Indicators/LoadingErrorIndicator.js +1 -1
  321. package/lib/module/components/Indicators/LoadingIndicator.js +1 -1
  322. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
  323. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleViewFC.js +1 -1
  324. package/lib/module/components/Message/Message.js +28 -23
  325. package/lib/module/components/Message/Message.js.map +1 -1
  326. package/lib/module/components/Message/MessageSimple/MessageAvatar.js +1 -1
  327. package/lib/module/components/Message/MessageSimple/MessageContent.js +1 -1
  328. package/lib/module/components/Message/MessageSimple/MessageDeleted.js +1 -1
  329. package/lib/module/components/Message/MessageSimple/MessageFooter.js +1 -1
  330. package/lib/module/components/Message/MessageSimple/MessagePinnedHeader.js +1 -1
  331. package/lib/module/components/Message/MessageSimple/MessageReplies.js +1 -1
  332. package/lib/module/components/Message/MessageSimple/MessageRepliesAvatars.js +1 -1
  333. package/lib/module/components/Message/MessageSimple/MessageSimple.js +1 -1
  334. package/lib/module/components/Message/MessageSimple/MessageStatus.js +1 -1
  335. package/lib/module/components/Message/MessageSimple/MessageTextContainer.js +1 -1
  336. package/lib/module/components/Message/MessageSimple/ReactionList.js +1 -1
  337. package/lib/module/components/Message/MessageSimple/utils/renderText.js +29 -15
  338. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  339. package/lib/module/components/Message/MessageSimple/utils/renderText.test.js +1 -1
  340. package/lib/module/components/Message/hooks/useMessageActions.js +1 -1
  341. package/lib/module/components/MessageInput/AttachButton.js +1 -1
  342. package/lib/module/components/MessageInput/CommandsButton.js +1 -1
  343. package/lib/module/components/MessageInput/CooldownTimer.js +1 -1
  344. package/lib/module/components/MessageInput/FileUploadPreview.js +109 -41
  345. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  346. package/lib/module/components/MessageInput/ImageUploadPreview.js +118 -25
  347. package/lib/module/components/MessageInput/ImageUploadPreview.js.map +1 -1
  348. package/lib/module/components/MessageInput/InputButtons.js +1 -1
  349. package/lib/module/components/MessageInput/MessageInput.js +1 -1
  350. package/lib/module/components/MessageInput/MoreOptionsButton.js +1 -1
  351. package/lib/module/components/MessageInput/SendButton.js +1 -1
  352. package/lib/module/components/MessageInput/SendMessageDisallowedIndicator.js +1 -1
  353. package/lib/module/components/MessageInput/ShowThreadMessageInChannelButton.js +1 -1
  354. package/lib/module/components/MessageInput/UploadProgressIndicator.js +53 -21
  355. package/lib/module/components/MessageInput/UploadProgressIndicator.js.map +1 -1
  356. package/lib/module/components/MessageInput/components/InputEditingStateHeader.js +1 -1
  357. package/lib/module/components/MessageInput/components/InputGiphySearch.js +1 -1
  358. package/lib/module/components/MessageInput/components/InputReplyStateHeader.js +1 -1
  359. package/lib/module/components/MessageList/DateHeader.js +1 -1
  360. package/lib/module/components/MessageList/InlineDateSeparator.js +1 -1
  361. package/lib/module/components/MessageList/InlineLoadingMoreIndicator.js +1 -1
  362. package/lib/module/components/MessageList/InlineLoadingMoreRecentIndicator.js +1 -1
  363. package/lib/module/components/MessageList/InlineLoadingMoreThreadIndicator.js +1 -1
  364. package/lib/module/components/MessageList/InlineUnreadIndicator.js +1 -1
  365. package/lib/module/components/MessageList/MessageList.js +1 -1
  366. package/lib/module/components/MessageList/MessageSystem.js +1 -1
  367. package/lib/module/components/MessageList/NetworkDownIndicator.js +1 -1
  368. package/lib/module/components/MessageList/ScrollToBottomButton.js +1 -1
  369. package/lib/module/components/MessageList/TypingIndicator.js +1 -1
  370. package/lib/module/components/MessageList/TypingIndicatorContainer.js +1 -1
  371. package/lib/module/components/MessageOverlay/MessageActionList.js +1 -1
  372. package/lib/module/components/MessageOverlay/MessageActionListItem.js +1 -1
  373. package/lib/module/components/MessageOverlay/MessageOverlay.js +1 -1
  374. package/lib/module/components/MessageOverlay/OverlayBackdrop.js +1 -1
  375. package/lib/module/components/MessageOverlay/OverlayReactionList.js +1 -1
  376. package/lib/module/components/MessageOverlay/OverlayReactions.js +1 -1
  377. package/lib/module/components/MessageOverlay/OverlayReactionsAvatar.js +1 -1
  378. package/lib/module/components/Reply/Reply.js +1 -1
  379. package/lib/module/components/Spinner/Spinner.js +1 -1
  380. package/lib/module/components/Thread/Thread.js +1 -1
  381. package/lib/module/components/Thread/components/ThreadFooterComponent.js +1 -1
  382. package/lib/module/contexts/activeChannelsRefContext/ActiveChannelsRefContext.js +1 -1
  383. package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js +1 -1
  384. package/lib/module/contexts/channelContext/ChannelContext.js +1 -1
  385. package/lib/module/contexts/channelsContext/ChannelsContext.js +1 -1
  386. package/lib/module/contexts/channelsStateContext/ChannelsStateContext.js +1 -1
  387. package/lib/module/contexts/chatContext/ChatContext.js +3 -3
  388. package/lib/module/contexts/chatContext/ChatContext.js.map +1 -1
  389. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js +1 -1
  390. package/lib/module/contexts/keyboardContext/KeyboardContext.js +1 -1
  391. package/lib/module/contexts/messageContext/MessageContext.js +3 -3
  392. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  393. package/lib/module/contexts/messageInputContext/MessageInputContext.js +146 -120
  394. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  395. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  396. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +1 -1
  397. package/lib/module/contexts/messageOverlayContext/hooks/useResettableState.test.js +1 -1
  398. package/lib/module/contexts/messagesContext/MessagesContext.js +1 -1
  399. package/lib/module/contexts/overlayContext/OverlayContext.js +1 -1
  400. package/lib/module/contexts/overlayContext/OverlayProvider.js +1 -1
  401. package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +1 -1
  402. package/lib/module/contexts/paginatedMessageListContext/PaginatedMessageListContext.js +1 -1
  403. package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +1 -1
  404. package/lib/module/contexts/themeContext/ThemeContext.js +1 -1
  405. package/lib/module/contexts/threadContext/ThreadContext.js +1 -1
  406. package/lib/module/contexts/translationContext/TranslationContext.js +1 -1
  407. package/lib/module/contexts/typingContext/TypingContext.js +1 -1
  408. package/lib/module/i18n/en.json +2 -0
  409. package/lib/module/i18n/fr.json +2 -0
  410. package/lib/module/i18n/hi.json +2 -0
  411. package/lib/module/i18n/it.json +2 -0
  412. package/lib/module/i18n/ja.json +3 -1
  413. package/lib/module/i18n/ko.json +3 -1
  414. package/lib/module/i18n/nl.json +2 -0
  415. package/lib/module/i18n/ru.json +2 -0
  416. package/lib/module/i18n/tr.json +2 -0
  417. package/lib/module/icons/ArrowRight.js +1 -1
  418. package/lib/module/icons/AtMentions.js +1 -1
  419. package/lib/module/icons/Attach.js +1 -1
  420. package/lib/module/icons/Audio.js +1 -1
  421. package/lib/module/icons/CSV.js +1 -1
  422. package/lib/module/icons/Camera.js +1 -1
  423. package/lib/module/icons/Check.js +1 -1
  424. package/lib/module/icons/CheckAll.js +1 -1
  425. package/lib/module/icons/CheckSend.js +1 -1
  426. package/lib/module/icons/CircleClose.js +1 -1
  427. package/lib/module/icons/CirclePlus.js +1 -1
  428. package/lib/module/icons/CircleRight.js +1 -1
  429. package/lib/module/icons/Close.js +1 -1
  430. package/lib/module/icons/Copy.js +1 -1
  431. package/lib/module/icons/CurveLineLeftUp.js +1 -1
  432. package/lib/module/icons/DOC.js +1 -1
  433. package/lib/module/icons/DOCX.js +1 -1
  434. package/lib/module/icons/Delete.js +1 -1
  435. package/lib/module/icons/Down.js +1 -1
  436. package/lib/module/icons/DownloadArrow.js +1 -1
  437. package/lib/module/icons/DownloadCloud.js +1 -1
  438. package/lib/module/icons/Edit.js +1 -1
  439. package/lib/module/icons/Error.js +1 -1
  440. package/lib/module/icons/Eye.js +1 -1
  441. package/lib/module/icons/Flag.js +1 -1
  442. package/lib/module/icons/Folder.js +1 -1
  443. package/lib/module/icons/GenericFile.js +1 -1
  444. package/lib/module/icons/GiphyIcon.js +1 -1
  445. package/lib/module/icons/Grid.js +1 -1
  446. package/lib/module/icons/Group.js +1 -1
  447. package/lib/module/icons/HTML.js +1 -1
  448. package/lib/module/icons/Imgur.js +1 -1
  449. package/lib/module/icons/LOLReaction.js +1 -1
  450. package/lib/module/icons/Lightning.js +1 -1
  451. package/lib/module/icons/Link.js +1 -1
  452. package/lib/module/icons/Loading.js +1 -1
  453. package/lib/module/icons/Logo.js +1 -1
  454. package/lib/module/icons/LoveReaction.js +1 -1
  455. package/lib/module/icons/MD.js +1 -1
  456. package/lib/module/icons/MailOpen.js +1 -1
  457. package/lib/module/icons/MenuPointHorizontal.js +1 -1
  458. package/lib/module/icons/MenuPointVertical.js +1 -1
  459. package/lib/module/icons/MessageFlag.js +1 -1
  460. package/lib/module/icons/MessageIcon.js +1 -1
  461. package/lib/module/icons/Mute.js +1 -1
  462. package/lib/module/icons/Notification.js +1 -1
  463. package/lib/module/icons/ODT.js +1 -1
  464. package/lib/module/icons/PDF.js +1 -1
  465. package/lib/module/icons/PPT.js +1 -1
  466. package/lib/module/icons/PPTX.js +1 -1
  467. package/lib/module/icons/Picture.js +1 -1
  468. package/lib/module/icons/Pin.js +1 -1
  469. package/lib/module/icons/PinHeader.js +1 -1
  470. package/lib/module/icons/RAR.js +1 -1
  471. package/lib/module/icons/RTF.js +1 -1
  472. package/lib/module/icons/Refresh.js +1 -1
  473. package/lib/module/icons/SEVEN_Z.js +1 -1
  474. package/lib/module/icons/Search.js +1 -1
  475. package/lib/module/icons/SendRight.js +1 -1
  476. package/lib/module/icons/SendUp.js +1 -1
  477. package/lib/module/icons/Share.js +1 -1
  478. package/lib/module/icons/ShareRightArrow.js +1 -1
  479. package/lib/module/icons/Smile.js +1 -1
  480. package/lib/module/icons/Sound.js +1 -1
  481. package/lib/module/icons/TAR.js +1 -1
  482. package/lib/module/icons/TXT.js +1 -1
  483. package/lib/module/icons/ThreadReply.js +1 -1
  484. package/lib/module/icons/ThumbsDownReaction.js +1 -1
  485. package/lib/module/icons/ThumbsUpReaction.js +1 -1
  486. package/lib/module/icons/Time.js +1 -1
  487. package/lib/module/icons/Unknown.js +1 -1
  488. package/lib/module/icons/Unpin.js +1 -1
  489. package/lib/module/icons/User.js +1 -1
  490. package/lib/module/icons/UserAdd.js +1 -1
  491. package/lib/module/icons/UserAdmin.js +1 -1
  492. package/lib/module/icons/UserDelete.js +1 -1
  493. package/lib/module/icons/UserMinus.js +1 -1
  494. package/lib/module/icons/Warning.js +38 -0
  495. package/lib/module/icons/Warning.js.map +1 -0
  496. package/lib/module/icons/WutReaction.js +1 -1
  497. package/lib/module/icons/XLS.js +1 -1
  498. package/lib/module/icons/XLSX.js +1 -1
  499. package/lib/module/icons/ZIP.js +1 -1
  500. package/lib/module/icons/index.js +13 -0
  501. package/lib/module/icons/index.js.map +1 -1
  502. package/lib/module/icons/utils/base.js +1 -1
  503. package/lib/module/utils/utils.js +33 -2
  504. package/lib/module/utils/utils.js.map +1 -1
  505. package/lib/module/version.json +1 -1
  506. package/lib/typescript/components/Attachment/FileAttachment.d.ts +0 -1
  507. package/lib/typescript/components/Attachment/hooks/useGoToURL.d.ts +2 -0
  508. package/lib/typescript/components/Chat/hooks/__tests__/useAppSettings.test.d.ts +1 -0
  509. package/lib/typescript/components/Chat/hooks/useAppSettings.d.ts +3 -0
  510. package/lib/typescript/components/Chat/hooks/useCreateChatContext.d.ts +1 -1
  511. package/lib/typescript/components/Message/Message.d.ts +12 -2
  512. package/lib/typescript/components/MessageInput/UploadProgressIndicator.d.ts +1 -3
  513. package/lib/typescript/contexts/chatContext/ChatContext.d.ts +5 -1
  514. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -4
  515. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +3 -3
  516. package/lib/typescript/i18n/en.json +2 -0
  517. package/lib/typescript/i18n/fr.json +2 -0
  518. package/lib/typescript/i18n/hi.json +2 -0
  519. package/lib/typescript/i18n/it.json +2 -0
  520. package/lib/typescript/i18n/ja.json +3 -1
  521. package/lib/typescript/i18n/ko.json +3 -1
  522. package/lib/typescript/i18n/nl.json +2 -0
  523. package/lib/typescript/i18n/ru.json +2 -0
  524. package/lib/typescript/i18n/tr.json +2 -0
  525. package/lib/typescript/icons/Warning.d.ts +3 -0
  526. package/lib/typescript/icons/index.d.ts +1 -0
  527. package/lib/typescript/utils/Streami18n.d.ts +6 -0
  528. package/lib/typescript/utils/utils.d.ts +15 -2
  529. package/package.json +1 -1
  530. package/src/components/Attachment/Card.tsx +5 -13
  531. package/src/components/Attachment/FileAttachment.tsx +5 -13
  532. package/src/components/Attachment/__tests__/Attachment.test.js +39 -0
  533. package/src/components/Attachment/hooks/useGoToURL.ts +27 -0
  534. package/src/components/AttachmentPicker/AttachmentPicker.tsx +32 -32
  535. package/src/components/Channel/Channel.tsx +1 -1
  536. package/src/components/Channel/hooks/useCreatePaginatedMessageListContext.ts +3 -9
  537. package/src/components/Channel/hooks/useCreateThreadContext.ts +3 -9
  538. package/src/components/ChannelList/hooks/listeners/__tests__/useChannelUpdated.test.tsx +1 -0
  539. package/src/components/Chat/Chat.tsx +4 -0
  540. package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +34 -0
  541. package/src/components/Chat/hooks/useAppSettings.ts +39 -0
  542. package/src/components/Chat/hooks/useCreateChatContext.ts +2 -0
  543. package/src/components/Message/Message.tsx +56 -48
  544. package/src/components/Message/MessageSimple/utils/renderText.tsx +17 -2
  545. package/src/components/MessageInput/FileUploadPreview.tsx +60 -14
  546. package/src/components/MessageInput/ImageUploadPreview.tsx +95 -42
  547. package/src/components/MessageInput/UploadProgressIndicator.tsx +49 -22
  548. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +50 -80
  549. package/src/components/MessageInput/__tests__/ImageUploadPreview.test.js +49 -74
  550. package/src/components/MessageInput/__tests__/UploadProgressIndicator.test.js +36 -13
  551. package/src/components/MessageInput/__tests__/__snapshots__/UploadProgressIndicator.test.js.snap +122 -17
  552. package/src/contexts/chatContext/ChatContext.tsx +5 -1
  553. package/src/contexts/messageContext/MessageContext.tsx +7 -4
  554. package/src/contexts/messageInputContext/MessageInputContext.tsx +127 -96
  555. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +2 -2
  556. package/src/i18n/en.json +2 -0
  557. package/src/i18n/fr.json +2 -0
  558. package/src/i18n/hi.json +2 -0
  559. package/src/i18n/it.json +2 -0
  560. package/src/i18n/ja.json +3 -1
  561. package/src/i18n/ko.json +3 -1
  562. package/src/i18n/nl.json +2 -0
  563. package/src/i18n/ru.json +2 -0
  564. package/src/i18n/tr.json +2 -0
  565. package/src/icons/Warning.tsx +12 -0
  566. package/src/icons/index.ts +1 -0
  567. package/src/utils/utils.ts +53 -1
  568. package/src/version.json +1 -1
  569. package/CHANGELOG.md +0 -1519
  570. package/src/components/MessageInput/__tests__/__snapshots__/FileUploadPreview.test.js.snap +0 -4413
  571. package/src/components/MessageInput/__tests__/__snapshots__/ImageUploadPreview.test.js.snap +0 -2373
@@ -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}}';
@@ -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
+ };
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useMemo, useState } from 'react';
1
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
2
2
  import {
3
3
  BackHandler,
4
4
  Dimensions,
@@ -200,13 +200,7 @@ export const AttachmentPicker = React.forwardRef(
200
200
  const [hasNextPage, setHasNextPage] = useState(true);
201
201
  const [loadingPhotos, setLoadingPhotos] = useState(false);
202
202
  const [photos, setPhotos] = useState<Asset[]>([]);
203
-
204
- const hideAttachmentPicker = () => {
205
- setSelectedPicker(undefined);
206
- if ((ref as React.MutableRefObject<BottomSheet>)?.current) {
207
- (ref as React.MutableRefObject<BottomSheet>).current.close();
208
- }
209
- };
203
+ const bottomSheetCloseOnKeyboardShowTimeout = useRef<NodeJS.Timeout>();
210
204
 
211
205
  const getMorePhotos = async () => {
212
206
  if (hasNextPage && !loadingPhotos && currentIndex > -1 && selectedPicker === 'images') {
@@ -248,6 +242,20 @@ export const AttachmentPicker = React.forwardRef(
248
242
  }, [selectedPicker]);
249
243
 
250
244
  useEffect(() => {
245
+ const hideAttachmentPicker = () => {
246
+ if (bottomSheetCloseOnKeyboardShowTimeout.current) {
247
+ clearTimeout(bottomSheetCloseOnKeyboardShowTimeout.current);
248
+ }
249
+ setSelectedPicker(undefined);
250
+ // This short timeout is to prevent a race condition
251
+ // where the close function is called during the point when a internal container layout happens within the bottomsheet due to keyboard affecting the layout
252
+ // If the container layout measures a shorter height than previous but if the close snapped to the previous height's position, the bottom sheet will show up
253
+ // this short delay ensures that close function is always called after a container layout due to keyboard change
254
+ bottomSheetCloseOnKeyboardShowTimeout.current = setTimeout(
255
+ () => (ref as React.MutableRefObject<BottomSheet | undefined>).current?.close(),
256
+ 150,
257
+ );
258
+ };
251
259
  const keyboardSubscription =
252
260
  Platform.OS === 'ios'
253
261
  ? Keyboard.addListener('keyboardWillShow', hideAttachmentPicker)
@@ -265,6 +273,9 @@ export const AttachmentPicker = React.forwardRef(
265
273
  } else {
266
274
  Keyboard.removeListener('keyboardDidShow', hideAttachmentPicker);
267
275
  }
276
+ if (bottomSheetCloseOnKeyboardShowTimeout.current) {
277
+ clearTimeout(bottomSheetCloseOnKeyboardShowTimeout.current);
278
+ }
268
279
  };
269
280
  }, []);
270
281
 
@@ -326,35 +337,24 @@ export const AttachmentPicker = React.forwardRef(
326
337
  : statusBarHeight
327
338
  : 0;
328
339
 
329
- const initialSnapPoint = useMemo(
330
- () =>
331
- attachmentPickerBottomSheetHeight ?? Platform.OS === 'android'
332
- ? 308 +
333
- (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) -
334
- handleHeight
335
- : 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment),
336
- [
337
- attachmentPickerBottomSheetHeight,
338
- androidBottomBarHeightAdjustment,
339
- fullScreenHeight,
340
- handleHeight,
341
- screenHeight,
342
- ],
343
- );
340
+ const initialSnapPoint =
341
+ attachmentPickerBottomSheetHeight ?? Platform.OS === 'android'
342
+ ? 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment) - handleHeight
343
+ : 308 + (fullScreenHeight - screenHeight + androidBottomBarHeightAdjustment);
344
344
 
345
- const finalSnapPoint = useMemo(
346
- () =>
347
- Platform.OS === 'android'
348
- ? fullScreenHeight - topInset - handleHeight
349
- : fullScreenHeight - topInset,
350
- [fullScreenHeight, handleHeight, topInset],
351
- );
345
+ const finalSnapPoint =
346
+ Platform.OS === 'android'
347
+ ? fullScreenHeight - topInset - handleHeight
348
+ : fullScreenHeight - topInset;
352
349
 
353
350
  /**
354
351
  * Snap points changing cause a rerender of the position,
355
352
  * this is an issue if you are calling close on the bottom sheet.
356
353
  */
357
- const snapPoints = [initialSnapPoint, finalSnapPoint];
354
+ const snapPoints = useMemo(
355
+ () => [initialSnapPoint, finalSnapPoint],
356
+ [initialSnapPoint, finalSnapPoint],
357
+ );
358
358
 
359
359
  return (
360
360
  <>
@@ -370,7 +370,7 @@ export const AttachmentPicker = React.forwardRef(
370
370
  }
371
371
  handleHeight={handleHeight}
372
372
  index={-1}
373
- onChange={(index: number) => setCurrentIndex(index)}
373
+ onChange={setCurrentIndex}
374
374
  ref={ref}
375
375
  snapPoints={snapPoints}
376
376
  >
@@ -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,
@@ -5,6 +5,7 @@ import Dayjs from 'dayjs';
5
5
 
6
6
  import type { Channel } from 'stream-chat';
7
7
 
8
+ import { useAppSettings } from './hooks/useAppSettings';
8
9
  import { useCreateChatContext } from './hooks/useCreateChatContext';
9
10
  import { useIsOnline } from './hooks/useIsOnline';
10
11
  import { useMutedUsers } from './hooks/useMutedUsers';
@@ -161,7 +162,10 @@ const ChatWithContext = <
161
162
 
162
163
  const setActiveChannel = (newChannel?: Channel<StreamChatGenerics>) => setChannel(newChannel);
163
164
 
165
+ const appSettings = useAppSettings(client, isOnline);
166
+
164
167
  const chatContext = useCreateChatContext({
168
+ appSettings,
165
169
  channel,
166
170
  client,
167
171
  connectionRecovering,
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Text } from 'react-native';
3
+
4
+ import { render, waitFor } from '@testing-library/react-native';
5
+
6
+ import type { StreamChat } from 'stream-chat';
7
+
8
+ import { useAppSettings } from '../useAppSettings';
9
+
10
+ describe('useAppSettings', () => {
11
+ it('will return a settings object if the backend call is successful', async () => {
12
+ const TestComponent = () => {
13
+ const isOnline = true;
14
+ const appSettings = useAppSettings(
15
+ {
16
+ getAppSettings: jest.fn().mockReturnValue(
17
+ Promise.resolve({
18
+ auto_translation_enabled: true,
19
+ }),
20
+ ),
21
+ } as unknown as StreamChat,
22
+ isOnline,
23
+ );
24
+
25
+ return <Text>{JSON.stringify(appSettings)}</Text>;
26
+ };
27
+
28
+ const { getByText } = render(<TestComponent />);
29
+
30
+ await waitFor(() => {
31
+ expect(getByText(JSON.stringify({ auto_translation_enabled: true }))).toBeTruthy();
32
+ });
33
+ });
34
+ });
@@ -0,0 +1,39 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+
3
+ import type { AppSettingsAPIResponse, StreamChat } from 'stream-chat';
4
+ import type { DefaultStreamChatGenerics } from 'stream-chat-react-native';
5
+
6
+ export const useAppSettings = <
7
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8
+ >(
9
+ client: StreamChat<StreamChatGenerics>,
10
+ isOnline: boolean,
11
+ ): AppSettingsAPIResponse | null => {
12
+ const [appSettings, setAppSettings] = useState<AppSettingsAPIResponse | null>(null);
13
+ const isMounted = useRef(true);
14
+
15
+ useEffect(() => {
16
+ async function getAppSettings() {
17
+ try {
18
+ const appSettings = await client.getAppSettings();
19
+ if (isMounted.current) {
20
+ setAppSettings(appSettings);
21
+ }
22
+ } catch (error: unknown) {
23
+ if (error instanceof Error) {
24
+ console.error(`An error occurred while getting app settings: ${error}`);
25
+ }
26
+ }
27
+ }
28
+
29
+ if (isOnline) {
30
+ getAppSettings();
31
+ }
32
+
33
+ return () => {
34
+ isMounted.current = false;
35
+ };
36
+ }, [client, isOnline]);
37
+
38
+ return appSettings;
39
+ };
@@ -6,6 +6,7 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
6
6
  export const useCreateChatContext = <
7
7
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
8
8
  >({
9
+ appSettings,
9
10
  channel,
10
11
  client,
11
12
  connectionRecovering,
@@ -21,6 +22,7 @@ export const useCreateChatContext = <
21
22
 
22
23
  const chatContext: ChatContextValue<StreamChatGenerics> = useMemo(
23
24
  () => ({
25
+ appSettings,
24
26
  channel,
25
27
  client,
26
28
  connectionRecovering,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { GestureResponderEvent, Keyboard, StyleProp, View, ViewStyle } from 'react-native';
3
3
 
4
- import type { Attachment } from 'stream-chat';
4
+ import type { Attachment, UserResponse } from 'stream-chat';
5
5
 
6
6
  import { useCreateMessageContext } from './hooks/useCreateMessageContext';
7
7
  import { useMessageActionHandlers } from './hooks/useMessageActionHandlers';
@@ -52,21 +52,34 @@ import {
52
52
  } from '../MessageList/hooks/useMessageList';
53
53
  import type { MessageActionListItemProps } from '../MessageOverlay/MessageActionListItem';
54
54
 
55
+ export type TouchableEmitter =
56
+ | 'card'
57
+ | 'fileAttachment'
58
+ | 'gallery'
59
+ | 'giphy'
60
+ | 'message'
61
+ | 'messageContent'
62
+ | 'messageReplies'
63
+ | 'reactionList'
64
+ | 'textLink';
65
+
66
+ export type TextMentionTouchableHandlerPayload<
67
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
68
+ > = {
69
+ emitter: 'textMention';
70
+ additionalInfo?: { user?: UserResponse<StreamChatGenerics> };
71
+ };
72
+
55
73
  export type TouchableHandlerPayload = {
56
74
  defaultHandler?: () => void;
57
- emitter?:
58
- | 'card'
59
- | 'fileAttachment'
60
- | 'gallery'
61
- | 'giphy'
62
- | 'message'
63
- | 'messageContent'
64
- | 'messageReplies'
65
- | 'reactionList'
66
- | 'textLink'
67
- | 'textMention';
68
75
  event?: GestureResponderEvent;
69
- };
76
+ } & (
77
+ | {
78
+ additionalInfo?: Record<string, unknown>;
79
+ emitter?: TouchableEmitter;
80
+ }
81
+ | TextMentionTouchableHandlerPayload
82
+ );
70
83
 
71
84
  export type MessageTouchableHandlerPayload<
72
85
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -595,45 +608,40 @@ const MessageWithContext = <
595
608
  onlyEmojis,
596
609
  onOpenThread,
597
610
  onPress: (payload) => {
598
- onPressProp
599
- ? onPressProp({
600
- actionHandlers,
601
- defaultHandler: payload.defaultHandler || onPress,
602
- emitter: payload.emitter || 'message',
603
- event: payload.event,
604
- message,
605
- })
606
- : onPressMessageProp
607
- ? onPressMessageProp({
608
- actionHandlers,
609
- defaultHandler: payload.defaultHandler || onPress,
610
- emitter: payload.emitter || 'message',
611
- event: payload.event,
612
- message,
613
- })
614
- : payload.defaultHandler
615
- ? payload.defaultHandler()
616
- : onPress();
611
+ const onPressArgs = {
612
+ actionHandlers,
613
+ additionalInfo: payload.additionalInfo,
614
+ defaultHandler: payload.defaultHandler || onPress,
615
+ emitter: payload.emitter || 'message',
616
+ event: payload.event,
617
+ message,
618
+ };
619
+
620
+ const handleOnPress = () => {
621
+ if (onPressProp) return onPressProp(onPressArgs);
622
+ if (onPressMessageProp) return onPressMessageProp(onPressArgs);
623
+ if (payload.defaultHandler) return payload.defaultHandler();
624
+
625
+ return onPress();
626
+ };
627
+
628
+ handleOnPress();
617
629
  },
618
630
  onPressIn:
619
631
  onPressInProp || onPressInMessageProp
620
632
  ? (payload) => {
621
- onPressInProp
622
- ? onPressInProp({
623
- actionHandlers,
624
- defaultHandler: payload.defaultHandler,
625
- emitter: payload.emitter || 'message',
626
- event: payload.event,
627
- message,
628
- })
629
- : onPressInMessageProp &&
630
- onPressInMessageProp({
631
- actionHandlers,
632
- defaultHandler: payload.defaultHandler,
633
- emitter: payload.emitter || 'message',
634
- event: payload.event,
635
- message,
636
- });
633
+ const onPressInArgs = {
634
+ actionHandlers,
635
+ defaultHandler: payload.defaultHandler,
636
+ emitter: payload.emitter || 'message',
637
+ event: payload.event,
638
+ message,
639
+ };
640
+ const handleOnpressIn = () => {
641
+ if (onPressInProp) return onPressInProp(onPressInArgs);
642
+ if (onPressInMessageProp) return onPressInMessageProp(onPressInArgs);
643
+ };
644
+ handleOnpressIn();
637
645
  }
638
646
  : null,
639
647
  otherAttachments: attachments.other,
@@ -17,6 +17,8 @@ import {
17
17
  State,
18
18
  } from 'simple-markdown';
19
19
 
20
+ import type { UserResponse } from 'stream-chat';
21
+
20
22
  import { parseLinksFromText } from './parseLinks';
21
23
 
22
24
  import type { MessageContextValue } from '../../../../contexts/messageContext/MessageContext';
@@ -147,10 +149,16 @@ export const renderText = <
147
149
  },
148
150
  };
149
151
 
150
- const onLink = (url: string) =>
151
- onLinkParams
152
+ const onLink = (url: string) => {
153
+ const pattern = new RegExp(/^\S+:\/\//);
154
+ if (!pattern.test(url)) {
155
+ url = 'http://' + url;
156
+ }
157
+
158
+ return onLinkParams
152
159
  ? onLinkParams(url)
153
160
  : Linking.canOpenURL(url).then((canOpenUrl) => canOpenUrl && Linking.openURL(url));
161
+ };
154
162
 
155
163
  const link: ReactNodeOutput = (node, output, { ...state }) => {
156
164
  const onPress = (event: GestureResponderEvent) => {
@@ -205,9 +213,16 @@ export const renderText = <
205
213
  const match: MatchFunction = (source) => regEx.exec(source);
206
214
 
207
215
  const mentionsReact: ReactNodeOutput = (node, output, { ...state }) => {
216
+ /**removes the @ prefix of username */
217
+ const userName = node.content[0]?.content?.substring(1);
208
218
  const onPress = (event: GestureResponderEvent) => {
209
219
  if (!preventPress && onPressParam) {
210
220
  onPressParam({
221
+ additionalInfo: {
222
+ user: mentioned_users?.find(
223
+ (user: UserResponse<StreamChatGenerics>) => userName === user.name,
224
+ ),
225
+ },
211
226
  emitter: 'textMention',
212
227
  event,
213
228
  });