stream-chat-react-native-core 5.34.1-beta.5 → 5.35.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (340) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +5 -4
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Card.js +2 -1
  4. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +2 -1
  6. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/Gallery.js +3 -2
  8. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  9. package/lib/commonjs/components/Attachment/Giphy.js +2 -3
  10. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +2 -1
  12. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
  13. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js +14 -9
  14. package/lib/commonjs/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  15. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +1 -0
  16. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
  17. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js +4 -11
  18. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  19. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -57
  20. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  21. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
  22. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +2 -3
  23. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -1
  24. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +2 -1
  25. package/lib/commonjs/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -1
  26. package/lib/commonjs/components/Channel/Channel.js +5 -2
  27. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  28. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  29. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  30. package/lib/commonjs/components/ImageGallery/ImageGallery.js +4 -3
  31. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  32. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +3 -3
  33. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  34. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +2 -1
  35. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  36. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +5 -5
  37. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  38. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +2 -1
  39. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  40. package/lib/commonjs/components/Message/Message.js +8 -7
  41. package/lib/commonjs/components/Message/Message.js.map +1 -1
  42. package/lib/commonjs/components/MessageInput/AttachButton.js +67 -9
  43. package/lib/commonjs/components/MessageInput/AttachButton.js.map +1 -1
  44. package/lib/commonjs/components/MessageInput/CommandsButton.js +3 -2
  45. package/lib/commonjs/components/MessageInput/CommandsButton.js.map +1 -1
  46. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +1 -11
  47. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  48. package/lib/commonjs/components/MessageInput/InputButtons.js +2 -5
  49. package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
  50. package/lib/commonjs/components/MessageInput/MessageInput.js +27 -22
  51. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  52. package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +5 -6
  53. package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js.map +1 -1
  54. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
  55. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
  56. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +2 -1
  57. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
  58. package/lib/commonjs/components/MessageList/MessageList.js +2 -1
  59. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  60. package/lib/commonjs/components/Reply/Reply.js +19 -18
  61. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  62. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +267 -181
  63. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  64. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
  65. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  66. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
  67. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  68. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +3 -2
  69. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
  70. package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -0
  71. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  72. package/lib/commonjs/i18n/en.json +1 -0
  73. package/lib/commonjs/i18n/es.json +1 -0
  74. package/lib/commonjs/i18n/fr.json +1 -0
  75. package/lib/commonjs/i18n/he.json +1 -0
  76. package/lib/commonjs/i18n/hi.json +1 -0
  77. package/lib/commonjs/i18n/it.json +1 -0
  78. package/lib/commonjs/i18n/ja.json +1 -0
  79. package/lib/commonjs/i18n/ko.json +1 -0
  80. package/lib/commonjs/i18n/nl.json +1 -0
  81. package/lib/commonjs/i18n/pt-br.json +1 -0
  82. package/lib/commonjs/i18n/ru.json +1 -0
  83. package/lib/commonjs/i18n/tr.json +1 -0
  84. package/lib/commonjs/icons/Attach.js +29 -6
  85. package/lib/commonjs/icons/Attach.js.map +1 -1
  86. package/lib/commonjs/icons/GiphyLightning.js +31 -0
  87. package/lib/commonjs/icons/GiphyLightning.js.map +1 -0
  88. package/lib/commonjs/icons/Lightning.js +18 -6
  89. package/lib/commonjs/icons/Lightning.js.map +1 -1
  90. package/lib/commonjs/icons/index.js +11 -0
  91. package/lib/commonjs/icons/index.js.map +1 -1
  92. package/lib/commonjs/native.js +14 -5
  93. package/lib/commonjs/native.js.map +1 -1
  94. package/lib/commonjs/types/types.js +12 -0
  95. package/lib/commonjs/types/types.js.map +1 -1
  96. package/lib/commonjs/utils/utils.js +13 -1
  97. package/lib/commonjs/utils/utils.js.map +1 -1
  98. package/lib/commonjs/version.json +1 -1
  99. package/lib/module/components/Attachment/Attachment.js +5 -4
  100. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  101. package/lib/module/components/Attachment/Card.js +2 -1
  102. package/lib/module/components/Attachment/Card.js.map +1 -1
  103. package/lib/module/components/Attachment/FileAttachmentGroup.js +2 -1
  104. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  105. package/lib/module/components/Attachment/Gallery.js +3 -2
  106. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  107. package/lib/module/components/Attachment/Giphy.js +2 -3
  108. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  109. package/lib/module/components/Attachment/utils/getAspectRatio.js +2 -1
  110. package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
  111. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +14 -9
  112. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  113. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +1 -0
  114. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
  115. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +4 -11
  116. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  117. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -57
  118. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  119. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
  120. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +2 -3
  121. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -1
  122. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +2 -1
  123. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -1
  124. package/lib/module/components/Channel/Channel.js +5 -2
  125. package/lib/module/components/Channel/Channel.js.map +1 -1
  126. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  127. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  128. package/lib/module/components/ImageGallery/ImageGallery.js +4 -3
  129. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  130. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +3 -3
  131. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  132. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +2 -1
  133. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  134. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +5 -5
  135. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  136. package/lib/module/components/ImageGallery/components/ImageGrid.js +2 -1
  137. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  138. package/lib/module/components/Message/Message.js +8 -7
  139. package/lib/module/components/Message/Message.js.map +1 -1
  140. package/lib/module/components/MessageInput/AttachButton.js +67 -9
  141. package/lib/module/components/MessageInput/AttachButton.js.map +1 -1
  142. package/lib/module/components/MessageInput/CommandsButton.js +3 -2
  143. package/lib/module/components/MessageInput/CommandsButton.js.map +1 -1
  144. package/lib/module/components/MessageInput/FileUploadPreview.js +1 -11
  145. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  146. package/lib/module/components/MessageInput/InputButtons.js +2 -5
  147. package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
  148. package/lib/module/components/MessageInput/MessageInput.js +27 -22
  149. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  150. package/lib/module/components/MessageInput/components/InputGiphySearch.js +5 -6
  151. package/lib/module/components/MessageInput/components/InputGiphySearch.js.map +1 -1
  152. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
  153. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
  154. package/lib/module/components/MessageInput/hooks/useAudioController.js +2 -1
  155. package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
  156. package/lib/module/components/MessageList/MessageList.js +2 -1
  157. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  158. package/lib/module/components/Reply/Reply.js +19 -18
  159. package/lib/module/components/Reply/Reply.js.map +1 -1
  160. package/lib/module/contexts/messageInputContext/MessageInputContext.js +267 -181
  161. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  162. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
  163. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  164. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
  165. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  166. package/lib/module/contexts/overlayContext/OverlayProvider.js +3 -2
  167. package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
  168. package/lib/module/contexts/themeContext/utils/theme.js +5 -0
  169. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  170. package/lib/module/i18n/en.json +1 -0
  171. package/lib/module/i18n/es.json +1 -0
  172. package/lib/module/i18n/fr.json +1 -0
  173. package/lib/module/i18n/he.json +1 -0
  174. package/lib/module/i18n/hi.json +1 -0
  175. package/lib/module/i18n/it.json +1 -0
  176. package/lib/module/i18n/ja.json +1 -0
  177. package/lib/module/i18n/ko.json +1 -0
  178. package/lib/module/i18n/nl.json +1 -0
  179. package/lib/module/i18n/pt-br.json +1 -0
  180. package/lib/module/i18n/ru.json +1 -0
  181. package/lib/module/i18n/tr.json +1 -0
  182. package/lib/module/icons/Attach.js +29 -6
  183. package/lib/module/icons/Attach.js.map +1 -1
  184. package/lib/module/icons/GiphyLightning.js +31 -0
  185. package/lib/module/icons/GiphyLightning.js.map +1 -0
  186. package/lib/module/icons/Lightning.js +18 -6
  187. package/lib/module/icons/Lightning.js.map +1 -1
  188. package/lib/module/icons/index.js +11 -0
  189. package/lib/module/icons/index.js.map +1 -1
  190. package/lib/module/native.js +14 -5
  191. package/lib/module/native.js.map +1 -1
  192. package/lib/module/types/types.js +12 -0
  193. package/lib/module/types/types.js.map +1 -1
  194. package/lib/module/utils/utils.js +13 -1
  195. package/lib/module/utils/utils.js.map +1 -1
  196. package/lib/module/version.json +1 -1
  197. package/lib/typescript/components/Attachment/Attachment.d.ts +1 -1
  198. package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
  199. package/lib/typescript/components/Attachment/Card.d.ts +1 -1
  200. package/lib/typescript/components/Attachment/Card.d.ts.map +1 -1
  201. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -1
  202. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
  203. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  204. package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
  205. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
  206. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts.map +1 -1
  207. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  208. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts +1 -1
  209. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts.map +1 -1
  210. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  211. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
  212. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  213. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  214. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  215. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  216. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +1 -1
  217. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
  218. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts.map +1 -1
  219. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +1 -1
  220. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts.map +1 -1
  221. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
  222. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -1
  223. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts.map +1 -1
  224. package/lib/typescript/components/Message/Message.d.ts +1 -1
  225. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  226. package/lib/typescript/components/MessageInput/AttachButton.d.ts +3 -1
  227. package/lib/typescript/components/MessageInput/AttachButton.d.ts.map +1 -1
  228. package/lib/typescript/components/MessageInput/CommandsButton.d.ts.map +1 -1
  229. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
  230. package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
  231. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  232. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  233. package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts +9 -0
  234. package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts.map +1 -0
  235. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  236. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  237. package/lib/typescript/components/Reply/Reply.d.ts +1 -1
  238. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  239. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +15 -3
  240. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  241. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  242. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  243. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +1 -1
  244. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
  245. package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
  246. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +5 -0
  247. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  248. package/lib/typescript/i18n/en.json +1 -0
  249. package/lib/typescript/i18n/es.json +1 -0
  250. package/lib/typescript/i18n/fr.json +1 -0
  251. package/lib/typescript/i18n/he.json +1 -0
  252. package/lib/typescript/i18n/hi.json +1 -0
  253. package/lib/typescript/i18n/it.json +1 -0
  254. package/lib/typescript/i18n/ja.json +1 -0
  255. package/lib/typescript/i18n/ko.json +1 -0
  256. package/lib/typescript/i18n/nl.json +1 -0
  257. package/lib/typescript/i18n/pt-br.json +1 -0
  258. package/lib/typescript/i18n/ru.json +1 -0
  259. package/lib/typescript/i18n/tr.json +1 -0
  260. package/lib/typescript/icons/Attach.d.ts +5 -1
  261. package/lib/typescript/icons/Attach.d.ts.map +1 -1
  262. package/lib/typescript/icons/GiphyLightning.d.ts +8 -0
  263. package/lib/typescript/icons/GiphyLightning.d.ts.map +1 -0
  264. package/lib/typescript/icons/Lightning.d.ts +5 -1
  265. package/lib/typescript/icons/Lightning.d.ts.map +1 -1
  266. package/lib/typescript/icons/index.d.ts +1 -0
  267. package/lib/typescript/icons/index.d.ts.map +1 -1
  268. package/lib/typescript/native.d.ts +13 -5
  269. package/lib/typescript/native.d.ts.map +1 -1
  270. package/lib/typescript/types/types.d.ts +10 -1
  271. package/lib/typescript/types/types.d.ts.map +1 -1
  272. package/lib/typescript/utils/i18n/Streami18n.d.ts +1 -0
  273. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  274. package/lib/typescript/utils/utils.d.ts +6 -0
  275. package/lib/typescript/utils/utils.d.ts.map +1 -1
  276. package/package.json +1 -1
  277. package/src/components/Attachment/Attachment.tsx +7 -7
  278. package/src/components/Attachment/Card.tsx +2 -2
  279. package/src/components/Attachment/FileAttachmentGroup.tsx +2 -2
  280. package/src/components/Attachment/Gallery.tsx +3 -3
  281. package/src/components/Attachment/Giphy.tsx +1 -1
  282. package/src/components/Attachment/utils/getAspectRatio.ts +2 -2
  283. package/src/components/AttachmentPicker/AttachmentPicker.tsx +6 -0
  284. package/src/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.tsx +3 -0
  285. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +6 -15
  286. package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +6 -30
  287. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
  288. package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx +1 -1
  289. package/src/components/AutoCompleteInput/AutoCompleteSuggestionHeader.tsx +1 -1
  290. package/src/components/Channel/Channel.tsx +8 -6
  291. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  292. package/src/components/ImageGallery/ImageGallery.tsx +6 -6
  293. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +5 -4
  294. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +1 -0
  295. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +1 -0
  296. package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
  297. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +4 -3
  298. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +2 -2
  299. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +5 -14
  300. package/src/components/ImageGallery/components/ImageGrid.tsx +2 -2
  301. package/src/components/Message/Message.tsx +12 -8
  302. package/src/components/MessageInput/AttachButton.tsx +74 -8
  303. package/src/components/MessageInput/CommandsButton.tsx +2 -1
  304. package/src/components/MessageInput/FileUploadPreview.tsx +8 -17
  305. package/src/components/MessageInput/InputButtons.tsx +1 -2
  306. package/src/components/MessageInput/MessageInput.tsx +43 -30
  307. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -0
  308. package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap +139 -45
  309. package/src/components/MessageInput/components/InputGiphySearch.tsx +3 -3
  310. package/src/components/MessageInput/components/NativeAttachmentPicker.tsx +179 -0
  311. package/src/components/MessageInput/hooks/useAudioController.tsx +2 -2
  312. package/src/components/MessageList/MessageList.tsx +2 -2
  313. package/src/components/Reply/Reply.tsx +31 -29
  314. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +86 -37
  315. package/src/contexts/messageInputContext/MessageInputContext.tsx +94 -23
  316. package/src/contexts/messageInputContext/__tests__/MessageInputContext.test.tsx +1 -38
  317. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +6 -1
  318. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +11 -6
  319. package/src/contexts/overlayContext/OverlayProvider.tsx +4 -1
  320. package/src/contexts/themeContext/utils/theme.ts +10 -0
  321. package/src/i18n/en.json +1 -0
  322. package/src/i18n/es.json +1 -0
  323. package/src/i18n/fr.json +1 -0
  324. package/src/i18n/he.json +1 -0
  325. package/src/i18n/hi.json +1 -0
  326. package/src/i18n/it.json +1 -0
  327. package/src/i18n/ja.json +1 -0
  328. package/src/i18n/ko.json +1 -0
  329. package/src/i18n/nl.json +1 -0
  330. package/src/i18n/pt-br.json +1 -0
  331. package/src/i18n/ru.json +1 -0
  332. package/src/i18n/tr.json +1 -0
  333. package/src/icons/Attach.tsx +22 -9
  334. package/src/icons/GiphyLightning.tsx +18 -0
  335. package/src/icons/Lightning.tsx +14 -5
  336. package/src/icons/index.ts +1 -0
  337. package/src/native.ts +28 -14
  338. package/src/types/types.ts +11 -1
  339. package/src/utils/utils.ts +20 -0
  340. package/src/version.json +1 -1
@@ -48,7 +48,7 @@ import {
48
48
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
49
49
  import { useViewport } from '../../hooks/useViewport';
50
50
  import { isVideoPackageAvailable, VideoType } from '../../native';
51
- import type { DefaultStreamChatGenerics } from '../../types/types';
51
+ import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
52
52
  import { getResizedImageUrl } from '../../utils/getResizedImageUrl';
53
53
  import { getUrlOfImageAttachment } from '../../utils/getUrlOfImageAttachment';
54
54
  import { getGiphyMimeType } from '../Attachment/utils/getGiphyMimeType';
@@ -239,15 +239,15 @@ export const ImageGallery = <
239
239
  cur.attachments
240
240
  ?.filter(
241
241
  (attachment) =>
242
- (attachment.type === 'giphy' &&
242
+ (attachment.type === FileTypes.Giphy &&
243
243
  (attachment.giphy?.[giphyVersion]?.url ||
244
244
  attachment.thumb_url ||
245
245
  attachment.image_url)) ||
246
- (attachment.type === 'image' &&
246
+ (attachment.type === FileTypes.Image &&
247
247
  !attachment.title_link &&
248
248
  !attachment.og_scrape_url &&
249
249
  getUrlOfImageAttachment(attachment)) ||
250
- (isVideoPackageAvailable() && attachment.type === 'video'),
250
+ (isVideoPackageAvailable() && attachment.type === FileTypes.Video),
251
251
  )
252
252
  .reverse() || [];
253
253
 
@@ -344,7 +344,7 @@ export const ImageGallery = <
344
344
  const imageHeight = Math.floor(height * (fullWindowWidth / width));
345
345
  setCurrentImageHeight(imageHeight > fullWindowHeight ? fullWindowHeight : imageHeight);
346
346
  } else if (photo?.uri) {
347
- if (photo.type === 'image') {
347
+ if (photo.type === FileTypes.Image) {
348
348
  Image.getSize(photo.uri, (width, height) => {
349
349
  const imageHeight = Math.floor(height * (fullWindowWidth / width));
350
350
  setCurrentImageHeight(imageHeight > fullWindowHeight ? fullWindowHeight : imageHeight);
@@ -553,7 +553,7 @@ export const ImageGallery = <
553
553
  <Animated.View style={StyleSheet.absoluteFill}>
554
554
  <Animated.View style={[styles.animatedContainer, pagerStyle, pager]}>
555
555
  {imageGalleryAttachments.map((photo, i) =>
556
- photo.type === 'video' ? (
556
+ photo.type === FileTypes.Video ? (
557
557
  <AnimatedGalleryVideo
558
558
  attachmentId={photo.id}
559
559
  handleEnd={handleEnd}
@@ -24,6 +24,7 @@ import { ImageGallery } from '../ImageGallery';
24
24
  jest.mock('../../../native.ts', () => {
25
25
  const View = require('react-native/Libraries/Components/View/View');
26
26
  return {
27
+ isImageMediaLibraryAvailable: jest.fn(() => true),
27
28
  isVideoPackageAvailable: jest.fn(() => true),
28
29
  NetInfo: {
29
30
  addEventListener: jest.fn(),
@@ -82,7 +83,7 @@ describe('ImageGallery', () => {
82
83
  videoItemComponent,
83
84
  'handleLoad',
84
85
  `photoId-${message.id}-${attachment.asset_url}`,
85
- 10,
86
+ 10 * 1000,
86
87
  );
87
88
  });
88
89
 
@@ -143,7 +144,7 @@ describe('ImageGallery', () => {
143
144
  videoItemComponent,
144
145
  'handleProgress',
145
146
  `photoId-${message.id}-${attachment.asset_url}`,
146
- 0.3,
147
+ 0.3 * 1000,
147
148
  );
148
149
  });
149
150
 
@@ -169,7 +170,7 @@ describe('ImageGallery', () => {
169
170
 
170
171
  act(() => {
171
172
  fireEvent(videoItemComponent, 'handleLoad', {
172
- duration: 10,
173
+ duration: 10 * 1000,
173
174
  });
174
175
  fireEvent(videoItemComponent, 'handleProgress', {
175
176
  currentTime: undefined,
@@ -202,7 +203,7 @@ describe('ImageGallery', () => {
202
203
  videoItemComponent,
203
204
  'handleLoad',
204
205
  `photoId-${message.id}-${attachment.asset_url}`,
205
- 10,
206
+ 10 * 1000,
206
207
  );
207
208
  fireEvent(videoItemComponent, 'handleEnd');
208
209
  });
@@ -28,6 +28,7 @@ jest.mock('../../../native.ts', () => {
28
28
  const View = require('react-native/Libraries/Components/View/View');
29
29
  return {
30
30
  deleteFile: jest.fn(),
31
+ isImageMediaLibraryAvailable: jest.fn(() => true),
31
32
  isVideoPackageAvailable: jest.fn(() => true),
32
33
  NetInfo: {
33
34
  addEventListener: jest.fn(),
@@ -30,6 +30,7 @@ import { ImageGallery, ImageGalleryCustomComponents } from '../ImageGallery';
30
30
  jest.mock('../../../native.ts', () => {
31
31
  const View = require('react-native/Libraries/Components/View/View');
32
32
  return {
33
+ isImageMediaLibraryAvailable: jest.fn(() => true),
33
34
  isVideoPackageAvailable: jest.fn(() => true),
34
35
  NetInfo: {
35
36
  addEventListener: jest.fn(),
@@ -54,7 +54,7 @@ describe('ImageGalleryOverlay', () => {
54
54
 
55
55
  render(
56
56
  getComponent({
57
- duration: 3600,
57
+ duration: 3600 * 1000,
58
58
  progress: 1,
59
59
  }),
60
60
  );
@@ -73,7 +73,7 @@ describe('ImageGalleryOverlay', () => {
73
73
 
74
74
  render(
75
75
  getComponent({
76
- duration: 60,
76
+ duration: 60 * 1000,
77
77
  progress: 0.5,
78
78
  }),
79
79
  );
@@ -83,7 +83,8 @@ export const AnimatedGalleryVideo = React.memo(
83
83
 
84
84
  const onLoad = (payload: VideoPayloadData) => {
85
85
  setOpacity(0);
86
- handleLoad(attachmentId, payload.duration);
86
+ // Duration is in seconds so we convert to milliseconds.
87
+ handleLoad(attachmentId, payload.duration * 1000);
87
88
  };
88
89
 
89
90
  const onEnd = () => {
@@ -109,12 +110,12 @@ export const AnimatedGalleryVideo = React.memo(
109
110
  } else {
110
111
  // Update your UI for the loaded state
111
112
  setOpacity(0);
112
- handleLoad(attachmentId, playbackStatus.durationMillis / 1000);
113
+ handleLoad(attachmentId, playbackStatus.durationMillis);
113
114
  if (playbackStatus.isPlaying) {
114
115
  // Update your UI for the playing state
115
116
  handleProgress(
116
117
  attachmentId,
117
- playbackStatus.positionMillis / 1000 / (playbackStatus.durationMillis / 1000),
118
+ playbackStatus.positionMillis / playbackStatus.durationMillis,
118
119
  );
119
120
  }
120
121
 
@@ -9,7 +9,7 @@ import { useTranslationContext } from '../../../contexts/translationContext/Tran
9
9
  import { Grid as GridIconDefault, Share as ShareIconDefault } from '../../../icons';
10
10
  import { deleteFile, saveFile, shareImage, VideoType } from '../../../native';
11
11
 
12
- import type { DefaultStreamChatGenerics } from '../../../types/types';
12
+ import { DefaultStreamChatGenerics, FileTypes } from '../../../types/types';
13
13
  import type { Photo } from '../ImageGallery';
14
14
 
15
15
  const ReanimatedSafeAreaView = Animated.createAnimatedComponent
@@ -182,7 +182,7 @@ export const ImageGalleryFooterWithContext = <
182
182
  style={styles.wrapper}
183
183
  >
184
184
  <ReanimatedSafeAreaView style={[container, { backgroundColor: white }, footerStyle]}>
185
- {photo.type === 'video' ? (
185
+ {photo.type === FileTypes.Video ? (
186
186
  videoControlElement ? (
187
187
  videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
188
188
  ) : (
@@ -1,13 +1,12 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
3
 
4
- import dayjs from 'dayjs';
5
-
6
4
  import type { ImageGalleryFooterVideoControlProps } from './ImageGalleryFooter';
7
5
 
8
6
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
9
7
 
10
8
  import { Pause, Play } from '../../../icons';
9
+ import { getDurationLabelFromDuration } from '../../../utils/utils';
11
10
  import { ProgressControl } from '../../ProgressControl/ProgressControl';
12
11
 
13
12
  const styles = StyleSheet.create({
@@ -37,19 +36,11 @@ export const ImageGalleryVideoControl = React.memo(
37
36
  (props: ImageGalleryFooterVideoControlProps) => {
38
37
  const { duration, onPlayPause, paused, progress, videoRef } = props;
39
38
 
40
- const videoDuration = duration
41
- ? duration / 3600 >= 1
42
- ? dayjs.duration(duration, 'second').format('HH:mm:ss')
43
- : dayjs.duration(duration, 'second').format('mm:ss')
44
- : null;
39
+ const videoDuration = getDurationLabelFromDuration(duration);
45
40
 
46
41
  const progressValueInSeconds = progress * duration;
47
42
 
48
- const progressDuration = progressValueInSeconds
49
- ? progressValueInSeconds / 3600 >= 1
50
- ? dayjs.duration(progressValueInSeconds, 'second').format('HH:mm:ss')
51
- : dayjs.duration(progressValueInSeconds, 'second').format('mm:ss')
52
- : null;
43
+ const progressDuration = getDurationLabelFromDuration(progressValueInSeconds);
53
44
 
54
45
  const {
55
46
  theme: {
@@ -85,7 +76,7 @@ export const ImageGalleryVideoControl = React.memo(
85
76
  accessibilityLabel='Progress Duration'
86
77
  style={[styles.durationTextStyle, { color: black }, durationTextStyle]}
87
78
  >
88
- {progressDuration ? progressDuration : '00:00'}
79
+ {progressDuration}
89
80
  </Text>
90
81
  <ProgressControl
91
82
  duration={duration}
@@ -99,7 +90,7 @@ export const ImageGalleryVideoControl = React.memo(
99
90
  accessibilityLabel='Video Duration'
100
91
  style={[styles.durationTextStyle, { color: black }, durationTextStyle]}
101
92
  >
102
- {videoDuration ? videoDuration : '00:00'}
93
+ {videoDuration}
103
94
  </Text>
104
95
  </View>
105
96
  );
@@ -6,7 +6,7 @@ import { BottomSheetFlatList, TouchableOpacity } from '@gorhom/bottom-sheet';
6
6
  import { VideoThumbnail } from '../../../components/Attachment/VideoThumbnail';
7
7
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
8
8
  import { useViewport } from '../../../hooks/useViewport';
9
- import type { DefaultStreamChatGenerics } from '../../../types/types';
9
+ import { DefaultStreamChatGenerics, FileTypes } from '../../../types/types';
10
10
 
11
11
  import type { Photo } from '../ImageGallery';
12
12
 
@@ -84,7 +84,7 @@ const GridImage = <
84
84
 
85
85
  return (
86
86
  <TouchableOpacity accessibilityLabel='Grid Image' onPress={selectAndClose}>
87
- {type === 'video' ? (
87
+ {type === FileTypes.Video ? (
88
88
  <View style={[styles.image, { height: size, width: size }, gridImage]}>
89
89
  <VideoThumbnail thumb_url={thumb_url} />
90
90
  </View>
@@ -40,7 +40,7 @@ import {
40
40
  } from '../../contexts/translationContext/TranslationContext';
41
41
 
42
42
  import { isVideoPackageAvailable, triggerHaptic } from '../../native';
43
- import type { DefaultStreamChatGenerics } from '../../types/types';
43
+ import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
44
44
  import {
45
45
  hasOnlyEmojis,
46
46
  isBlockedMessage,
@@ -377,22 +377,26 @@ const MessageWithContext = <
377
377
  !isMessageTypeDeleted && Array.isArray(message.attachments)
378
378
  ? message.attachments.reduce(
379
379
  (acc, cur) => {
380
- if (cur.type === 'file') {
380
+ if (cur.type === FileTypes.File) {
381
381
  acc.files.push(cur);
382
382
  acc.other = []; // remove other attachments if a file exists
383
- } else if (cur.type === 'video' && !cur.og_scrape_url && isVideoPackageAvailable()) {
383
+ } else if (
384
+ cur.type === FileTypes.Video &&
385
+ !cur.og_scrape_url &&
386
+ isVideoPackageAvailable()
387
+ ) {
384
388
  acc.videos.push({
385
389
  image_url: cur.asset_url,
386
390
  thumb_url: cur.thumb_url,
387
- type: 'video',
391
+ type: FileTypes.Video,
388
392
  });
389
393
  acc.other = [];
390
- } else if (cur.type === 'video' && !cur.og_scrape_url) {
394
+ } else if (cur.type === FileTypes.Video && !cur.og_scrape_url) {
391
395
  acc.files.push(cur);
392
396
  acc.other = []; // remove other attachments if a file exists
393
- } else if (cur.type === 'audio' || cur.type === 'voiceRecording') {
397
+ } else if (cur.type === FileTypes.Audio || cur.type === FileTypes.VoiceRecording) {
394
398
  acc.files.push(cur);
395
- } else if (cur.type === 'image' && !cur.title_link && !cur.og_scrape_url) {
399
+ } else if (cur.type === FileTypes.Image && !cur.title_link && !cur.og_scrape_url) {
396
400
  /**
397
401
  * this next if is not combined with the above one for cases where we have
398
402
  * an image with no url links at all falling back to being an attachment
@@ -859,7 +863,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
859
863
  prevMessageAttachments.length === nextMessageAttachments.length &&
860
864
  prevMessageAttachments.every((attachment, index) => {
861
865
  const attachmentKeysEqual =
862
- attachment.type === 'image'
866
+ attachment.type === FileTypes.Image
863
867
  ? attachment.image_url === nextMessageAttachments[index].image_url &&
864
868
  attachment.thumb_url === nextMessageAttachments[index].thumb_url
865
869
  : attachment.type === nextMessageAttachments[index].type;
@@ -1,30 +1,96 @@
1
- import React from 'react';
2
- import type { GestureResponderEvent } from 'react-native';
1
+ import React, { useState } from 'react';
2
+ import type { GestureResponderEvent, LayoutChangeEvent, LayoutRectangle } from 'react-native';
3
3
  import { Pressable } from 'react-native';
4
4
 
5
+ import { NativeAttachmentPicker } from './components/NativeAttachmentPicker';
6
+
5
7
  import { useAttachmentPickerContext } from '../../contexts/attachmentPickerContext/AttachmentPickerContext';
8
+ import { ChannelContextValue } from '../../contexts/channelContext/ChannelContext';
9
+ import { useMessageInputContext } from '../../contexts/messageInputContext/MessageInputContext';
6
10
  import { useTheme } from '../../contexts/themeContext/ThemeContext';
7
11
  import { Attach } from '../../icons/Attach';
8
12
 
9
- type AttachButtonPropsWithContext = {
13
+ import { isImageMediaLibraryAvailable } from '../../native';
14
+ import type { DefaultStreamChatGenerics } from '../../types/types';
15
+
16
+ type AttachButtonPropsWithContext<
17
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
18
+ > = Pick<ChannelContextValue<StreamChatGenerics>, 'disabled'> & {
10
19
  /** Function that opens attachment options bottom sheet */
11
20
  handleOnPress?: ((event: GestureResponderEvent) => void) & (() => void);
12
21
  selectedPicker?: 'images';
13
22
  };
14
23
 
15
- const AttachButtonWithContext = (props: AttachButtonPropsWithContext) => {
16
- const { handleOnPress, selectedPicker } = props;
24
+ const AttachButtonWithContext = <
25
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
26
+ >(
27
+ props: AttachButtonPropsWithContext<StreamChatGenerics>,
28
+ ) => {
29
+ const [showAttachButtonPicker, setShowAttachButtonPicker] = useState<boolean>(false);
30
+ const [attachButtonLayoutRectangle, setAttachButtonLayoutRectangle] = useState<LayoutRectangle>();
31
+ const { disabled, handleOnPress, selectedPicker } = props;
17
32
  const {
18
33
  theme: {
19
34
  colors: { accent_blue, grey },
20
35
  messageInput: { attachButton },
21
36
  },
22
37
  } = useTheme();
38
+ const { handleAttachButtonPress, toggleAttachmentPicker } = useMessageInputContext();
39
+
40
+ const onAttachButtonLayout = (event: LayoutChangeEvent) => {
41
+ const layout = event.nativeEvent.layout;
42
+ setAttachButtonLayoutRectangle((prev) => {
43
+ if (
44
+ prev &&
45
+ prev.width === layout.width &&
46
+ prev.height === layout.height &&
47
+ prev.x === layout.x &&
48
+ prev.y === layout.y
49
+ ) {
50
+ return prev;
51
+ }
52
+ return layout;
53
+ });
54
+ };
55
+
56
+ const attachButtonHandler = () => {
57
+ setShowAttachButtonPicker(true);
58
+ };
59
+
60
+ const onPressHandler = () => {
61
+ if (handleOnPress) {
62
+ handleOnPress();
63
+ return;
64
+ }
65
+ if (handleAttachButtonPress) {
66
+ handleAttachButtonPress();
67
+ return;
68
+ }
69
+ if (isImageMediaLibraryAvailable()) {
70
+ toggleAttachmentPicker();
71
+ } else {
72
+ attachButtonHandler();
73
+ }
74
+ };
23
75
 
24
76
  return (
25
- <Pressable onPress={handleOnPress} style={[attachButton]} testID='attach-button'>
26
- <Attach pathFill={selectedPicker === 'images' ? accent_blue : grey} />
27
- </Pressable>
77
+ <>
78
+ <Pressable
79
+ disabled={disabled}
80
+ onLayout={onAttachButtonLayout}
81
+ onPress={disabled ? () => null : onPressHandler}
82
+ style={[attachButton]}
83
+ testID='attach-button'
84
+ >
85
+ <Attach fill={selectedPicker === 'images' ? accent_blue : grey} size={32} />
86
+ </Pressable>
87
+ {showAttachButtonPicker ? (
88
+ <NativeAttachmentPicker
89
+ attachButtonLayoutRectangle={attachButtonLayoutRectangle}
90
+ onRequestedClose={() => setShowAttachButtonPicker(false)}
91
+ />
92
+ ) : null}
93
+ </>
28
94
  );
29
95
  };
30
96
 
@@ -36,11 +36,12 @@ const CommandsButtonWithContext = <
36
36
  return (
37
37
  <Pressable onPress={handleOnPress} style={[commandsButton]} testID='commands-button'>
38
38
  <Lightning
39
- pathFill={
39
+ fill={
40
40
  suggestions && suggestions.data.some((suggestion) => isSuggestionCommand(suggestion))
41
41
  ? accent_blue
42
42
  : grey
43
43
  }
44
+ size={32}
44
45
  />
45
46
  </Pressable>
46
47
  );
@@ -1,8 +1,6 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import { FlatList, I18nManager, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
3
3
 
4
- import dayjs from 'dayjs';
5
-
6
4
  import { UploadProgressIndicator } from './UploadProgressIndicator';
7
5
 
8
6
  import { ChatContextValue, useChatContext } from '../../contexts';
@@ -21,7 +19,11 @@ import { Warning } from '../../icons/Warning';
21
19
  import { isAudioPackageAvailable } from '../../native';
22
20
  import type { DefaultStreamChatGenerics, FileUpload } from '../../types/types';
23
21
  import { getTrimmedAttachmentTitle } from '../../utils/getTrimmedAttachmentTitle';
24
- import { getIndicatorTypeForFileState, ProgressIndicatorTypes } from '../../utils/utils';
22
+ import {
23
+ getDurationLabelFromDuration,
24
+ getIndicatorTypeForFileState,
25
+ ProgressIndicatorTypes,
26
+ } from '../../utils/utils';
25
27
  import { getFileSizeDisplayText } from '../Attachment/FileAttachment';
26
28
  import { WritingDirectionAwareText } from '../RTLComponents/WritingDirectionAwareText';
27
29
 
@@ -97,19 +99,6 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
97
99
  },
98
100
  } = useTheme();
99
101
 
100
- const ONE_HOUR_IN_SECONDS = 3600;
101
- let durationLabel = '00:00';
102
- const videoDuration = item.file.duration;
103
-
104
- if (videoDuration) {
105
- const isDurationLongerThanHour = videoDuration / ONE_HOUR_IN_SECONDS >= 1;
106
- const formattedDurationParam = isDurationLongerThanHour ? 'HH:mm:ss' : 'mm:ss';
107
- const formattedVideoDuration = dayjs
108
- .duration(videoDuration, 'second')
109
- .format(formattedDurationParam);
110
- durationLabel = formattedVideoDuration;
111
- }
112
-
113
102
  const { t } = useTranslationContext();
114
103
 
115
104
  return indicatorType === ProgressIndicatorTypes.NOT_SUPPORTED ? (
@@ -126,7 +115,9 @@ const UnsupportedFileTypeOrFileSizeIndicator = ({
126
115
  </View>
127
116
  ) : (
128
117
  <WritingDirectionAwareText style={[styles.fileSizeText, { color: grey }, fileSizeText]}>
129
- {videoDuration ? durationLabel : getFileSizeDisplayText(item.file.size)}
118
+ {item.file.duration
119
+ ? getDurationLabelFromDuration(item.file.duration)
120
+ : getFileSizeDisplayText(item.file.size)}
130
121
  </WritingDirectionAwareText>
131
122
  );
132
123
  };
@@ -56,7 +56,6 @@ export const InputButtonsWithContext = <
56
56
  setShowMoreOptions,
57
57
  showMoreOptions,
58
58
  text,
59
- toggleAttachmentPicker,
60
59
  } = props;
61
60
 
62
61
  const {
@@ -79,7 +78,7 @@ export const InputButtonsWithContext = <
79
78
  <View
80
79
  style={[hasCommands ? styles.attachButtonContainer : undefined, attachButtonContainer]}
81
80
  >
82
- <AttachButton handleOnPress={toggleAttachmentPicker} />
81
+ <AttachButton />
83
82
  </View>
84
83
  )}
85
84
  {hasCommands && !text && (
@@ -118,6 +118,7 @@ type MessageInputPropsWithContext<
118
118
  | 'FileUploadPreview'
119
119
  | 'fileUploads'
120
120
  | 'giphyActive'
121
+ | 'hasImagePicker'
121
122
  | 'ImageUploadPreview'
122
123
  | 'imageUploads'
123
124
  | 'Input'
@@ -184,6 +185,7 @@ const MessageInputWithContext = <
184
185
  FileUploadPreview,
185
186
  fileUploads,
186
187
  giphyActive,
188
+ hasImagePicker,
187
189
  ImageUploadPreview,
188
190
  imageUploads,
189
191
  Input,
@@ -277,6 +279,9 @@ const MessageInputWithContext = <
277
279
  const fileUploadsLength = hasResetFiles ? fileUploads.length : 0;
278
280
  const imagesForInput = (!!thread && !!threadList) || (!thread && !threadList);
279
281
 
282
+ /**
283
+ * Reset the selected images when the component is unmounted.
284
+ */
280
285
  useEffect(() => {
281
286
  setSelectedImages([]);
282
287
  if (imageUploads.length) {
@@ -285,11 +290,15 @@ const MessageInputWithContext = <
285
290
  return () => setSelectedImages([]);
286
291
  }, []);
287
292
 
293
+ /**
294
+ * Reset the selected files when the component is unmounted.
295
+ */
288
296
  useEffect(() => {
289
297
  setSelectedFiles([]);
290
298
  if (fileUploads.length) {
291
299
  fileUploads.forEach((file) => removeFile(file.id));
292
300
  }
301
+
293
302
  return () => setSelectedFiles([]);
294
303
  }, []);
295
304
 
@@ -306,10 +315,10 @@ const MessageInputWithContext = <
306
315
  }, [fileUploadsLength, selectedFilesLength]);
307
316
 
308
317
  useEffect(() => {
309
- if (imagesForInput === false && imageUploads.length) {
318
+ if (imagesForInput === false && imageUploadsLength) {
310
319
  imageUploads.forEach((image) => removeImage(image.id));
311
320
  }
312
- }, [imagesForInput]);
321
+ }, [imagesForInput, imageUploadsLength]);
313
322
 
314
323
  const uploadImagesHandler = () => {
315
324
  const imageToUpload = selectedImages.find((selectedImage) => {
@@ -371,9 +380,9 @@ const MessageInputWithContext = <
371
380
  }, [selectedFilesLength]);
372
381
 
373
382
  useEffect(() => {
374
- if (imagesForInput) {
383
+ if (imagesForInput && hasImagePicker) {
375
384
  if (imageUploadsLength < selectedImagesLength) {
376
- /** User removed some image from seleted images within ImageUploadPreview. */
385
+ // /** User removed some image from seleted images within ImageUploadPreview. */
377
386
  const updatedSelectedImages = selectedImages.filter((selectedImage) => {
378
387
  const uploadedImage = imageUploads.find(
379
388
  (imageUpload) =>
@@ -400,36 +409,38 @@ const MessageInputWithContext = <
400
409
  );
401
410
  }
402
411
  }
403
- }, [imageUploadsLength]);
412
+ }, [imageUploadsLength, hasImagePicker]);
404
413
 
405
414
  useEffect(() => {
406
- if (fileUploadsLength < selectedFilesLength) {
407
- /** User removed some video from seleted files within ImageUploadPreview. */
408
- const updatedSelectedFiles = selectedFiles.filter((selectedFile) => {
409
- const uploadedFile = fileUploads.find(
410
- (fileUpload) =>
411
- fileUpload.file.uri === selectedFile.uri || fileUpload.url === selectedFile.uri,
415
+ if (hasImagePicker) {
416
+ if (fileUploadsLength < selectedFilesLength) {
417
+ /** User removed some video from seleted files within ImageUploadPreview. */
418
+ const updatedSelectedFiles = selectedFiles.filter((selectedFile) => {
419
+ const uploadedFile = fileUploads.find(
420
+ (fileUpload) =>
421
+ fileUpload.file.uri === selectedFile.uri || fileUpload.url === selectedFile.uri,
422
+ );
423
+ return uploadedFile;
424
+ });
425
+ setSelectedFiles(updatedSelectedFiles);
426
+ } else if (fileUploadsLength > selectedFilesLength) {
427
+ /**
428
+ * User is editing some message which contains video attachments OR
429
+ * video attachment is added from custom image picker (other than the default bottom-sheet image picker)
430
+ * using `uploadNewFile` function from `MessageInputContext`.
431
+ **/
432
+ setSelectedFiles(
433
+ fileUploads.map((fileUpload) => ({
434
+ duration: fileUpload.file.duration,
435
+ mimeType: fileUpload.file.mimeType,
436
+ name: fileUpload.file.name,
437
+ size: fileUpload.file.size,
438
+ uri: fileUpload.file.uri,
439
+ })),
412
440
  );
413
- return uploadedFile;
414
- });
415
- setSelectedFiles(updatedSelectedFiles);
416
- } else if (fileUploadsLength > selectedFilesLength) {
417
- /**
418
- * User is editing some message which contains video attachments OR
419
- * video attachment is added from custom image picker (other than the default bottom-sheet image picker)
420
- * using `uploadNewFile` function from `MessageInputContext`.
421
- **/
422
- setSelectedFiles(
423
- fileUploads.map((fileUpload) => ({
424
- duration: fileUpload.file.duration,
425
- mimeType: fileUpload.file.mimeType,
426
- name: fileUpload.file.name,
427
- size: fileUpload.file.size,
428
- uri: fileUpload.file.uri,
429
- })),
430
- );
441
+ }
431
442
  }
432
- }, [fileUploadsLength]);
443
+ }, [fileUploadsLength, hasImagePicker]);
433
444
 
434
445
  const editingExists = !!editing;
435
446
  useEffect(() => {
@@ -1012,6 +1023,7 @@ export const MessageInput = <
1012
1023
  FileUploadPreview,
1013
1024
  fileUploads,
1014
1025
  giphyActive,
1026
+ hasImagePicker,
1015
1027
  ImageUploadPreview,
1016
1028
  imageUploads,
1017
1029
  Input,
@@ -1092,6 +1104,7 @@ export const MessageInput = <
1092
1104
  FileUploadPreview,
1093
1105
  fileUploads,
1094
1106
  giphyActive,
1107
+ hasImagePicker,
1095
1108
  ImageUploadPreview,
1096
1109
  imageUploads,
1097
1110
  Input,
@@ -31,6 +31,7 @@ jest.mock('../../../native.ts', () => {
31
31
 
32
32
  return {
33
33
  isAudioPackageAvailable: jest.fn(() => true),
34
+ isImageMediaLibraryAvailable: jest.fn(() => true),
34
35
  isImagePickerAvailable: jest.fn(() => true),
35
36
  NetInfo: {
36
37
  addEventListener: jest.fn(),