stream-chat-react-native-core 7.0.0-rc.9 → 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 (315) hide show
  1. package/README.md +1 -1
  2. package/lib/commonjs/components/Attachment/Gallery.js +16 -3
  3. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  4. package/lib/commonjs/components/Attachment/ImageReloadIndicator.js.map +1 -1
  5. package/lib/commonjs/components/Channel/Channel.js +8 -5
  6. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useChannelDataState.js.map +1 -1
  8. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  9. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  10. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  11. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
  12. package/lib/commonjs/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  13. package/lib/commonjs/components/Message/Message.js +12 -6
  14. package/lib/commonjs/components/Message/Message.js.map +1 -1
  15. package/lib/commonjs/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  16. package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js +14 -6
  17. package/lib/commonjs/components/Message/MessageSimple/MessageStatus.js.map +1 -1
  18. package/lib/commonjs/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  19. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  20. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
  21. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  22. package/lib/commonjs/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
  23. package/lib/commonjs/components/Message/hooks/useMessageActions.js.map +1 -1
  24. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
  25. package/lib/commonjs/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
  26. package/lib/commonjs/components/MessageList/MessageList.js +9 -7
  27. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  28. package/lib/commonjs/components/MessageList/hooks/useMessageList.js +18 -24
  29. package/lib/commonjs/components/MessageList/hooks/useMessageList.js.map +1 -1
  30. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js +1 -1
  31. package/lib/commonjs/components/MessageList/utils/getGroupStyles.js.map +1 -1
  32. package/lib/commonjs/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
  33. package/lib/commonjs/components/MessageList/utils/getReadState.js +20 -0
  34. package/lib/commonjs/components/MessageList/utils/getReadState.js.map +1 -0
  35. package/lib/commonjs/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  36. package/lib/commonjs/components/Poll/components/Button.js.map +1 -1
  37. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  38. package/lib/commonjs/components/Reply/Reply.js +2 -2
  39. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  40. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +1 -0
  41. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  42. package/lib/commonjs/components/ThreadList/ThreadListItem.js.map +1 -1
  43. package/lib/commonjs/components/index.js +15 -4
  44. package/lib/commonjs/components/index.js.map +1 -1
  45. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js +5 -1
  46. package/lib/commonjs/contexts/channelsStateContext/useChannelState.js.map +1 -1
  47. package/lib/commonjs/contexts/debugContext/DebugContext.js.map +1 -1
  48. package/lib/commonjs/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  49. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  50. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  51. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  52. package/lib/commonjs/contexts/pollContext/pollContext.js.map +1 -1
  53. package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
  54. package/lib/commonjs/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
  55. package/lib/commonjs/hooks/index.js +11 -0
  56. package/lib/commonjs/hooks/index.js.map +1 -1
  57. package/lib/commonjs/i18n/en.json +3 -0
  58. package/lib/commonjs/i18n/es.json +3 -0
  59. package/lib/commonjs/i18n/fr.json +3 -0
  60. package/lib/commonjs/i18n/he.json +3 -0
  61. package/lib/commonjs/i18n/hi.json +2 -0
  62. package/lib/commonjs/i18n/it.json +3 -0
  63. package/lib/commonjs/i18n/ja.json +1 -0
  64. package/lib/commonjs/i18n/ko.json +1 -0
  65. package/lib/commonjs/i18n/nl.json +2 -0
  66. package/lib/commonjs/i18n/pt-br.json +3 -0
  67. package/lib/commonjs/i18n/ru.json +4 -0
  68. package/lib/commonjs/i18n/tr.json +2 -0
  69. package/lib/commonjs/utils/removeReservedFields.js.map +1 -1
  70. package/lib/commonjs/utils/utils.js +1 -3
  71. package/lib/commonjs/utils/utils.js.map +1 -1
  72. package/lib/commonjs/version.json +1 -1
  73. package/lib/module/components/Attachment/Gallery.js +16 -3
  74. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  75. package/lib/module/components/Attachment/ImageReloadIndicator.js.map +1 -1
  76. package/lib/module/components/Channel/Channel.js +8 -5
  77. package/lib/module/components/Channel/Channel.js.map +1 -1
  78. package/lib/module/components/Channel/hooks/useChannelDataState.js.map +1 -1
  79. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +2 -0
  80. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  81. package/lib/module/components/Chat/Chat.js.map +1 -1
  82. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js +1 -1
  83. package/lib/module/components/KeyboardCompatibleView/KeyboardCompatibleView.js.map +1 -1
  84. package/lib/module/components/Message/Message.js +12 -6
  85. package/lib/module/components/Message/Message.js.map +1 -1
  86. package/lib/module/components/Message/MessageSimple/MessageFooter.js.map +1 -1
  87. package/lib/module/components/Message/MessageSimple/MessageStatus.js +14 -6
  88. package/lib/module/components/Message/MessageSimple/MessageStatus.js.map +1 -1
  89. package/lib/module/components/Message/MessageSimple/MessageTextContainer.js.map +1 -1
  90. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  91. package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
  92. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  93. package/lib/module/components/Message/hooks/useMessageActionHandlers.js.map +1 -1
  94. package/lib/module/components/Message/hooks/useMessageActions.js.map +1 -1
  95. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js +2 -1
  96. package/lib/module/components/MessageInput/components/AudioRecorder/AudioRecordingButton.js.map +1 -1
  97. package/lib/module/components/MessageList/MessageList.js +9 -7
  98. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  99. package/lib/module/components/MessageList/hooks/useMessageList.js +18 -24
  100. package/lib/module/components/MessageList/hooks/useMessageList.js.map +1 -1
  101. package/lib/module/components/MessageList/utils/getGroupStyles.js +1 -1
  102. package/lib/module/components/MessageList/utils/getGroupStyles.js.map +1 -1
  103. package/lib/module/components/MessageList/utils/getLastReceivedMessage.js.map +1 -1
  104. package/lib/module/components/MessageList/utils/getReadState.js +20 -0
  105. package/lib/module/components/MessageList/utils/getReadState.js.map +1 -0
  106. package/lib/module/components/MessageMenu/hooks/useFetchReactions.js.map +1 -1
  107. package/lib/module/components/Poll/components/Button.js.map +1 -1
  108. package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -1
  109. package/lib/module/components/Reply/Reply.js +2 -2
  110. package/lib/module/components/Reply/Reply.js.map +1 -1
  111. package/lib/module/components/Thread/components/ThreadFooterComponent.js +1 -0
  112. package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  113. package/lib/module/components/ThreadList/ThreadListItem.js.map +1 -1
  114. package/lib/module/components/index.js +15 -4
  115. package/lib/module/components/index.js.map +1 -1
  116. package/lib/module/contexts/channelsStateContext/useChannelState.js +5 -1
  117. package/lib/module/contexts/channelsStateContext/useChannelState.js.map +1 -1
  118. package/lib/module/contexts/debugContext/DebugContext.js.map +1 -1
  119. package/lib/module/contexts/imageGalleryContext/ImageGalleryContext.js.map +1 -1
  120. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  121. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  122. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  123. package/lib/module/contexts/pollContext/pollContext.js.map +1 -1
  124. package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
  125. package/lib/module/contexts/threadsContext/ThreadListItemContext.js.map +1 -1
  126. package/lib/module/hooks/index.js +11 -0
  127. package/lib/module/hooks/index.js.map +1 -1
  128. package/lib/module/i18n/en.json +3 -0
  129. package/lib/module/i18n/es.json +3 -0
  130. package/lib/module/i18n/fr.json +3 -0
  131. package/lib/module/i18n/he.json +3 -0
  132. package/lib/module/i18n/hi.json +2 -0
  133. package/lib/module/i18n/it.json +3 -0
  134. package/lib/module/i18n/ja.json +1 -0
  135. package/lib/module/i18n/ko.json +1 -0
  136. package/lib/module/i18n/nl.json +2 -0
  137. package/lib/module/i18n/pt-br.json +3 -0
  138. package/lib/module/i18n/ru.json +4 -0
  139. package/lib/module/i18n/tr.json +2 -0
  140. package/lib/module/utils/removeReservedFields.js.map +1 -1
  141. package/lib/module/utils/utils.js +1 -3
  142. package/lib/module/utils/utils.js.map +1 -1
  143. package/lib/module/version.json +1 -1
  144. package/lib/typescript/components/Attachment/Gallery.d.ts +3 -3
  145. package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
  146. package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts +4 -3
  147. package/lib/typescript/components/Attachment/ImageReloadIndicator.d.ts.map +1 -1
  148. package/lib/typescript/components/Channel/Channel.d.ts +3 -4
  149. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  150. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts +2 -3
  151. package/lib/typescript/components/Channel/hooks/useChannelDataState.d.ts.map +1 -1
  152. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  153. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  154. package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts +4 -4
  155. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewData.d.ts +1 -1
  156. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
  157. package/lib/typescript/components/Chat/Chat.d.ts +0 -9
  158. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  159. package/lib/typescript/components/KeyboardCompatibleView/KeyboardCompatibleView.d.ts.map +1 -1
  160. package/lib/typescript/components/Message/Message.d.ts +4 -5
  161. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  162. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts +2 -3
  163. package/lib/typescript/components/Message/MessageSimple/MessageFooter.d.ts.map +1 -1
  164. package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts +1 -1
  165. package/lib/typescript/components/Message/MessageSimple/MessageStatus.d.ts.map +1 -1
  166. package/lib/typescript/components/Message/MessageSimple/MessageTextContainer.d.ts.map +1 -1
  167. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts +2 -2
  168. package/lib/typescript/components/Message/MessageSimple/utils/renderText.d.ts.map +1 -1
  169. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  170. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  171. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts.map +1 -1
  172. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +2 -2
  173. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts.map +1 -1
  174. package/lib/typescript/components/MessageList/MessageList.d.ts +3 -3
  175. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  176. package/lib/typescript/components/MessageList/MessageSystem.d.ts +2 -2
  177. package/lib/typescript/components/MessageList/MessageSystem.d.ts.map +1 -1
  178. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts +11 -10
  179. package/lib/typescript/components/MessageList/hooks/useMessageList.d.ts.map +1 -1
  180. package/lib/typescript/components/MessageList/utils/getGroupStyles.d.ts.map +1 -1
  181. package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts +2 -2
  182. package/lib/typescript/components/MessageList/utils/getLastReceivedMessage.d.ts.map +1 -1
  183. package/lib/typescript/components/MessageList/utils/getReadState.d.ts +9 -0
  184. package/lib/typescript/components/MessageList/utils/getReadState.d.ts.map +1 -0
  185. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts +2 -3
  186. package/lib/typescript/components/MessageMenu/hooks/useFetchReactions.d.ts.map +1 -1
  187. package/lib/typescript/components/Poll/components/Button.d.ts +2 -3
  188. package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -1
  189. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +2 -3
  190. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -1
  191. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  192. package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts.map +1 -1
  193. package/lib/typescript/components/ThreadList/ThreadListItem.d.ts.map +1 -1
  194. package/lib/typescript/components/index.d.ts +2 -1
  195. package/lib/typescript/components/index.d.ts.map +1 -1
  196. package/lib/typescript/contexts/channelsStateContext/useChannelState.d.ts.map +1 -1
  197. package/lib/typescript/contexts/debugContext/DebugContext.d.ts +2 -3
  198. package/lib/typescript/contexts/debugContext/DebugContext.d.ts.map +1 -1
  199. package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts +3 -3
  200. package/lib/typescript/contexts/imageGalleryContext/ImageGalleryContext.d.ts.map +1 -1
  201. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +6 -4
  202. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  203. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +4 -5
  204. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  205. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +24 -20
  206. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  207. package/lib/typescript/contexts/pollContext/pollContext.d.ts +2 -3
  208. package/lib/typescript/contexts/pollContext/pollContext.d.ts.map +1 -1
  209. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts +4 -5
  210. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
  211. package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts +3 -4
  212. package/lib/typescript/contexts/threadsContext/ThreadListItemContext.d.ts.map +1 -1
  213. package/lib/typescript/hooks/index.d.ts +1 -0
  214. package/lib/typescript/hooks/index.d.ts.map +1 -1
  215. package/lib/typescript/hooks/useTranslatedMessage.d.ts +55 -55
  216. package/lib/typescript/hooks/useTranslatedMessage.d.ts.map +1 -1
  217. package/lib/typescript/i18n/en.json +3 -0
  218. package/lib/typescript/i18n/es.json +3 -0
  219. package/lib/typescript/i18n/fr.json +3 -0
  220. package/lib/typescript/i18n/he.json +3 -0
  221. package/lib/typescript/i18n/hi.json +2 -0
  222. package/lib/typescript/i18n/it.json +3 -0
  223. package/lib/typescript/i18n/ja.json +1 -0
  224. package/lib/typescript/i18n/ko.json +1 -0
  225. package/lib/typescript/i18n/nl.json +2 -0
  226. package/lib/typescript/i18n/pt-br.json +3 -0
  227. package/lib/typescript/i18n/ru.json +4 -0
  228. package/lib/typescript/i18n/tr.json +2 -0
  229. package/lib/typescript/utils/i18n/Streami18n.d.ts +3 -0
  230. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  231. package/lib/typescript/utils/removeReservedFields.d.ts +2 -3
  232. package/lib/typescript/utils/removeReservedFields.d.ts.map +1 -1
  233. package/lib/typescript/utils/utils.d.ts +5 -6
  234. package/lib/typescript/utils/utils.d.ts.map +1 -1
  235. package/package.json +2 -2
  236. package/src/components/Attachment/Gallery.tsx +22 -7
  237. package/src/components/Attachment/ImageReloadIndicator.tsx +4 -5
  238. package/src/components/Channel/Channel.tsx +12 -9
  239. package/src/components/Channel/__tests__/Channel.test.js +2 -0
  240. package/src/components/Channel/hooks/useChannelDataState.ts +2 -4
  241. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  242. package/src/components/Chat/Chat.tsx +0 -9
  243. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +8 -7
  244. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +5 -4
  245. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +5 -4
  246. package/src/components/ImageGallery/__tests__/ImageGalleryOverlay.test.tsx +3 -2
  247. package/src/components/KeyboardCompatibleView/KeyboardCompatibleView.tsx +6 -1
  248. package/src/components/Message/Message.tsx +10 -13
  249. package/src/components/Message/MessageSimple/MessageFooter.tsx +2 -3
  250. package/src/components/Message/MessageSimple/MessageStatus.tsx +19 -17
  251. package/src/components/Message/MessageSimple/MessageTextContainer.tsx +3 -3
  252. package/src/components/Message/MessageSimple/__tests__/MessageStatus.test.js +11 -5
  253. package/src/components/Message/MessageSimple/__tests__/MessageTextContainer.test.tsx +5 -4
  254. package/src/components/Message/MessageSimple/utils/renderText.tsx +2 -3
  255. package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
  256. package/src/components/Message/hooks/useMessageActionHandlers.ts +1 -3
  257. package/src/components/Message/hooks/useMessageActions.tsx +4 -3
  258. package/src/components/MessageInput/components/AudioRecorder/AudioRecordingButton.tsx +1 -0
  259. package/src/components/MessageList/MessageList.tsx +24 -25
  260. package/src/components/MessageList/MessageSystem.tsx +2 -2
  261. package/src/components/MessageList/hooks/useMessageList.ts +48 -59
  262. package/src/components/MessageList/utils/getGroupStyles.ts +7 -5
  263. package/src/components/MessageList/utils/getLastReceivedMessage.ts +3 -3
  264. package/src/components/MessageList/utils/getReadState.ts +27 -0
  265. package/src/components/MessageMenu/__tests__/MessageUserReactions.test.tsx +2 -3
  266. package/src/components/MessageMenu/hooks/useFetchReactions.ts +2 -3
  267. package/src/components/Poll/components/Button.tsx +2 -4
  268. package/src/components/Poll/components/PollResults/PollResultItem.tsx +2 -3
  269. package/src/components/Reply/Reply.tsx +1 -2
  270. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +0 -15
  271. package/src/components/Thread/components/ThreadFooterComponent.tsx +1 -0
  272. package/src/components/ThreadList/ThreadListItem.tsx +6 -4
  273. package/src/components/index.ts +2 -1
  274. package/src/contexts/channelsStateContext/useChannelState.ts +5 -1
  275. package/src/contexts/debugContext/DebugContext.tsx +2 -4
  276. package/src/contexts/imageGalleryContext/ImageGalleryContext.tsx +5 -4
  277. package/src/contexts/messageContext/MessageContext.tsx +6 -4
  278. package/src/contexts/messageInputContext/MessageInputContext.tsx +5 -5
  279. package/src/contexts/messageInputContext/__tests__/sendMessage.test.tsx +6 -5
  280. package/src/contexts/messageInputContext/__tests__/updateMessage.test.tsx +3 -5
  281. package/src/contexts/messageInputContext/__tests__/useMessageDetailsForState.test.tsx +14 -9
  282. package/src/contexts/messagesContext/MessagesContext.tsx +25 -20
  283. package/src/contexts/pollContext/pollContext.tsx +2 -4
  284. package/src/contexts/threadContext/ThreadContext.tsx +4 -6
  285. package/src/contexts/threadsContext/ThreadListItemContext.tsx +3 -5
  286. package/src/hooks/index.ts +1 -0
  287. package/src/i18n/en.json +3 -0
  288. package/src/i18n/es.json +3 -0
  289. package/src/i18n/fr.json +3 -0
  290. package/src/i18n/he.json +3 -0
  291. package/src/i18n/hi.json +2 -0
  292. package/src/i18n/it.json +3 -0
  293. package/src/i18n/ja.json +1 -0
  294. package/src/i18n/ko.json +1 -0
  295. package/src/i18n/nl.json +2 -0
  296. package/src/i18n/pt-br.json +3 -0
  297. package/src/i18n/ru.json +4 -0
  298. package/src/i18n/tr.json +2 -0
  299. package/src/utils/removeReservedFields.ts +3 -5
  300. package/src/utils/utils.ts +5 -10
  301. package/src/version.json +1 -1
  302. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js +0 -20
  303. package/lib/commonjs/components/MessageList/hooks/useLastReadData.js.map +0 -1
  304. package/lib/commonjs/components/MessageList/utils/getReadStates.js +0 -34
  305. package/lib/commonjs/components/MessageList/utils/getReadStates.js.map +0 -1
  306. package/lib/module/components/MessageList/hooks/useLastReadData.js +0 -20
  307. package/lib/module/components/MessageList/hooks/useLastReadData.js.map +0 -1
  308. package/lib/module/components/MessageList/utils/getReadStates.js +0 -34
  309. package/lib/module/components/MessageList/utils/getReadStates.js.map +0 -1
  310. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts +0 -12
  311. package/lib/typescript/components/MessageList/hooks/useLastReadData.d.ts.map +0 -1
  312. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts +0 -5
  313. package/lib/typescript/components/MessageList/utils/getReadStates.d.ts.map +0 -1
  314. package/src/components/MessageList/hooks/useLastReadData.ts +0 -29
  315. package/src/components/MessageList/utils/getReadStates.ts +0 -55
@@ -12,11 +12,7 @@ import {
12
12
 
13
13
  import type { Channel, Event, LocalMessage, MessageResponse } from 'stream-chat';
14
14
 
15
- import {
16
- isMessageWithStylesReadByAndDateSeparator,
17
- MessageType,
18
- useMessageList,
19
- } from './hooks/useMessageList';
15
+ import { useMessageList } from './hooks/useMessageList';
20
16
  import { useShouldScrollToRecentOnNewOwnMessage } from './hooks/useShouldScrollToRecentOnNewOwnMessage';
21
17
 
22
18
  import { InlineLoadingMoreIndicator } from './InlineLoadingMoreIndicator';
@@ -91,7 +87,7 @@ const styles = StyleSheet.create({
91
87
  },
92
88
  });
93
89
 
94
- const keyExtractor = (item: MessageType) => {
90
+ const keyExtractor = (item: LocalMessage) => {
95
91
  if (item.id) {
96
92
  return item.id;
97
93
  }
@@ -111,7 +107,7 @@ const hasReadLastMessage = (channel: Channel, userId: string) => {
111
107
  return latestMessageIdInChannel === lastReadMessageIdServer;
112
108
  };
113
109
 
114
- const getPreviousLastMessage = (messages: MessageType[], newMessage?: MessageResponse) => {
110
+ const getPreviousLastMessage = (messages: LocalMessage[], newMessage?: MessageResponse) => {
115
111
  if (!newMessage) return;
116
112
  let previousLastMessage;
117
113
  for (let i = messages.length - 1; i >= 0; i--) {
@@ -189,7 +185,7 @@ type MessageListPropsWithContext = Pick<
189
185
  * additionalFlatListProps={{ bounces: true, keyboardDismissMode: true }} />
190
186
  * ```
191
187
  */
192
- additionalFlatListProps?: Partial<FlatListProps<MessageType>>;
188
+ additionalFlatListProps?: Partial<FlatListProps<LocalMessage>>;
193
189
  /**
194
190
  * UI component for footer of message list. By default message list will use `InlineLoadingMoreIndicator`
195
191
  * as FooterComponent. If you want to implement your own inline loading indicator, you can access `loadingMore`
@@ -231,7 +227,7 @@ type MessageListPropsWithContext = Pick<
231
227
  * }}
232
228
  * ```
233
229
  */
234
- setFlatListRef?: (ref: FlatListType<MessageType> | null) => void;
230
+ setFlatListRef?: (ref: FlatListType<LocalMessage> | null) => void;
235
231
  };
236
232
 
237
233
  /**
@@ -322,10 +318,11 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
322
318
  * NOTE: rawMessageList changes only when messages array state changes
323
319
  * processedMessageList changes on any state change
324
320
  */
325
- const { processedMessageList, rawMessageList } = useMessageList({
326
- noGroupByUser,
327
- threadList,
328
- });
321
+ const { dateSeparatorsRef, messageGroupStylesRef, processedMessageList, rawMessageList } =
322
+ useMessageList({
323
+ noGroupByUser,
324
+ threadList,
325
+ });
329
326
  const messageListLengthBeforeUpdate = useRef(0);
330
327
  const messageListLengthAfterUpdate = processedMessageList.length;
331
328
 
@@ -362,7 +359,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
362
359
  const onStartReachedInPromise = useRef<Promise<void> | null>(null);
363
360
  const onEndReachedInPromise = useRef<Promise<void> | null>(null);
364
361
 
365
- const flatListRef = useRef<FlatListType<MessageType> | null>(null);
362
+ const flatListRef = useRef<FlatListType<LocalMessage> | null>(null);
366
363
 
367
364
  const channelResyncScrollSet = useRef<boolean>(true);
368
365
 
@@ -496,7 +493,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
496
493
  const onViewableItemsChanged = useRef(unstableOnViewableItemsChanged);
497
494
  onViewableItemsChanged.current = unstableOnViewableItemsChanged;
498
495
 
499
- const stableOnViwableItemsChanged = useCallback(
496
+ const stableOnViewableItemsChanged = useCallback(
500
497
  ({ viewableItems }: { viewableItems: ViewToken[] | undefined }) => {
501
498
  onViewableItemsChanged.current({ viewableItems });
502
499
  },
@@ -735,7 +732,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
735
732
  const shouldApplyAndroidWorkaround = inverted && Platform.OS === 'android';
736
733
 
737
734
  const renderItem = useCallback(
738
- ({ index, item: message }: { index: number; item: MessageType }) => {
735
+ ({ index, item: message }: { index: number; item: LocalMessage }) => {
739
736
  if (!channel || channel.disconnected || (!channel.initialized && !channel.offlineMode)) {
740
737
  return null;
741
738
  }
@@ -756,14 +753,14 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
756
753
  const showUnreadUnderlay = !!shouldShowUnreadUnderlay && showUnreadSeparator;
757
754
 
758
755
  const wrapMessageInTheme = client.userID === message.user?.id && !!myMessageTheme;
759
- const renderDateSeperator = isMessageWithStylesReadByAndDateSeparator(message) &&
760
- message.dateSeparator && <InlineDateSeparator date={message.dateSeparator} />;
756
+ const renderDateSeperator = dateSeparatorsRef.current[message.id] && (
757
+ <InlineDateSeparator date={dateSeparatorsRef.current[message.id]} />
758
+ );
759
+
761
760
  const renderMessage = (
762
761
  <Message
763
762
  goToMessage={goToMessage}
764
- groupStyles={
765
- isMessageWithStylesReadByAndDateSeparator(message) ? message.groupStyles : []
766
- }
763
+ groupStyles={messageGroupStylesRef.current[message.id] ?? []}
767
764
  isTargetedMessage={highlightedMessageId === message.id}
768
765
  lastReceivedId={
769
766
  lastReceivedId === message.id || message.quoted_message_id ? lastReceivedId : undefined
@@ -814,10 +811,12 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
814
811
  channelUnreadState?.last_read_message_id,
815
812
  channelUnreadState?.unread_messages,
816
813
  client.userID,
814
+ dateSeparatorsRef,
817
815
  goToMessage,
818
816
  highlightedMessageId,
819
817
  lastReceivedId,
820
818
  messageContainer,
819
+ messageGroupStylesRef,
821
820
  modifiedTheme,
822
821
  myMessageTheme,
823
822
  onThreadSelect,
@@ -998,7 +997,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
998
997
 
999
998
  const scrollToIndexFailedRetryCountRef = useRef<number>(0);
1000
999
  const failScrollTimeoutId = useRef<ReturnType<typeof setTimeout>>(undefined);
1001
- const onScrollToIndexFailedRef = useRef<FlatListProps<MessageType>['onScrollToIndexFailed']>(
1000
+ const onScrollToIndexFailedRef = useRef<FlatListProps<LocalMessage>['onScrollToIndexFailed']>(
1002
1001
  (info) => {
1003
1002
  // We got a failure as we tried to scroll to an item that was outside the render length
1004
1003
  if (!flatListRef.current) {
@@ -1083,7 +1082,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
1083
1082
  isListActive &&
1084
1083
  ((threadList && thread) || (!threadList && !thread))
1085
1084
  ) {
1086
- setMessages(messagesWithImages as MessageType[]);
1085
+ setMessages(messagesWithImages as LocalMessage[]);
1087
1086
  }
1088
1087
  // eslint-disable-next-line react-hooks/exhaustive-deps
1089
1088
  }, [
@@ -1112,7 +1111,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
1112
1111
  onUserScrollEvent(event);
1113
1112
  });
1114
1113
 
1115
- const refCallback = useStableCallback((ref: FlatListType<MessageType>) => {
1114
+ const refCallback = useStableCallback((ref: FlatListType<LocalMessage>) => {
1116
1115
  flatListRef.current = ref;
1117
1116
 
1118
1117
  if (setFlatListRef) {
@@ -1251,7 +1250,7 @@ const MessageListWithContext = (props: MessageListPropsWithContext) => {
1251
1250
  onScrollEndDrag={onScrollEndDrag}
1252
1251
  onScrollToIndexFailed={onScrollToIndexFailedRef.current}
1253
1252
  onTouchEnd={dismissImagePicker}
1254
- onViewableItemsChanged={stableOnViwableItemsChanged}
1253
+ onViewableItemsChanged={stableOnViewableItemsChanged}
1255
1254
  ref={refCallback}
1256
1255
  renderItem={renderItem}
1257
1256
  scrollEnabled={overlay === 'none'}
@@ -1,7 +1,7 @@
1
1
  import React, { useMemo } from 'react';
2
2
  import { StyleProp, StyleSheet, Text, View, ViewStyle } from 'react-native';
3
3
 
4
- import type { MessageType } from './hooks/useMessageList';
4
+ import { LocalMessage } from 'stream-chat';
5
5
 
6
6
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
7
7
  import { useTranslationContext } from '../../contexts/translationContext/TranslationContext';
@@ -10,7 +10,7 @@ import { getDateString } from '../../utils/i18n/getDateString';
10
10
 
11
11
  export type MessageSystemProps = {
12
12
  /** Current [message object](https://getstream.io/chat/docs/#message_format) */
13
- message: MessageType;
13
+ message: LocalMessage;
14
14
  /**
15
15
  * Additional styles for the system message container.
16
16
  */
@@ -1,8 +1,6 @@
1
- import { useMemo } from 'react';
1
+ import { useMemo, useRef } from 'react';
2
2
 
3
- import type { ChannelState, MessageResponse } from 'stream-chat';
4
-
5
- import { useLastReadData } from './useLastReadData';
3
+ import type { LocalMessage } from 'stream-chat';
6
4
 
7
5
  import { useChannelContext } from '../../../contexts/channelContext/ChannelContext';
8
6
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
@@ -13,7 +11,7 @@ import {
13
11
  import { usePaginatedMessageListContext } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';
14
12
  import { useThreadContext } from '../../../contexts/threadContext/ThreadContext';
15
13
 
16
- import { getDateSeparators } from '../utils/getDateSeparators';
14
+ import { DateSeparators, getDateSeparators } from '../utils/getDateSeparators';
17
15
  import { getGroupStyles } from '../utils/getGroupStyles';
18
16
 
19
17
  export type UseMessageListParams = {
@@ -24,24 +22,12 @@ export type UseMessageListParams = {
24
22
 
25
23
  export type GroupType = string;
26
24
 
27
- export type MessagesWithStylesReadByAndDateSeparator = MessageResponse & {
28
- groupStyles: GroupType[];
29
- readBy: boolean | number;
30
- dateSeparator?: Date;
25
+ export type MessageGroupStyles = {
26
+ [key: string]: string[];
31
27
  };
32
28
 
33
- export type MessageType =
34
- | ReturnType<ChannelState['formatMessage']>
35
- | MessagesWithStylesReadByAndDateSeparator;
36
-
37
- // Type guards to check MessageType
38
- export const isMessageWithStylesReadByAndDateSeparator = (
39
- message: MessageType,
40
- ): message is MessagesWithStylesReadByAndDateSeparator =>
41
- (message as MessagesWithStylesReadByAndDateSeparator).readBy !== undefined;
42
-
43
29
  export const shouldIncludeMessageInList = (
44
- message: MessageType,
30
+ message: LocalMessage,
45
31
  options: { deletedMessagesVisibilityType?: DeletedMessagesVisibilityType; userId?: string },
46
32
  ) => {
47
33
  const { deletedMessagesVisibilityType, userId } = options;
@@ -64,38 +50,52 @@ export const shouldIncludeMessageInList = (
64
50
  export const useMessageList = (params: UseMessageListParams) => {
65
51
  const { noGroupByUser, threadList } = params;
66
52
  const { client } = useChatContext();
67
- const { hideDateSeparators, maxTimeBetweenGroupedMessages, read } = useChannelContext();
53
+ const { hideDateSeparators, maxTimeBetweenGroupedMessages } = useChannelContext();
68
54
  const { deletedMessagesVisibilityType, getMessagesGroupStyles = getGroupStyles } =
69
55
  useMessagesContext();
70
56
  const { messages } = usePaginatedMessageListContext();
71
57
  const { threadMessages } = useThreadContext();
72
-
73
58
  const messageList = threadList ? threadMessages : messages;
74
- const readList: ChannelState['read'] | undefined = threadList ? undefined : read;
75
59
 
76
- const readData = useLastReadData({
77
- messages: messageList,
78
- read: readList,
79
- userID: client.userID,
80
- });
81
-
82
- const processedMessageList = useMemo<MessageType[]>(() => {
83
- const dateSeparators = getDateSeparators({
84
- deletedMessagesVisibilityType,
85
- hideDateSeparators,
86
- messages: messageList,
87
- userId: client.userID,
88
- });
89
-
90
- const messageGroupStyles = getMessagesGroupStyles({
91
- dateSeparators,
60
+ const dateSeparators = useMemo(
61
+ () =>
62
+ getDateSeparators({
63
+ deletedMessagesVisibilityType,
64
+ hideDateSeparators,
65
+ messages: messageList,
66
+ userId: client.userID,
67
+ }),
68
+ [deletedMessagesVisibilityType, hideDateSeparators, messageList, client.userID],
69
+ );
70
+
71
+ const dateSeparatorsRef = useRef<DateSeparators>(dateSeparators);
72
+ dateSeparatorsRef.current = dateSeparators;
73
+
74
+ const messageGroupStyles = useMemo(
75
+ () =>
76
+ getMessagesGroupStyles({
77
+ dateSeparators: dateSeparatorsRef.current,
78
+ hideDateSeparators,
79
+ maxTimeBetweenGroupedMessages,
80
+ messages: messageList,
81
+ noGroupByUser,
82
+ userId: client.userID,
83
+ }),
84
+ [
85
+ dateSeparatorsRef,
86
+ getMessagesGroupStyles,
92
87
  hideDateSeparators,
93
88
  maxTimeBetweenGroupedMessages,
94
- messages: messageList,
89
+ messageList,
95
90
  noGroupByUser,
96
- userId: client.userID,
97
- });
91
+ client.userID,
92
+ ],
93
+ );
94
+
95
+ const messageGroupStylesRef = useRef<MessageGroupStyles>(messageGroupStyles);
96
+ messageGroupStylesRef.current = messageGroupStyles;
98
97
 
98
+ const processedMessageList = useMemo<LocalMessage[]>(() => {
99
99
  const newMessageList = [];
100
100
  for (const message of messageList) {
101
101
  if (
@@ -104,28 +104,17 @@ export const useMessageList = (params: UseMessageListParams) => {
104
104
  userId: client.userID,
105
105
  })
106
106
  ) {
107
- const messageId = message.id;
108
- newMessageList.unshift({
109
- ...message,
110
- dateSeparator: dateSeparators[messageId] || undefined,
111
- groupStyles: messageGroupStyles[messageId] || ['single'],
112
- readBy: messageId ? readData[messageId] || false : false,
113
- });
107
+ newMessageList.unshift(message);
114
108
  }
115
109
  }
116
110
  return newMessageList;
117
- }, [
118
- client.userID,
119
- deletedMessagesVisibilityType,
120
- getMessagesGroupStyles,
121
- hideDateSeparators,
122
- maxTimeBetweenGroupedMessages,
123
- messageList,
124
- noGroupByUser,
125
- readData,
126
- ]);
111
+ }, [client.userID, deletedMessagesVisibilityType, messageList]);
127
112
 
128
113
  return {
114
+ /** Date separators */
115
+ dateSeparatorsRef,
116
+ /** Message group styles */
117
+ messageGroupStylesRef,
129
118
  /** Messages enriched with dates/readby/groups and also reversed in order */
130
119
  processedMessageList,
131
120
  /** Raw messages from the channel state */
@@ -1,10 +1,12 @@
1
+ import { LocalMessage } from 'stream-chat';
2
+
1
3
  import type { DateSeparators } from './getDateSeparators';
2
4
 
3
5
  import type { PaginatedMessageListContextValue } from '../../../contexts/paginatedMessageListContext/PaginatedMessageListContext';
4
6
  import type { ThreadContextValue } from '../../../contexts/threadContext/ThreadContext';
5
7
 
6
8
  import { isEditedMessage } from '../../../utils/utils';
7
- import type { GroupType, MessageType } from '../hooks/useMessageList';
9
+ import type { GroupType } from '../hooks/useMessageList';
8
10
 
9
11
  export type GetGroupStylesParams = {
10
12
  dateSeparators: DateSeparators;
@@ -19,9 +21,9 @@ export type GroupStyle = '' | 'middle' | 'top' | 'bottom' | 'single';
19
21
 
20
22
  const getGroupStyle = (
21
23
  dateSeparators: DateSeparators,
22
- message: MessageType,
23
- previousMessage: MessageType,
24
- nextMessage: MessageType,
24
+ message: LocalMessage,
25
+ previousMessage: LocalMessage,
26
+ nextMessage: LocalMessage,
25
27
  hideDateSeparators?: boolean,
26
28
  maxTimeBetweenGroupedMessages?: number,
27
29
  ): GroupStyle[] => {
@@ -38,7 +40,7 @@ const getGroupStyle = (
38
40
  previousMessage.type === 'error' ||
39
41
  userId !== previousMessage?.user?.id ||
40
42
  !!isPrevMessageTypeDeleted ||
41
- (!hideDateSeparators && dateSeparators[message.id]) ||
43
+ (!hideDateSeparators && dateSeparators[previousMessage.id]) ||
42
44
  isEditedMessage(previousMessage);
43
45
 
44
46
  const isBottomMessage =
@@ -1,8 +1,8 @@
1
- import { MessageStatusTypes } from '../../../utils/utils';
1
+ import { LocalMessage } from 'stream-chat';
2
2
 
3
- import type { MessageType } from '../hooks/useMessageList';
3
+ import { MessageStatusTypes } from '../../../utils/utils';
4
4
 
5
- export const getLastReceivedMessage = (messages: MessageType[]) => {
5
+ export const getLastReceivedMessage = (messages: LocalMessage[]) => {
6
6
  /**
7
7
  * There are no status on dates so they will be skipped
8
8
  */
@@ -0,0 +1,27 @@
1
+ import { ChannelState, LocalMessage } from 'stream-chat';
2
+
3
+ /**
4
+ * Get the number of users who have read the message
5
+ * @param message - The message to get the read state for
6
+ * @param read - The read state of the channel
7
+ * @returns The number of users who have read the message
8
+ */
9
+ export const getReadState = (message: LocalMessage, read?: ChannelState['read']) => {
10
+ if (!read) {
11
+ return 0;
12
+ }
13
+
14
+ const readState = Object.values(read).reduce((acc, readState) => {
15
+ if (!readState.last_read) {
16
+ return acc;
17
+ }
18
+
19
+ if (message.created_at && message.created_at < readState.last_read) {
20
+ return acc + 1;
21
+ }
22
+
23
+ return acc;
24
+ }, 0);
25
+
26
+ return readState;
27
+ };
@@ -4,7 +4,7 @@ import { Text } from 'react-native';
4
4
 
5
5
  import { fireEvent, render } from '@testing-library/react-native';
6
6
 
7
- import { ReactionResponse } from 'stream-chat';
7
+ import { LocalMessage, ReactionResponse } from 'stream-chat';
8
8
 
9
9
  import {
10
10
  MessagesContextValue,
@@ -17,7 +17,6 @@ import {
17
17
  TranslationProvider,
18
18
  } from '../../../contexts/translationContext/TranslationContext';
19
19
  import { generateMessage } from '../../../mock-builders/generator/message';
20
- import { MessageType } from '../../MessageList/hooks/useMessageList';
21
20
  import * as useFetchReactionsModule from '../hooks/useFetchReactions';
22
21
  import { MessageUserReactions } from '../MessageUserReactions';
23
22
  import { MessageUserReactionsItemProps } from '../MessageUserReactionsItem';
@@ -35,7 +34,7 @@ const defaultProps = {
35
34
  message: {
36
35
  ...generateMessage(),
37
36
  reaction_groups: { like: { count: 1, sum_scores: 1 }, love: { count: 1, sum_scores: 1 } },
38
- } as unknown as MessageType,
37
+ } as unknown as LocalMessage,
39
38
  supportedReactions: mockSupportedReactions,
40
39
  };
41
40
 
@@ -1,14 +1,13 @@
1
1
  import { useCallback, useEffect, useMemo, useState } from 'react';
2
2
 
3
- import { ReactionResponse, ReactionSort } from 'stream-chat';
3
+ import { LocalMessage, ReactionResponse, ReactionSort } from 'stream-chat';
4
4
 
5
- import { MessageType } from '../../../components/MessageList/hooks/useMessageList';
6
5
  import { useChatContext } from '../../../contexts/chatContext/ChatContext';
7
6
  import { getReactionsForFilterSort } from '../../../store/apis/getReactionsforFilterSort';
8
7
 
9
8
  export type UseFetchReactionParams = {
10
9
  limit?: number;
11
- message?: MessageType;
10
+ message?: LocalMessage;
12
11
  reactionType?: string;
13
12
  sort?: ReactionSort;
14
13
  };
@@ -1,14 +1,12 @@
1
1
  import React from 'react';
2
2
  import { Pressable, StyleSheet, Text } from 'react-native';
3
3
 
4
- import { Poll, PollOption } from 'stream-chat';
4
+ import { LocalMessage, Poll, PollOption } from 'stream-chat';
5
5
 
6
6
  import { useTheme } from '../../../contexts';
7
7
 
8
- import { MessageType } from '../../MessageList/hooks/useMessageList';
9
-
10
8
  export type PollButtonProps = {
11
- onPress?: ({ message, poll }: { message: MessageType; poll: Poll }) => void;
9
+ onPress?: ({ message, poll }: { message: LocalMessage; poll: Poll }) => void;
12
10
  };
13
11
 
14
12
  export type PollVoteButtonProps = {
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useState } from 'react';
2
2
  import { Modal, SafeAreaView, StyleSheet, Text, View } from 'react-native';
3
3
 
4
- import { Poll, PollOption, PollVote as PollVoteClass } from 'stream-chat';
4
+ import { LocalMessage, Poll, PollOption, PollVote as PollVoteClass } from 'stream-chat';
5
5
 
6
6
  import { PollOptionFullResults } from './PollOptionFullResults';
7
7
  import { PollVote } from './PollVote';
@@ -13,7 +13,6 @@ import {
13
13
  useTranslationContext,
14
14
  } from '../../../../contexts';
15
15
 
16
- import { MessageType } from '../../../MessageList/hooks/useMessageList';
17
16
  import { usePollState } from '../../hooks/usePollState';
18
17
  import { GenericPollButton } from '../Button';
19
18
  import { PollModalHeader } from '../PollModalHeader';
@@ -25,7 +24,7 @@ export type ShowAllVotesButtonProps = {
25
24
  option,
26
25
  poll,
27
26
  }: {
28
- message: MessageType;
27
+ message: LocalMessage;
29
28
  option: PollOption;
30
29
  poll: Poll;
31
30
  }) => void;
@@ -34,7 +34,6 @@ import { FileIcon as FileIconDefault } from '../Attachment/FileIcon';
34
34
  import { VideoThumbnail } from '../Attachment/VideoThumbnail';
35
35
  import { MessageAvatar as MessageAvatarDefault } from '../Message/MessageSimple/MessageAvatar';
36
36
  import { MessageTextContainer } from '../Message/MessageSimple/MessageTextContainer';
37
- import { MessageType } from '../MessageList/hooks/useMessageList';
38
37
 
39
38
  const styles = StyleSheet.create({
40
39
  container: {
@@ -177,7 +176,7 @@ const ReplyWithContext = (props: ReplyPropsWithContext) => {
177
176
  },
178
177
  } = useTheme();
179
178
 
180
- const poll = client.polls.fromState((quotedMessage as MessageType)?.poll_id ?? '');
179
+ const poll = client.polls.fromState(quotedMessage?.poll_id ?? '');
181
180
  const { name: pollName }: ReplySelectorReturnType = useStateStore(poll?.state, selector) ?? {};
182
181
 
183
182
  const messageText = quotedMessage ? quotedMessage.text : '';
@@ -51,12 +51,8 @@ exports[`Thread should match thread snapshot 1`] = `
51
51
  {
52
52
  "attachments": [],
53
53
  "created_at": 2020-05-05T14:50:00.000Z,
54
- "dateSeparator": undefined,
55
54
  "deleted_at": null,
56
55
  "error": null,
57
- "groupStyles": [
58
- "single",
59
- ],
60
56
  "html": "<p>regular</p>",
61
57
  "id": "38ef6f7c-3090-5759-a37f-ab0053aadb96",
62
58
  "message_text_updated_at": "2020-05-05T14:50:00.000Z",
@@ -64,7 +60,6 @@ exports[`Thread should match thread snapshot 1`] = `
64
60
  "pinned_at": null,
65
61
  "quoted_message": null,
66
62
  "reaction_groups": null,
67
- "readBy": false,
68
63
  "status": "received",
69
64
  "text": "Message6",
70
65
  "type": "regular",
@@ -83,12 +78,8 @@ exports[`Thread should match thread snapshot 1`] = `
83
78
  {
84
79
  "attachments": [],
85
80
  "created_at": 2020-05-05T14:50:00.000Z,
86
- "dateSeparator": undefined,
87
81
  "deleted_at": null,
88
82
  "error": null,
89
- "groupStyles": [
90
- "single",
91
- ],
92
83
  "html": "<p>regular</p>",
93
84
  "id": "516efa25-5d29-5c9a-ad2d-4cc183e785bd",
94
85
  "message_text_updated_at": "2020-05-05T14:50:00.000Z",
@@ -96,7 +87,6 @@ exports[`Thread should match thread snapshot 1`] = `
96
87
  "pinned_at": null,
97
88
  "quoted_message": null,
98
89
  "reaction_groups": null,
99
- "readBy": false,
100
90
  "status": "received",
101
91
  "text": "Message5",
102
92
  "type": "regular",
@@ -115,12 +105,8 @@ exports[`Thread should match thread snapshot 1`] = `
115
105
  {
116
106
  "attachments": [],
117
107
  "created_at": 2020-05-05T14:50:00.000Z,
118
- "dateSeparator": 2020-05-05T14:50:00.000Z,
119
108
  "deleted_at": null,
120
109
  "error": null,
121
- "groupStyles": [
122
- "single",
123
- ],
124
110
  "html": "<p>regular</p>",
125
111
  "id": "82a83b16-b611-527c-b3ac-765ef6220490",
126
112
  "message_text_updated_at": "2020-05-05T14:50:00.000Z",
@@ -128,7 +114,6 @@ exports[`Thread should match thread snapshot 1`] = `
128
114
  "pinned_at": null,
129
115
  "quoted_message": null,
130
116
  "reaction_groups": null,
131
- "readBy": false,
132
117
  "status": "received",
133
118
  "text": "Message4",
134
119
  "type": "regular",
@@ -101,6 +101,7 @@ const ThreadFooterComponentWithContext = (props: ThreadFooterComponentPropsWithC
101
101
  groupStyles={['single']}
102
102
  message={thread}
103
103
  preventPress={parentMessagePreventPress}
104
+ readBy={0}
104
105
  threadList
105
106
  />
106
107
  </View>
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback, useMemo } from 'react';
2
2
  import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
3
 
4
- import { Thread, ThreadState } from 'stream-chat';
4
+ import { LocalMessage, Thread, ThreadState } from 'stream-chat';
5
5
 
6
6
  import {
7
7
  TranslationContextValue,
@@ -19,7 +19,6 @@ import { MessageBubble } from '../../icons';
19
19
  import { getDateString } from '../../utils/i18n/getDateString';
20
20
  import { Avatar } from '../Avatar/Avatar';
21
21
  import { useChannelPreviewDisplayName } from '../ChannelPreview/hooks/useChannelPreviewDisplayName';
22
- import { MessageType } from '../MessageList/hooks/useMessageList';
23
22
 
24
23
  export type ThreadListItemProps = {
25
24
  thread: Thread;
@@ -76,7 +75,7 @@ const getTitleFromMessage = ({
76
75
  }: {
77
76
  t: TranslationContextValue['t'];
78
77
  currentUserId?: string;
79
- message?: MessageType | undefined;
78
+ message?: LocalMessage;
80
79
  }) => {
81
80
  const attachment = message?.attachments?.at(0);
82
81
 
@@ -132,7 +131,10 @@ export const ThreadListItemComponent = () => {
132
131
  <TouchableOpacity
133
132
  onPress={() => {
134
133
  if (onThreadSelect) {
135
- onThreadSelect({ thread: parentMessage as MessageType, threadInstance: thread }, channel);
134
+ onThreadSelect(
135
+ { thread: parentMessage as LocalMessage, threadInstance: thread },
136
+ channel,
137
+ );
136
138
  }
137
139
  }}
138
140
  style={[styles.touchableWrapper, threadListItem.touchableWrapper]}
@@ -8,6 +8,7 @@ export * from './Attachment/FileIcon';
8
8
  export * from './Attachment/Gallery';
9
9
  export * from './Attachment/Giphy';
10
10
  export * from './Attachment/VideoThumbnail';
11
+ export * from './Attachment/ImageReloadIndicator';
11
12
  export * from './Attachment/utils/buildGallery/buildGallery';
12
13
 
13
14
  export * from './AttachmentPicker/AttachmentPicker';
@@ -148,7 +149,7 @@ export * from './MessageList/TypingIndicatorContainer';
148
149
  export * from './MessageList/utils/getDateSeparators';
149
150
  export * from './MessageList/utils/getGroupStyles';
150
151
  export * from './MessageList/utils/getLastReceivedMessage';
151
- export * from './MessageList/utils/getReadStates';
152
+ export * from './MessageList/utils/getReadState';
152
153
 
153
154
  export * from './MessageMenu/MessageActionList';
154
155
  export * from './MessageMenu/MessageActionListItem';
@@ -45,7 +45,7 @@ export function useChannelState(
45
45
  const cid = channel?.id || 'id'; // in case channel is not initialized, use generic id string for indexing
46
46
  const { setState, state } = useChannelsStateContext();
47
47
 
48
- const [threadMessages, setThreadMessages] = useStateManager(
48
+ const [threadMessages, setThreadMessagesInternal] = useStateManager(
49
49
  {
50
50
  cid,
51
51
  key: 'threadMessages',
@@ -54,6 +54,10 @@ export function useChannelState(
54
54
  },
55
55
  (threadId && channel?.state?.threads?.[threadId]) || [],
56
56
  );
57
+ const setThreadMessages = useCallback(
58
+ (value: ChannelState['threadMessages']) => setThreadMessagesInternal([...value]),
59
+ [setThreadMessagesInternal],
60
+ );
57
61
 
58
62
  return {
59
63
  setThreadMessages,