stream-chat-react-native-core 7.0.0-rc.8 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (498) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js +19 -9
  3. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -1
  4. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +3 -1
  5. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  6. package/lib/commonjs/components/Attachment/Gallery.js +16 -3
  7. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  8. package/lib/commonjs/components/Attachment/ImageReloadIndicator.js.map +1 -1
  9. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +2 -2
  10. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  11. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -24
  12. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  13. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +2 -4
  14. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  15. package/lib/commonjs/components/Channel/Channel.js +320 -310
  16. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  17. package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -1
  18. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  19. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  20. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js +133 -147
  21. package/lib/commonjs/components/Channel/hooks/useMessageListPagination.js.map +1 -1
  22. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  23. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +8 -13
  24. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  25. package/lib/commonjs/components/Message/Message.js +14 -7
  26. package/lib/commonjs/components/Message/Message.js.map +1 -1
  27. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  28. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js +70 -54
  29. package/lib/commonjs/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  30. package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +14 -6
  31. package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js.map +1 -1
  32. package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  33. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  34. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
  35. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  36. package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
  37. package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
  38. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +25 -39
  39. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  40. package/lib/commonjs/components/MessageInput/InputButtons.js +18 -15
  41. package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
  42. package/lib/commonjs/components/MessageInput/MessageInput.js +96 -74
  43. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  44. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
  45. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
  46. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +4 -4
  47. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
  48. package/lib/commonjs/components/MessageList/MessageList.js +281 -223
  49. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  50. package/lib/commonjs/components/MessageList/hooks/useMessageList.js +65 -48
  51. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  52. package/lib/commonjs/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.js.map +1 -1
  53. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +1 -1
  54. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
  55. package/lib/commonjs/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
  56. package/lib/commonjs/components/MessageList/utils/getReadState.js +20 -0
  57. package/lib/commonjs/components/MessageList/utils/getReadState.js.map +1 -0
  58. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  59. package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
  60. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  61. package/lib/commonjs/components/Reply/Reply.js +2 -2
  62. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  63. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +24 -6
  64. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  65. package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
  66. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +10 -6
  67. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  68. package/lib/commonjs/components/index.js +15 -4
  69. package/lib/commonjs/components/index.js.map +1 -1
  70. package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  71. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +5 -1
  72. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
  73. package/lib/commonjs/contexts/debugContext/DebugContext.js.map +1 -1
  74. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  75. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  76. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +535 -523
  77. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  78. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -6
  79. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  80. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +37 -41
  81. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  82. package/lib/commonjs/contexts/messageInputContext/utils/utils.js +4 -4
  83. package/lib/commonjs/contexts/messageInputContext/utils/utils.js.map +1 -1
  84. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  85. package/lib/commonjs/contexts/pollContext/pollContext.js.map +1 -1
  86. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js +23 -14
  87. package/lib/commonjs/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  88. package/lib/commonjs/contexts/themeContext/utils/theme.js +2 -1
  89. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  90. package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
  91. package/lib/commonjs/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
  92. package/lib/commonjs/hooks/index.js +22 -0
  93. package/lib/commonjs/hooks/index.js.map +1 -1
  94. package/lib/commonjs/hooks/useAudioPlayer.js +60 -69
  95. package/lib/commonjs/hooks/useAudioPlayer.js.map +1 -1
  96. package/lib/commonjs/hooks/useStableCallback.js +13 -0
  97. package/lib/commonjs/hooks/useStableCallback.js.map +1 -0
  98. package/lib/commonjs/hooks/useTranslatedMessage.js.map +1 -1
  99. package/lib/commonjs/i18n/en.json +3 -0
  100. package/lib/commonjs/i18n/es.json +3 -0
  101. package/lib/commonjs/i18n/fr.json +3 -0
  102. package/lib/commonjs/i18n/he.json +3 -0
  103. package/lib/commonjs/i18n/hi.json +2 -0
  104. package/lib/commonjs/i18n/it.json +3 -0
  105. package/lib/commonjs/i18n/ja.json +1 -0
  106. package/lib/commonjs/i18n/ko.json +1 -0
  107. package/lib/commonjs/i18n/nl.json +2 -0
  108. package/lib/commonjs/i18n/pt-br.json +3 -0
  109. package/lib/commonjs/i18n/ru.json +4 -0
  110. package/lib/commonjs/i18n/tr.json +2 -0
  111. package/lib/commonjs/mock-builders/api/channelMocks.js.map +1 -1
  112. package/lib/commonjs/native.js.map +1 -1
  113. package/lib/commonjs/store/mappers/mapMessageToStorable.js.map +1 -1
  114. package/lib/commonjs/types/types.js.map +1 -1
  115. package/lib/commonjs/utils/compressImage.js +1 -1
  116. package/lib/commonjs/utils/compressImage.js.map +1 -1
  117. package/lib/commonjs/utils/removeReservedFields.js.map +1 -1
  118. package/lib/commonjs/utils/utils.js +17 -4
  119. package/lib/commonjs/utils/utils.js.map +1 -1
  120. package/lib/commonjs/version.json +1 -1
  121. package/lib/module/components/Attachment/AudioAttachment.js +19 -9
  122. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -1
  123. package/lib/module/components/Attachment/FileAttachmentGroup.js +3 -1
  124. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  125. package/lib/module/components/Attachment/Gallery.js +16 -3
  126. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  127. package/lib/module/components/Attachment/ImageReloadIndicator.js.map +1 -1
  128. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +2 -2
  129. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  130. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +7 -24
  131. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  132. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +2 -4
  133. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js.map +1 -1
  134. package/lib/module/components/Channel/Channel.js +320 -310
  135. package/lib/module/components/Channel/Channel.js.map +1 -1
  136. package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -1
  137. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  138. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  139. package/lib/module/components/Channel/hooks/useMessageListPagination.js +133 -147
  140. package/lib/module/components/Channel/hooks/useMessageListPagination.js.map +1 -1
  141. package/lib/module/components/Chat/Chat.js.map +1 -1
  142. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +8 -13
  143. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  144. package/lib/module/components/Message/Message.js +14 -7
  145. package/lib/module/components/Message/Message.js.map +1 -1
  146. package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  147. package/lib/module/components/Message/MessageSimple/MessageSimple.js +70 -54
  148. package/lib/module/components/Message/MessageSimple/MessageSimple.js.map +1 -1
  149. package/lib/module/components/Message/MessageSimple/MessageStatus.js +14 -6
  150. package/lib/module/components/Message/MessageSimple/MessageStatus.js.map +1 -1
  151. package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  152. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  153. package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
  154. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  155. package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
  156. package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
  157. package/lib/module/components/MessageInput/FileUploadPreview.js +25 -39
  158. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  159. package/lib/module/components/MessageInput/InputButtons.js +18 -15
  160. package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
  161. package/lib/module/components/MessageInput/MessageInput.js +96 -74
  162. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  163. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
  164. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
  165. package/lib/module/components/MessageInput/hooks/useAudioController.js +4 -4
  166. package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
  167. package/lib/module/components/MessageList/MessageList.js +281 -223
  168. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  169. package/lib/module/components/MessageList/hooks/useMessageList.js +65 -48
  170. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  171. package/lib/module/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.js.map +1 -1
  172. package/lib/module/components/MessageList/utils/getGroupStyles.js +1 -1
  173. package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
  174. package/lib/module/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
  175. package/lib/module/components/MessageList/utils/getReadState.js +20 -0
  176. package/lib/module/components/MessageList/utils/getReadState.js.map +1 -0
  177. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  178. package/lib/module/components/Poll/components/Button.js.map +1 -1
  179. package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  180. package/lib/module/components/Reply/Reply.js +2 -2
  181. package/lib/module/components/Reply/Reply.js.map +1 -1
  182. package/lib/module/components/Thread/components/ThreadFooterComponent.js +24 -6
  183. package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  184. package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
  185. package/lib/module/components/UIComponents/BottomSheetModal.js +10 -6
  186. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  187. package/lib/module/components/index.js +15 -4
  188. package/lib/module/components/index.js.map +1 -1
  189. package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  190. package/lib/module/contexts/channelsStateContext/useChannelState.js +5 -1
  191. package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
  192. package/lib/module/contexts/debugContext/DebugContext.js.map +1 -1
  193. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  194. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  195. package/lib/module/contexts/messageInputContext/MessageInputContext.js +535 -523
  196. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  197. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -6
  198. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  199. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +37 -41
  200. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  201. package/lib/module/contexts/messageInputContext/utils/utils.js +4 -4
  202. package/lib/module/contexts/messageInputContext/utils/utils.js.map +1 -1
  203. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  204. package/lib/module/contexts/pollContext/pollContext.js.map +1 -1
  205. package/lib/module/contexts/suggestionsContext/SuggestionsContext.js +23 -14
  206. package/lib/module/contexts/suggestionsContext/SuggestionsContext.js.map +1 -1
  207. package/lib/module/contexts/themeContext/utils/theme.js +2 -1
  208. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  209. package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
  210. package/lib/module/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
  211. package/lib/module/hooks/index.js +22 -0
  212. package/lib/module/hooks/index.js.map +1 -1
  213. package/lib/module/hooks/useAudioPlayer.js +60 -69
  214. package/lib/module/hooks/useAudioPlayer.js.map +1 -1
  215. package/lib/module/hooks/useStableCallback.js +13 -0
  216. package/lib/module/hooks/useStableCallback.js.map +1 -0
  217. package/lib/module/hooks/useTranslatedMessage.js.map +1 -1
  218. package/lib/module/i18n/en.json +3 -0
  219. package/lib/module/i18n/es.json +3 -0
  220. package/lib/module/i18n/fr.json +3 -0
  221. package/lib/module/i18n/he.json +3 -0
  222. package/lib/module/i18n/hi.json +2 -0
  223. package/lib/module/i18n/it.json +3 -0
  224. package/lib/module/i18n/ja.json +1 -0
  225. package/lib/module/i18n/ko.json +1 -0
  226. package/lib/module/i18n/nl.json +2 -0
  227. package/lib/module/i18n/pt-br.json +3 -0
  228. package/lib/module/i18n/ru.json +4 -0
  229. package/lib/module/i18n/tr.json +2 -0
  230. package/lib/module/mock-builders/api/channelMocks.js.map +1 -1
  231. package/lib/module/native.js.map +1 -1
  232. package/lib/module/store/mappers/mapMessageToStorable.js.map +1 -1
  233. package/lib/module/types/types.js.map +1 -1
  234. package/lib/module/utils/compressImage.js +1 -1
  235. package/lib/module/utils/compressImage.js.map +1 -1
  236. package/lib/module/utils/removeReservedFields.js.map +1 -1
  237. package/lib/module/utils/utils.js +17 -4
  238. package/lib/module/utils/utils.js.map +1 -1
  239. package/lib/module/version.json +1 -1
  240. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +2 -2
  241. package/lib/typescript/components/Attachment/AudioAttachment.d.ts.map +1 -1
  242. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
  243. package/lib/typescript/components/Attachment/Gallery.d.ts +3 -3
  244. package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
  245. package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts +4 -3
  246. package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts.map +1 -1
  247. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  248. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts +2 -2
  249. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  250. package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts +2 -3
  251. package/lib/typescript/components/AutoCompleteInput/AutoCompleteInput.d.ts.map +1 -1
  252. package/lib/typescript/components/Channel/Channel.d.ts +3 -4
  253. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  254. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +2 -3
  255. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -1
  256. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  257. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  258. package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts +6 -6
  259. package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts.map +1 -1
  260. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts +3 -3
  261. package/lib/typescript/components/Channel/hooks/useMessageListPagination.d.ts.map +1 -1
  262. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +1 -1
  263. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
  264. package/lib/typescript/components/Chat/Chat.d.ts +0 -9
  265. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  266. package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts +3 -0
  267. package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
  268. package/lib/typescript/components/Message/Message.d.ts +4 -5
  269. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  270. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts +2 -3
  271. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
  272. package/lib/typescript/components/Message/MessageSimple/MessageSimple.d.ts.map +1 -1
  273. package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts +1 -1
  274. package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts.map +1 -1
  275. package/lib/typescript/components/Message/MessageSimple/MessageTextContainer.d.ts.map +1 -1
  276. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +2 -2
  277. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts.map +1 -1
  278. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  279. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  280. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
  281. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +2 -2
  282. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts.map +1 -1
  283. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +2 -4
  284. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
  285. package/lib/typescript/components/MessageInput/InputButtons.d.ts +1 -1
  286. package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
  287. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  288. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  289. package/lib/typescript/components/MessageInput/hooks/useAudioController.d.ts.map +1 -1
  290. package/lib/typescript/components/MessageList/MessageList.d.ts +4 -4
  291. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  292. package/lib/typescript/components/MessageList/MessageSystem.d.ts +2 -2
  293. package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
  294. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts +14 -9
  295. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  296. package/lib/typescript/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.d.ts +2 -2
  297. package/lib/typescript/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.d.ts.map +1 -1
  298. package/lib/typescript/components/MessageList/utils/getGroupStyles.d.ts.map +1 -1
  299. package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts +2 -2
  300. package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts.map +1 -1
  301. package/lib/typescript/components/MessageList/utils/getReadState.d.ts +9 -0
  302. package/lib/typescript/components/MessageList/utils/getReadState.d.ts.map +1 -0
  303. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +2 -3
  304. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
  305. package/lib/typescript/components/Poll/components/Button.d.ts +2 -3
  306. package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
  307. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +2 -3
  308. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
  309. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  310. package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts.map +1 -1
  311. package/lib/typescript/components/ThreadList/ThreadListItem.d.ts.map +1 -1
  312. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  313. package/lib/typescript/components/index.d.ts +2 -1
  314. package/lib/typescript/components/index.d.ts.map +1 -1
  315. package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +3 -3
  316. package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts.map +1 -1
  317. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
  318. package/lib/typescript/contexts/debugContext/DebugContext.d.ts +2 -3
  319. package/lib/typescript/contexts/debugContext/DebugContext.d.ts.map +1 -1
  320. package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +3 -3
  321. package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts.map +1 -1
  322. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +6 -4
  323. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  324. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +13 -15
  325. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  326. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  327. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  328. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +3 -3
  329. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
  330. package/lib/typescript/contexts/messageInputContext/utils/utils.d.ts +2 -2
  331. package/lib/typescript/contexts/messageInputContext/utils/utils.d.ts.map +1 -1
  332. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +25 -21
  333. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  334. package/lib/typescript/contexts/pollContext/pollContext.d.ts +2 -3
  335. package/lib/typescript/contexts/pollContext/pollContext.d.ts.map +1 -1
  336. package/lib/typescript/contexts/suggestionsContext/SuggestionsContext.d.ts.map +1 -1
  337. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +1 -0
  338. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  339. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts +4 -5
  340. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
  341. package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts +3 -4
  342. package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts.map +1 -1
  343. package/lib/typescript/hooks/index.d.ts +2 -0
  344. package/lib/typescript/hooks/index.d.ts.map +1 -1
  345. package/lib/typescript/hooks/useAudioPlayer.d.ts.map +1 -1
  346. package/lib/typescript/hooks/useStableCallback.d.ts +26 -0
  347. package/lib/typescript/hooks/useStableCallback.d.ts.map +1 -0
  348. package/lib/typescript/hooks/useTranslatedMessage.d.ts +59 -58
  349. package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
  350. package/lib/typescript/i18n/en.json +3 -0
  351. package/lib/typescript/i18n/es.json +3 -0
  352. package/lib/typescript/i18n/fr.json +3 -0
  353. package/lib/typescript/i18n/he.json +3 -0
  354. package/lib/typescript/i18n/hi.json +2 -0
  355. package/lib/typescript/i18n/it.json +3 -0
  356. package/lib/typescript/i18n/ja.json +1 -0
  357. package/lib/typescript/i18n/ko.json +1 -0
  358. package/lib/typescript/i18n/nl.json +2 -0
  359. package/lib/typescript/i18n/pt-br.json +3 -0
  360. package/lib/typescript/i18n/ru.json +4 -0
  361. package/lib/typescript/i18n/tr.json +2 -0
  362. package/lib/typescript/native.d.ts +8 -11
  363. package/lib/typescript/native.d.ts.map +1 -1
  364. package/lib/typescript/store/apis/insertReaction.d.ts +2 -2
  365. package/lib/typescript/store/apis/insertReaction.d.ts.map +1 -1
  366. package/lib/typescript/store/apis/updateMessage.d.ts +2 -2
  367. package/lib/typescript/store/apis/updateMessage.d.ts.map +1 -1
  368. package/lib/typescript/store/apis/updateReaction.d.ts +2 -2
  369. package/lib/typescript/store/apis/updateReaction.d.ts.map +1 -1
  370. package/lib/typescript/store/mappers/mapMessageToStorable.d.ts +2 -2
  371. package/lib/typescript/store/mappers/mapMessageToStorable.d.ts.map +1 -1
  372. package/lib/typescript/types/types.d.ts +28 -50
  373. package/lib/typescript/types/types.d.ts.map +1 -1
  374. package/lib/typescript/utils/compressImage.d.ts +2 -2
  375. package/lib/typescript/utils/compressImage.d.ts.map +1 -1
  376. package/lib/typescript/utils/i18n/Streami18n.d.ts +3 -0
  377. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  378. package/lib/typescript/utils/removeReservedFields.d.ts +2 -3
  379. package/lib/typescript/utils/removeReservedFields.d.ts.map +1 -1
  380. package/lib/typescript/utils/utils.d.ts +10 -10
  381. package/lib/typescript/utils/utils.d.ts.map +1 -1
  382. package/package.json +4 -3
  383. package/src/components/Attachment/AudioAttachment.tsx +12 -6
  384. package/src/components/Attachment/FileAttachmentGroup.tsx +3 -1
  385. package/src/components/Attachment/Gallery.tsx +22 -7
  386. package/src/components/Attachment/ImageReloadIndicator.tsx +4 -5
  387. package/src/components/AttachmentPicker/AttachmentPicker.tsx +4 -10
  388. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +9 -37
  389. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +27 -23
  390. package/src/components/AutoCompleteInput/__tests__/AutoCompleteInput.test.js +12 -12
  391. package/src/components/Channel/Channel.tsx +423 -361
  392. package/src/components/Channel/__tests__/Channel.test.js +10 -3
  393. package/src/components/Channel/hooks/useChannelDataState.ts +2 -4
  394. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  395. package/src/components/Channel/hooks/useMessageListPagination.tsx +150 -150
  396. package/src/components/Chat/Chat.tsx +0 -9
  397. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +8 -7
  398. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +5 -4
  399. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +5 -4
  400. package/src/components/ImageGallery/__tests__/ImageGalleryOverlay.test.tsx +3 -2
  401. package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +12 -5
  402. package/src/components/Message/Message.tsx +16 -15
  403. package/src/components/Message/MessageSimple/MessageFooter.tsx +2 -3
  404. package/src/components/Message/MessageSimple/MessageSimple.tsx +112 -70
  405. package/src/components/Message/MessageSimple/MessageStatus.tsx +19 -17
  406. package/src/components/Message/MessageSimple/MessageTextContainer.tsx +3 -3
  407. package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +11 -5
  408. package/src/components/Message/MessageSimple/__tests__/MessageTextContainer.test.tsx +5 -4
  409. package/src/components/Message/MessageSimple/utils/renderText.tsx +2 -3
  410. package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
  411. package/src/components/Message/hooks/useMessageActionHandlers.ts +1 -3
  412. package/src/components/Message/hooks/useMessageActions.tsx +4 -3
  413. package/src/components/MessageInput/FileUploadPreview.tsx +41 -70
  414. package/src/components/MessageInput/ImageUploadPreview.tsx +2 -2
  415. package/src/components/MessageInput/InputButtons.tsx +14 -10
  416. package/src/components/MessageInput/MessageInput.tsx +28 -30
  417. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -1
  418. package/src/components/MessageInput/__tests__/MessageInput.test.js +3 -1
  419. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +1 -0
  420. package/src/components/MessageInput/hooks/useAudioController.tsx +6 -5
  421. package/src/components/MessageList/MessageList.tsx +253 -137
  422. package/src/components/MessageList/MessageSystem.tsx +2 -2
  423. package/src/components/MessageList/hooks/useMessageList.ts +82 -64
  424. package/src/components/MessageList/hooks/useShouldScrollToRecentOnNewOwnMessage.ts +2 -2
  425. package/src/components/MessageList/utils/getGroupStyles.ts +7 -5
  426. package/src/components/MessageList/utils/getLastReceivedMessage.ts +3 -3
  427. package/src/components/MessageList/utils/getReadState.ts +27 -0
  428. package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +2 -3
  429. package/src/components/MessageMenu/hooks/useFetchReactions.ts +2 -3
  430. package/src/components/Poll/components/Button.tsx +2 -4
  431. package/src/components/Poll/components/PollResults/PollResultItem.tsx +2 -3
  432. package/src/components/Reply/Reply.tsx +1 -2
  433. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +318 -847
  434. package/src/components/Thread/components/ThreadFooterComponent.tsx +31 -9
  435. package/src/components/ThreadList/ThreadListItem.tsx +6 -4
  436. package/src/components/UIComponents/BottomSheetModal.tsx +11 -7
  437. package/src/components/index.ts +2 -1
  438. package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +5 -4
  439. package/src/contexts/channelsStateContext/useChannelState.ts +5 -1
  440. package/src/contexts/debugContext/DebugContext.tsx +2 -4
  441. package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +5 -4
  442. package/src/contexts/messageContext/MessageContext.tsx +6 -4
  443. package/src/contexts/messageInputContext/MessageInputContext.tsx +295 -262
  444. package/src/contexts/messageInputContext/__tests__/__snapshots__/sendMessage.test.tsx.snap +10 -6
  445. package/src/contexts/messageInputContext/__tests__/sendMessage.test.tsx +6 -5
  446. package/src/contexts/messageInputContext/__tests__/updateMessage.test.tsx +3 -5
  447. package/src/contexts/messageInputContext/__tests__/useMessageDetailsForState.test.tsx +14 -9
  448. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +7 -3
  449. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +37 -40
  450. package/src/contexts/messageInputContext/utils/utils.ts +6 -8
  451. package/src/contexts/messagesContext/MessagesContext.tsx +26 -20
  452. package/src/contexts/pollContext/pollContext.tsx +2 -4
  453. package/src/contexts/suggestionsContext/SuggestionsContext.tsx +33 -14
  454. package/src/contexts/themeContext/utils/theme.ts +2 -0
  455. package/src/contexts/threadContext/ThreadContext.tsx +4 -6
  456. package/src/contexts/threadsContext/ThreadListItemContext.tsx +3 -5
  457. package/src/hooks/index.ts +2 -0
  458. package/src/hooks/useAudioPlayer.ts +37 -31
  459. package/src/hooks/useStableCallback.ts +37 -0
  460. package/src/hooks/useTranslatedMessage.ts +2 -2
  461. package/src/i18n/en.json +3 -0
  462. package/src/i18n/es.json +3 -0
  463. package/src/i18n/fr.json +3 -0
  464. package/src/i18n/he.json +3 -0
  465. package/src/i18n/hi.json +2 -0
  466. package/src/i18n/it.json +3 -0
  467. package/src/i18n/ja.json +1 -0
  468. package/src/i18n/ko.json +1 -0
  469. package/src/i18n/nl.json +2 -0
  470. package/src/i18n/pt-br.json +3 -0
  471. package/src/i18n/ru.json +4 -0
  472. package/src/i18n/tr.json +2 -0
  473. package/src/mock-builders/api/channelMocks.tsx +2 -8
  474. package/src/native.ts +13 -8
  475. package/src/store/apis/insertReaction.ts +2 -2
  476. package/src/store/apis/updateMessage.ts +2 -2
  477. package/src/store/apis/updateReaction.ts +2 -2
  478. package/src/store/mappers/mapMessageToStorable.ts +2 -2
  479. package/src/types/stream-chat-common-custom-data.d.ts +22 -22
  480. package/src/types/types.ts +35 -54
  481. package/src/utils/compressImage.ts +3 -4
  482. package/src/utils/removeReservedFields.ts +3 -5
  483. package/src/utils/utils.ts +25 -16
  484. package/src/version.json +1 -1
  485. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js +0 -20
  486. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js.map +0 -1
  487. package/lib/commonjs/components/MessageList/utils/getReadStates.js +0 -34
  488. package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +0 -1
  489. package/lib/module/components/MessageList/hooks/useLastReadData.js +0 -20
  490. package/lib/module/components/MessageList/hooks/useLastReadData.js.map +0 -1
  491. package/lib/module/components/MessageList/utils/getReadStates.js +0 -34
  492. package/lib/module/components/MessageList/utils/getReadStates.js.map +0 -1
  493. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts +0 -12
  494. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts.map +0 -1
  495. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +0 -5
  496. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +0 -1
  497. package/src/components/MessageList/hooks/useLastReadData.ts +0 -29
  498. package/src/components/MessageList/utils/getReadStates.ts +0 -55
@@ -58,7 +58,12 @@ export class KeyboardCompatibleView extends React.Component<
58
58
 
59
59
  _relativeKeyboardHeight(keyboardFrame: KeyboardMetrics) {
60
60
  const frame = this._frame;
61
- if (!frame || !keyboardFrame) {
61
+ /**
62
+ * With iOS 14 & Reduce Motion > Prefer Cross-Fade Transitions enabled, the keyboard position
63
+ * height is reported differently (0 instead of Y position value) which caused the view to take full height
64
+ * of the screen.
65
+ */
66
+ if (!frame || !keyboardFrame || keyboardFrame.screenY === 0) {
62
67
  return 0;
63
68
  }
64
69
 
@@ -197,6 +202,8 @@ export class KeyboardCompatibleView extends React.Component<
197
202
  this.unsetKeyboardListeners();
198
203
  }
199
204
 
205
+ keyboardContextValue = { dismissKeyboard: this.dismissKeyboard };
206
+
200
207
  render() {
201
208
  const { behavior, children, contentContainerStyle, enabled, style, ...props } = this.props;
202
209
  const bottomHeight = enabled ? this.state.bottom : 0;
@@ -215,7 +222,7 @@ export class KeyboardCompatibleView extends React.Component<
215
222
  };
216
223
  }
217
224
  return (
218
- <KeyboardProvider value={{ dismissKeyboard: this.dismissKeyboard }}>
225
+ <KeyboardProvider value={this.keyboardContextValue}>
219
226
  <View
220
227
  onLayout={this._onLayout}
221
228
  ref={this.viewRef}
@@ -229,7 +236,7 @@ export class KeyboardCompatibleView extends React.Component<
229
236
 
230
237
  case 'position':
231
238
  return (
232
- <KeyboardProvider value={{ dismissKeyboard: this.dismissKeyboard }}>
239
+ <KeyboardProvider value={this.keyboardContextValue}>
233
240
  <View onLayout={this._onLayout} ref={this.viewRef} style={style} {...props}>
234
241
  <View
235
242
  style={StyleSheet.compose(contentContainerStyle, {
@@ -244,7 +251,7 @@ export class KeyboardCompatibleView extends React.Component<
244
251
 
245
252
  case 'padding':
246
253
  return (
247
- <KeyboardProvider value={{ dismissKeyboard: this.dismissKeyboard }}>
254
+ <KeyboardProvider value={this.keyboardContextValue}>
248
255
  <View
249
256
  onLayout={this._onLayout}
250
257
  ref={this.viewRef}
@@ -258,7 +265,7 @@ export class KeyboardCompatibleView extends React.Component<
258
265
 
259
266
  default:
260
267
  return (
261
- <KeyboardProvider value={{ dismissKeyboard: this.dismissKeyboard }}>
268
+ <KeyboardProvider value={this.keyboardContextValue}>
262
269
  <View onLayout={this._onLayout} ref={this.viewRef} style={style} {...props}>
263
270
  {children}
264
271
  </View>
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo, useState } from 'react';
2
2
  import { GestureResponderEvent, Keyboard, StyleProp, View, ViewStyle } from 'react-native';
3
3
 
4
- import type { Attachment, UserResponse } from 'stream-chat';
4
+ import type { Attachment, LocalMessage, UserResponse } from 'stream-chat';
5
5
 
6
6
  import { useCreateMessageContext } from './hooks/useCreateMessageContext';
7
7
  import { useMessageActionHandlers } from './hooks/useMessageActionHandlers';
@@ -41,11 +41,7 @@ import {
41
41
  MessageStatusTypes,
42
42
  } from '../../utils/utils';
43
43
  import type { Thumbnail } from '../Attachment/utils/buildGallery/types';
44
-
45
- import {
46
- isMessageWithStylesReadByAndDateSeparator,
47
- MessageType,
48
- } from '../MessageList/hooks/useMessageList';
44
+ import { getReadState } from '../MessageList/utils/getReadState';
49
45
 
50
46
  export type TouchableEmitter =
51
47
  | 'fileAttachment'
@@ -114,7 +110,7 @@ export type MessagePressableHandlerPayload = PressableHandlerPayload & {
114
110
  /**
115
111
  * Message object, on which interaction occurred.
116
112
  */
117
- message?: MessageType;
113
+ message?: LocalMessage;
118
114
  };
119
115
 
120
116
  export type MessageActionHandlers = {
@@ -130,7 +126,7 @@ export type MessageActionHandlers = {
130
126
  toggleMuteUser: () => Promise<void>;
131
127
  toggleReaction: (reactionType: string) => Promise<void>;
132
128
  unpinMessage: () => Promise<void>;
133
- threadReply?: (message: MessageType) => Promise<void>;
129
+ threadReply?: (message: LocalMessage) => Promise<void>;
134
130
  };
135
131
 
136
132
  export type MessagePropsWithContext = Pick<
@@ -194,7 +190,7 @@ export type MessagePropsWithContext = Pick<
194
190
  *
195
191
  * @param message A message object to open the thread upon.
196
192
  */
197
- onThreadSelect?: (message: MessageType) => void;
193
+ onThreadSelect?: (message: LocalMessage) => void;
198
194
  showUnreadUnderlay?: boolean;
199
195
  style?: StyleProp<ViewStyle>;
200
196
  };
@@ -267,6 +263,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
267
263
  threadList = false,
268
264
  updateMessage,
269
265
  } = props;
266
+ const { read } = useChannelContext();
270
267
  const isMessageAIGenerated = messagesContext.isMessageAIGenerated;
271
268
  const isAIGenerated = useMemo(
272
269
  () => isMessageAIGenerated(message),
@@ -277,10 +274,11 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
277
274
  const {
278
275
  theme: {
279
276
  colors: { targetedMessageBackground },
280
- messageSimple: { targetedMessageContainer, unreadUnderlayColor },
277
+ messageSimple: { targetedMessageContainer, unreadUnderlayColor, wrapper },
281
278
  screenPadding,
282
279
  },
283
280
  } = useTheme();
281
+ const readBy = useMemo(() => getReadState(message, read), [message, read]);
284
282
 
285
283
  const showMessageOverlay = async (showMessageReactions = false, selectedReaction?: string) => {
286
284
  await dismissKeyboard();
@@ -312,7 +310,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
312
310
  }
313
311
  };
314
312
 
315
- const onPressQuotedMessage = (quotedMessage: MessageType) => {
313
+ const onPressQuotedMessage = (quotedMessage: LocalMessage) => {
316
314
  if (!goToMessage) {
317
315
  return;
318
316
  }
@@ -329,7 +327,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
329
327
  if (isEditedMessage(message)) {
330
328
  setIsEditedMessageOpen((prevState) => !prevState);
331
329
  }
332
- const quotedMessage = message.quoted_message as MessageType;
330
+ const quotedMessage = message.quoted_message;
333
331
  if (error) {
334
332
  setIsErrorInMessage(true);
335
333
  /**
@@ -693,6 +691,7 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
693
691
  otherAttachments: attachments.other,
694
692
  preventPress,
695
693
  reactions,
694
+ readBy,
696
695
  setIsEditedMessageOpen,
697
696
  showAvatar,
698
697
  showMessageOverlay,
@@ -718,8 +717,12 @@ const MessageWithContext = (props: MessagePropsWithContext) => {
718
717
  <View
719
718
  style={[
720
719
  { marginTop: 2, paddingHorizontal: screenPadding },
720
+ wrapper,
721
721
  (isTargetedMessage || message.pinned) && !isMessageTypeDeleted
722
- ? { backgroundColor: targetedMessageBackground, ...targetedMessageContainer }
722
+ ? {
723
+ backgroundColor: targetedMessageBackground,
724
+ ...targetedMessageContainer,
725
+ }
723
726
  : {},
724
727
  ]}
725
728
  testID='message-wrapper'
@@ -810,8 +813,6 @@ const areEqual = (prevProps: MessagePropsWithContext, nextProps: MessagePropsWit
810
813
 
811
814
  const messageEqual =
812
815
  isPrevMessageTypeDeleted === isNextMessageTypeDeleted &&
813
- (isMessageWithStylesReadByAndDateSeparator(prevMessage) && prevMessage.readBy) ===
814
- (isMessageWithStylesReadByAndDateSeparator(nextMessage) && nextMessage.readBy) &&
815
816
  prevMessage.status === nextMessage.status &&
816
817
  prevMessage.type === nextMessage.type &&
817
818
  prevMessage.text === nextMessage.text &&
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { StyleSheet, Text, View } from 'react-native';
3
3
 
4
- import type { Attachment } from 'stream-chat';
4
+ import type { Attachment, LocalMessage } from 'stream-chat';
5
5
 
6
6
  import type { MessageStatusProps } from './MessageStatus';
7
7
 
@@ -21,7 +21,6 @@ import { useTranslationContext } from '../../../contexts/translationContext/Tran
21
21
  import { Eye } from '../../../icons';
22
22
 
23
23
  import { isEditedMessage, MessageStatusTypes } from '../../../utils/utils';
24
- import type { MessageType } from '../../MessageList/hooks/useMessageList';
25
24
 
26
25
  type MessageFooterComponentProps = {
27
26
  date?: string | Date;
@@ -271,7 +270,7 @@ export type MessageFooterProps = Partial<Pick<ChannelContextValue, 'members'>> &
271
270
  MessageFooterComponentProps & {
272
271
  alignment?: Alignment;
273
272
  lastGroupMessage?: boolean;
274
- message?: MessageType;
273
+ message?: LocalMessage;
275
274
  MessageStatus?: React.ComponentType<MessageStatusProps>;
276
275
  otherAttachments?: Attachment[];
277
276
  showMessageStatus?: boolean;
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { Dimensions, LayoutChangeEvent, StyleSheet, View } from 'react-native';
3
3
 
4
4
  import { Gesture, GestureDetector } from 'react-native-gesture-handler';
@@ -12,6 +12,8 @@ import Animated, {
12
12
  withSpring,
13
13
  } from 'react-native-reanimated';
14
14
 
15
+ const AnimatedWrapper = Animated.createAnimatedComponent(View);
16
+
15
17
  import {
16
18
  MessageContextValue,
17
19
  useMessageContext,
@@ -199,77 +201,104 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
199
201
 
200
202
  const translateX = useSharedValue(0);
201
203
  const touchStart = useSharedValue<{ x: number; y: number } | null>(null);
204
+ const isSwiping = useSharedValue<boolean>(false);
205
+ const [isBeingSwiped, setIsBeingSwiped] = useState<boolean>(false);
202
206
 
203
- const onSwipeToReply = () => {
207
+ const onSwipeToReply = useCallback(() => {
204
208
  clearQuotedMessageState();
205
209
  setQuotedMessageState(message);
206
- };
210
+ }, [clearQuotedMessageState, message, setQuotedMessageState]);
207
211
 
208
212
  const THRESHOLD = 25;
209
213
 
210
214
  const triggerHaptic = NativeHandlers.triggerHaptic;
211
215
 
212
- const swipeGesture = Gesture.Pan()
213
- .hitSlop(messageSwipeToReplyHitSlop)
214
- .onBegin((event) => {
215
- touchStart.value = { x: event.x, y: event.y };
216
- })
217
- .onTouchesMove((event, state) => {
218
- if (!touchStart.value || !event.changedTouches.length) {
219
- state.fail();
220
- return;
221
- }
222
-
223
- const xDiff = Math.abs(event.changedTouches[0].x - touchStart.value.x);
224
- const yDiff = Math.abs(event.changedTouches[0].y - touchStart.value.y);
225
- const isHorizontalPanning = xDiff > yDiff;
226
-
227
- if (isHorizontalPanning) {
228
- state.activate();
229
- } else {
230
- state.fail();
231
- }
232
- })
233
- .onStart(() => {
234
- translateX.value = 0;
235
- })
236
- .onChange(({ translationX }) => {
237
- if (translationX > 0) {
238
- translateX.value = translationX;
239
- }
240
- })
241
- .onEnd(() => {
242
- if (translateX.value >= THRESHOLD) {
243
- runOnJS(onSwipeToReply)();
244
- if (triggerHaptic) {
245
- runOnJS(triggerHaptic)('impactMedium');
246
- }
247
- }
248
- translateX.value = withSpring(0, {
249
- dampingRatio: 1,
250
- duration: 500,
251
- overshootClamping: true,
252
- stiffness: 1,
253
- });
254
- });
255
-
256
- const messageBubbleAnimatedStyle = useAnimatedStyle(() => ({
257
- transform: [{ translateX: translateX.value }],
258
- }));
259
-
260
- const swipeContentAnimatedStyle = useAnimatedStyle(() => ({
261
- opacity: interpolate(translateX.value, [0, THRESHOLD], [0, 1]),
262
- transform: [
263
- {
264
- translateX: interpolate(
265
- translateX.value,
266
- [0, THRESHOLD],
267
- [-THRESHOLD, 0],
268
- Extrapolation.CLAMP,
269
- ),
270
- },
271
- ],
272
- }));
216
+ const swipeGesture = useMemo(
217
+ () =>
218
+ Gesture.Pan()
219
+ .hitSlop(messageSwipeToReplyHitSlop)
220
+ .onBegin((event) => {
221
+ touchStart.value = { x: event.x, y: event.y };
222
+ })
223
+ .onTouchesMove((event, state) => {
224
+ if (!touchStart.value || !event.changedTouches.length) {
225
+ state.fail();
226
+ return;
227
+ }
228
+
229
+ const xDiff = Math.abs(event.changedTouches[0].x - touchStart.value.x);
230
+ const yDiff = Math.abs(event.changedTouches[0].y - touchStart.value.y);
231
+ const isHorizontalPanning = xDiff > yDiff;
232
+
233
+ if (isHorizontalPanning) {
234
+ state.activate();
235
+ isSwiping.value = true;
236
+ runOnJS(setIsBeingSwiped)(true);
237
+ } else {
238
+ state.fail();
239
+ }
240
+ })
241
+ .onStart(() => {
242
+ translateX.value = 0;
243
+ })
244
+ .onChange(({ translationX }) => {
245
+ if (translationX > 0) {
246
+ translateX.value = translationX;
247
+ }
248
+ })
249
+ .onEnd(() => {
250
+ if (translateX.value >= THRESHOLD) {
251
+ runOnJS(onSwipeToReply)();
252
+ if (triggerHaptic) {
253
+ runOnJS(triggerHaptic)('impactMedium');
254
+ }
255
+ }
256
+ translateX.value = withSpring(
257
+ 0,
258
+ {
259
+ dampingRatio: 1,
260
+ duration: 500,
261
+ overshootClamping: true,
262
+ stiffness: 1,
263
+ },
264
+ () => {
265
+ isSwiping.value = false;
266
+ runOnJS(setIsBeingSwiped)(false);
267
+ },
268
+ );
269
+ }),
270
+ [isSwiping, messageSwipeToReplyHitSlop, onSwipeToReply, touchStart, translateX, triggerHaptic],
271
+ );
272
+
273
+ const messageBubbleAnimatedStyle = useAnimatedStyle(
274
+ () =>
275
+ isSwiping.value
276
+ ? {
277
+ transform: [{ translateX: translateX.value }],
278
+ }
279
+ : {},
280
+ [],
281
+ );
282
+
283
+ const swipeContentAnimatedStyle = useAnimatedStyle(
284
+ () =>
285
+ isSwiping.value
286
+ ? {
287
+ opacity: interpolate(translateX.value, [0, THRESHOLD], [0, 1]),
288
+ transform: [
289
+ {
290
+ translateX: interpolate(
291
+ translateX.value,
292
+ [0, THRESHOLD],
293
+ [-THRESHOLD, 0],
294
+ Extrapolation.CLAMP,
295
+ ),
296
+ },
297
+ ],
298
+ }
299
+ : {},
300
+ [],
301
+ );
273
302
 
274
303
  const renderMessageBubble = useMemo(
275
304
  () => (
@@ -303,18 +332,31 @@ const MessageSimpleWithContext = (props: MessageSimplePropsWithContext) => {
303
332
  () => (
304
333
  <GestureDetector gesture={swipeGesture}>
305
334
  <View hitSlop={messageSwipeToReplyHitSlop} style={[styles.contentWrapper, contentWrapper]}>
306
- <Animated.View
307
- style={[styles.swipeContentContainer, swipeContentAnimatedStyle, swipeContentContainer]}
308
- >
309
- {MessageSwipeContent ? <MessageSwipeContent /> : null}
310
- </Animated.View>
311
- <Animated.View style={messageBubbleAnimatedStyle}>{renderMessageBubble}</Animated.View>
335
+ {isBeingSwiped ? (
336
+ <>
337
+ <AnimatedWrapper
338
+ style={[
339
+ styles.swipeContentContainer,
340
+ swipeContentAnimatedStyle,
341
+ swipeContentContainer,
342
+ ]}
343
+ >
344
+ {MessageSwipeContent ? <MessageSwipeContent /> : null}
345
+ </AnimatedWrapper>
346
+ <AnimatedWrapper pointerEvents='box-none' style={messageBubbleAnimatedStyle}>
347
+ {renderMessageBubble}
348
+ </AnimatedWrapper>
349
+ </>
350
+ ) : (
351
+ renderMessageBubble
352
+ )}
312
353
  </View>
313
354
  </GestureDetector>
314
355
  ),
315
356
  [
316
357
  MessageSwipeContent,
317
358
  contentWrapper,
359
+ isBeingSwiped,
318
360
  messageBubbleAnimatedStyle,
319
361
  messageSwipeToReplyHitSlop,
320
362
  renderMessageBubble,
@@ -10,16 +10,16 @@ import { useTheme } from '../../../contexts/themeContext/ThemeContext';
10
10
  import { Check } from '../../../icons/Check';
11
11
  import { CheckAll } from '../../../icons/CheckAll';
12
12
  import { Time } from '../../../icons/Time';
13
-
14
13
  import { MessageStatusTypes } from '../../../utils/utils';
15
14
 
16
- import { isMessageWithStylesReadByAndDateSeparator } from '../../MessageList/hooks/useMessageList';
17
-
18
- export type MessageStatusPropsWithContext = Pick<MessageContextValue, 'message' | 'threadList'>;
15
+ export type MessageStatusPropsWithContext = Pick<
16
+ MessageContextValue,
17
+ 'message' | 'readBy' | 'threadList'
18
+ >;
19
19
 
20
20
  const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
21
21
  const { channel } = useChannelContext();
22
- const { message, threadList } = props;
22
+ const { message, readBy, threadList } = props;
23
23
 
24
24
  const {
25
25
  theme: {
@@ -42,17 +42,17 @@ const MessageStatusWithContext = (props: MessageStatusPropsWithContext) => {
42
42
  return null;
43
43
  }
44
44
 
45
- if (isMessageWithStylesReadByAndDateSeparator(message)) {
45
+ if (readBy) {
46
46
  const members = channel?.state.members;
47
47
  const otherMembers = Object.values(members).filter(
48
48
  (member) => member.user_id !== message.user?.id,
49
49
  );
50
50
  const hasOtherMembersGreaterThanOne = otherMembers.length > 1;
51
- const hasReadByGreaterThanOne = typeof message.readBy === 'number' && message.readBy > 1;
51
+ const hasReadByGreaterThanOne = typeof readBy === 'number' && readBy > 1;
52
52
  const shouldDisplayReadByCount = hasOtherMembersGreaterThanOne && hasReadByGreaterThanOne;
53
53
  const countOfReadBy =
54
- typeof message.readBy === 'number' && hasOtherMembersGreaterThanOne ? message.readBy - 1 : 0;
55
- const showDoubleCheck = hasReadByGreaterThanOne || message.readBy === true;
54
+ typeof readBy === 'number' && hasOtherMembersGreaterThanOne ? readBy - 1 : 0;
55
+ const showDoubleCheck = hasReadByGreaterThanOne || readBy === true;
56
56
 
57
57
  return (
58
58
  <View style={[styles.statusContainer, statusContainer]}>
@@ -90,19 +90,21 @@ const areEqual = (
90
90
  prevProps: MessageStatusPropsWithContext,
91
91
  nextProps: MessageStatusPropsWithContext,
92
92
  ) => {
93
- const { message: prevMessage, threadList: prevThreadList } = prevProps;
94
- const { message: nextMessage, threadList: nextThreadList } = nextProps;
93
+ const { message: prevMessage, readBy: prevReadBy, threadList: prevThreadList } = prevProps;
94
+ const { message: nextMessage, readBy: nextReadBy, threadList: nextThreadList } = nextProps;
95
95
 
96
96
  const threadListEqual = prevThreadList === nextThreadList;
97
97
  if (!threadListEqual) {
98
98
  return false;
99
99
  }
100
100
 
101
+ const readByEqual = prevReadBy === nextReadBy;
102
+ if (!readByEqual) {
103
+ return false;
104
+ }
105
+
101
106
  const messageEqual =
102
- prevMessage.status === nextMessage.status &&
103
- prevMessage.type === nextMessage.type &&
104
- (isMessageWithStylesReadByAndDateSeparator(prevMessage) && prevMessage.readBy) ===
105
- (isMessageWithStylesReadByAndDateSeparator(nextMessage) && nextMessage.readBy);
107
+ prevMessage.status === nextMessage.status && prevMessage.type === nextMessage.type;
106
108
  if (!messageEqual) {
107
109
  return false;
108
110
  }
@@ -118,9 +120,9 @@ const MemoizedMessageStatus = React.memo(
118
120
  export type MessageStatusProps = Partial<MessageStatusPropsWithContext>;
119
121
 
120
122
  export const MessageStatus = (props: MessageStatusProps) => {
121
- const { message, threadList } = useMessageContext();
123
+ const { message, readBy, threadList } = useMessageContext();
122
124
 
123
- return <MemoizedMessageStatus {...{ message, threadList }} {...props} />;
125
+ return <MemoizedMessageStatus {...{ message, readBy, threadList }} {...props} />;
124
126
  };
125
127
 
126
128
  MessageStatus.displayName = 'MessageStatus{messageSimple{status}}';
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  import { StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
3
3
 
4
+ import { LocalMessage } from 'stream-chat';
5
+
4
6
  import { renderText, RenderTextParams } from './utils/renderText';
5
7
 
6
8
  import {
@@ -16,8 +18,6 @@ import { useTheme } from '../../../contexts/themeContext/ThemeContext';
16
18
  import type { MarkdownStyle, Theme } from '../../../contexts/themeContext/utils/theme';
17
19
  import { useTranslatedMessage } from '../../../hooks/useTranslatedMessage';
18
20
 
19
- import type { MessageType } from '../../MessageList/hooks/useMessageList';
20
-
21
21
  const styles = StyleSheet.create({
22
22
  textContainer: { maxWidth: 250, paddingHorizontal: 16 },
23
23
  });
@@ -71,7 +71,7 @@ const MessageTextContainerWithContext = (props: MessageTextContainerPropsWithCon
71
71
  },
72
72
  } = theme;
73
73
 
74
- const translatedMessage = useTranslatedMessage(message) as MessageType;
74
+ const translatedMessage = useTranslatedMessage(message) as LocalMessage;
75
75
 
76
76
  if (!message.text) {
77
77
  return null;
@@ -72,26 +72,32 @@ describe('MessageStatus', () => {
72
72
 
73
73
  it('should render message status with read by container', async () => {
74
74
  const user = generateUser();
75
- const message = generateMessage({ readBy: 2, user });
75
+ const message = generateMessage({ user });
76
+ const readBy = 2;
76
77
 
77
78
  const { getByTestId, getByText, rerender, toJSON } = renderMessageStatus({
78
79
  lastReceivedId: message.id,
79
80
  message,
81
+ readBy,
80
82
  });
81
83
 
82
84
  await waitFor(() => {
83
85
  expect(getByTestId('read-by-container')).toBeTruthy();
84
- expect(getByText((message.readBy - 1).toString())).toBeTruthy();
86
+ expect(getByText((readBy - 1).toString())).toBeTruthy();
85
87
  });
86
88
 
87
89
  const staticUser = generateStaticUser(0);
88
- const staticMessage = generateMessage({ readBy: 2, staticUser });
90
+ const staticMessage = generateMessage({ readBy, user: staticUser });
89
91
 
90
92
  rerender(
91
93
  <ChannelsStateProvider>
92
94
  <Chat client={chatClient} i18nInstance={i18nInstance}>
93
95
  <Channel channel={channel}>
94
- <MessageStatus lastReceivedId={staticMessage.id} message={staticMessage} />
96
+ <MessageStatus
97
+ lastReceivedId={staticMessage.id}
98
+ message={staticMessage}
99
+ readBy={readBy}
100
+ />
95
101
  </Channel>
96
102
  </Chat>
97
103
  </ChannelsStateProvider>,
@@ -100,7 +106,7 @@ describe('MessageStatus', () => {
100
106
  await waitFor(() => {
101
107
  expect(toJSON()).toMatchSnapshot();
102
108
  expect(getByTestId('read-by-container')).toBeTruthy();
103
- expect(getByText((staticMessage.readBy - 1).toString())).toBeTruthy();
109
+ expect(getByText((readBy - 1).toString())).toBeTruthy();
104
110
  });
105
111
  });
106
112
 
@@ -3,6 +3,8 @@ import { Text } from 'react-native';
3
3
 
4
4
  import { cleanup, render, waitFor } from '@testing-library/react-native';
5
5
 
6
+ import { LocalMessage } from 'stream-chat';
7
+
6
8
  import { OverlayProvider } from '../../../../contexts/overlayContext/OverlayProvider';
7
9
  import { ThemeProvider } from '../../../../contexts/themeContext/ThemeContext';
8
10
  import { defaultTheme } from '../../../../contexts/themeContext/utils/theme';
@@ -17,7 +19,6 @@ import { generateStaticUser } from '../../../../mock-builders/generator/user';
17
19
  import { getTestClientWithUser } from '../../../../mock-builders/mock';
18
20
  import { Channel } from '../../../Channel/Channel';
19
21
  import { Chat } from '../../../Chat/Chat';
20
- import type { MessageType } from '../../../MessageList/hooks/useMessageList';
21
22
  import { MessageList } from '../../../MessageList/MessageList';
22
23
  import { MessageTextContainer } from '../MessageTextContainer';
23
24
 
@@ -31,7 +32,7 @@ describe('MessageTextContainer', () => {
31
32
  });
32
33
  const { getByTestId, getByText, rerender, toJSON } = render(
33
34
  <ThemeProvider theme={defaultTheme}>
34
- <MessageTextContainer message={message as unknown as MessageType} />
35
+ <MessageTextContainer message={message as unknown as LocalMessage} />
35
36
  </ThemeProvider>,
36
37
  );
37
38
 
@@ -43,7 +44,7 @@ describe('MessageTextContainer', () => {
43
44
  rerender(
44
45
  <ThemeProvider theme={defaultTheme}>
45
46
  <MessageTextContainer
46
- message={message as unknown as MessageType}
47
+ message={message as unknown as LocalMessage}
47
48
  MessageText={({ message }) => <Text testID='message-text'>{message?.text}</Text>}
48
49
  />
49
50
  </ThemeProvider>,
@@ -61,7 +62,7 @@ describe('MessageTextContainer', () => {
61
62
 
62
63
  rerender(
63
64
  <ThemeProvider theme={defaultTheme}>
64
- <MessageTextContainer message={staticMessage as unknown as MessageType} />
65
+ <MessageTextContainer message={staticMessage as unknown as LocalMessage} />
65
66
  </ThemeProvider>,
66
67
  );
67
68
 
@@ -26,7 +26,7 @@ import {
26
26
  State,
27
27
  } from 'simple-markdown';
28
28
 
29
- import type { UserResponse } from 'stream-chat';
29
+ import type { LocalMessage, UserResponse } from 'stream-chat';
30
30
 
31
31
  import { generateMarkdownText } from './generateMarkdownText';
32
32
 
@@ -34,7 +34,6 @@ import type { MessageContextValue } from '../../../../contexts/messageContext/Me
34
34
  import type { Colors, MarkdownStyle } from '../../../../contexts/themeContext/utils/theme';
35
35
 
36
36
  import { escapeRegExp } from '../../../../utils/utils';
37
- import type { MessageType } from '../../../MessageList/hooks/useMessageList';
38
37
 
39
38
  type ReactNodeOutput = NodeOutput<React.ReactNode>;
40
39
  type ReactOutput = Output<React.ReactNode>;
@@ -162,7 +161,7 @@ export type RenderTextParams = Partial<
162
161
  Pick<MessageContextValue, 'onLongPress' | 'onPress' | 'preventPress'>
163
162
  > & {
164
163
  colors: typeof Colors;
165
- message: MessageType;
164
+ message: LocalMessage;
166
165
  markdownRules?: MarkdownRules;
167
166
  markdownStyles?: MarkdownStyle;
168
167
  messageOverlay?: boolean;
@@ -34,6 +34,7 @@ export const useCreateMessageContext = ({
34
34
  otherAttachments,
35
35
  preventPress,
36
36
  reactions,
37
+ readBy,
37
38
  setIsEditedMessageOpen,
38
39
  showAvatar,
39
40
  showMessageOverlay,
@@ -81,6 +82,7 @@ export const useCreateMessageContext = ({
81
82
  otherAttachments,
82
83
  preventPress,
83
84
  reactions,
85
+ readBy,
84
86
  setIsEditedMessageOpen,
85
87
  showAvatar,
86
88
  showMessageOverlay,
@@ -103,6 +105,7 @@ export const useCreateMessageContext = ({
103
105
  stringifiedMessage,
104
106
  myMessageThemeString,
105
107
  reactionsValue,
108
+ readBy,
106
109
  showAvatar,
107
110
  showMessageStatus,
108
111
  threadList,