stream-chat-react-native-core 5.34.1-beta.4 → 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 (345) 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/AnimatedGalleryImage.js +3 -3
  33. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  34. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +5 -5
  35. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  36. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +6 -5
  37. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  38. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -11
  39. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  40. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +2 -1
  41. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  42. package/lib/commonjs/components/Message/Message.js +8 -7
  43. package/lib/commonjs/components/Message/Message.js.map +1 -1
  44. package/lib/commonjs/components/MessageInput/AttachButton.js +67 -9
  45. package/lib/commonjs/components/MessageInput/AttachButton.js.map +1 -1
  46. package/lib/commonjs/components/MessageInput/CommandsButton.js +3 -2
  47. package/lib/commonjs/components/MessageInput/CommandsButton.js.map +1 -1
  48. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +1 -11
  49. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  50. package/lib/commonjs/components/MessageInput/InputButtons.js +2 -5
  51. package/lib/commonjs/components/MessageInput/InputButtons.js.map +1 -1
  52. package/lib/commonjs/components/MessageInput/MessageInput.js +27 -22
  53. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  54. package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js +5 -6
  55. package/lib/commonjs/components/MessageInput/components/InputGiphySearch.js.map +1 -1
  56. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
  57. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
  58. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js +2 -1
  59. package/lib/commonjs/components/MessageInput/hooks/useAudioController.js.map +1 -1
  60. package/lib/commonjs/components/MessageList/MessageList.js +2 -1
  61. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  62. package/lib/commonjs/components/Reply/Reply.js +19 -18
  63. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  64. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +267 -181
  65. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  66. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
  67. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  68. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
  69. package/lib/commonjs/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  70. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +3 -2
  71. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
  72. package/lib/commonjs/contexts/themeContext/utils/theme.js +5 -0
  73. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  74. package/lib/commonjs/i18n/en.json +1 -0
  75. package/lib/commonjs/i18n/es.json +1 -0
  76. package/lib/commonjs/i18n/fr.json +1 -0
  77. package/lib/commonjs/i18n/he.json +1 -0
  78. package/lib/commonjs/i18n/hi.json +1 -0
  79. package/lib/commonjs/i18n/it.json +1 -0
  80. package/lib/commonjs/i18n/ja.json +1 -0
  81. package/lib/commonjs/i18n/ko.json +1 -0
  82. package/lib/commonjs/i18n/nl.json +1 -0
  83. package/lib/commonjs/i18n/pt-br.json +1 -0
  84. package/lib/commonjs/i18n/ru.json +1 -0
  85. package/lib/commonjs/i18n/tr.json +1 -0
  86. package/lib/commonjs/icons/Attach.js +29 -6
  87. package/lib/commonjs/icons/Attach.js.map +1 -1
  88. package/lib/commonjs/icons/GiphyLightning.js +31 -0
  89. package/lib/commonjs/icons/GiphyLightning.js.map +1 -0
  90. package/lib/commonjs/icons/Lightning.js +18 -6
  91. package/lib/commonjs/icons/Lightning.js.map +1 -1
  92. package/lib/commonjs/icons/index.js +11 -0
  93. package/lib/commonjs/icons/index.js.map +1 -1
  94. package/lib/commonjs/native.js +14 -5
  95. package/lib/commonjs/native.js.map +1 -1
  96. package/lib/commonjs/types/types.js +12 -0
  97. package/lib/commonjs/types/types.js.map +1 -1
  98. package/lib/commonjs/utils/utils.js +13 -1
  99. package/lib/commonjs/utils/utils.js.map +1 -1
  100. package/lib/commonjs/version.json +1 -1
  101. package/lib/module/components/Attachment/Attachment.js +5 -4
  102. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  103. package/lib/module/components/Attachment/Card.js +2 -1
  104. package/lib/module/components/Attachment/Card.js.map +1 -1
  105. package/lib/module/components/Attachment/FileAttachmentGroup.js +2 -1
  106. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  107. package/lib/module/components/Attachment/Gallery.js +3 -2
  108. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  109. package/lib/module/components/Attachment/Giphy.js +2 -3
  110. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  111. package/lib/module/components/Attachment/utils/getAspectRatio.js +2 -1
  112. package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
  113. package/lib/module/components/AttachmentPicker/AttachmentPicker.js +14 -9
  114. package/lib/module/components/AttachmentPicker/AttachmentPicker.js.map +1 -1
  115. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js +1 -0
  116. package/lib/module/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.js.map +1 -1
  117. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js +4 -11
  118. package/lib/module/components/AttachmentPicker/components/AttachmentPickerItem.js.map +1 -1
  119. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +6 -57
  120. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  121. package/lib/module/components/AutoCompleteInput/AutoCompleteInput.js +1 -1
  122. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js +2 -3
  123. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.js.map +1 -1
  124. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js +2 -1
  125. package/lib/module/components/AutoCompleteInput/AutoCompleteSuggestionHeader.js.map +1 -1
  126. package/lib/module/components/Channel/Channel.js +5 -2
  127. package/lib/module/components/Channel/Channel.js.map +1 -1
  128. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  129. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  130. package/lib/module/components/ImageGallery/ImageGallery.js +4 -3
  131. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  132. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +3 -3
  133. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  134. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +5 -5
  135. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  136. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +6 -5
  137. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  138. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +11 -11
  139. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  140. package/lib/module/components/ImageGallery/components/ImageGrid.js +2 -1
  141. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  142. package/lib/module/components/Message/Message.js +8 -7
  143. package/lib/module/components/Message/Message.js.map +1 -1
  144. package/lib/module/components/MessageInput/AttachButton.js +67 -9
  145. package/lib/module/components/MessageInput/AttachButton.js.map +1 -1
  146. package/lib/module/components/MessageInput/CommandsButton.js +3 -2
  147. package/lib/module/components/MessageInput/CommandsButton.js.map +1 -1
  148. package/lib/module/components/MessageInput/FileUploadPreview.js +1 -11
  149. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  150. package/lib/module/components/MessageInput/InputButtons.js +2 -5
  151. package/lib/module/components/MessageInput/InputButtons.js.map +1 -1
  152. package/lib/module/components/MessageInput/MessageInput.js +27 -22
  153. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  154. package/lib/module/components/MessageInput/components/InputGiphySearch.js +5 -6
  155. package/lib/module/components/MessageInput/components/InputGiphySearch.js.map +1 -1
  156. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js +157 -0
  157. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -0
  158. package/lib/module/components/MessageInput/hooks/useAudioController.js +2 -1
  159. package/lib/module/components/MessageInput/hooks/useAudioController.js.map +1 -1
  160. package/lib/module/components/MessageList/MessageList.js +2 -1
  161. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  162. package/lib/module/components/Reply/Reply.js +19 -18
  163. package/lib/module/components/Reply/Reply.js.map +1 -1
  164. package/lib/module/contexts/messageInputContext/MessageInputContext.js +267 -181
  165. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  166. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +6 -0
  167. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  168. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js +6 -5
  169. package/lib/module/contexts/messageInputContext/hooks/useMessageDetailsForState.js.map +1 -1
  170. package/lib/module/contexts/overlayContext/OverlayProvider.js +3 -2
  171. package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
  172. package/lib/module/contexts/themeContext/utils/theme.js +5 -0
  173. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  174. package/lib/module/i18n/en.json +1 -0
  175. package/lib/module/i18n/es.json +1 -0
  176. package/lib/module/i18n/fr.json +1 -0
  177. package/lib/module/i18n/he.json +1 -0
  178. package/lib/module/i18n/hi.json +1 -0
  179. package/lib/module/i18n/it.json +1 -0
  180. package/lib/module/i18n/ja.json +1 -0
  181. package/lib/module/i18n/ko.json +1 -0
  182. package/lib/module/i18n/nl.json +1 -0
  183. package/lib/module/i18n/pt-br.json +1 -0
  184. package/lib/module/i18n/ru.json +1 -0
  185. package/lib/module/i18n/tr.json +1 -0
  186. package/lib/module/icons/Attach.js +29 -6
  187. package/lib/module/icons/Attach.js.map +1 -1
  188. package/lib/module/icons/GiphyLightning.js +31 -0
  189. package/lib/module/icons/GiphyLightning.js.map +1 -0
  190. package/lib/module/icons/Lightning.js +18 -6
  191. package/lib/module/icons/Lightning.js.map +1 -1
  192. package/lib/module/icons/index.js +11 -0
  193. package/lib/module/icons/index.js.map +1 -1
  194. package/lib/module/native.js +14 -5
  195. package/lib/module/native.js.map +1 -1
  196. package/lib/module/types/types.js +12 -0
  197. package/lib/module/types/types.js.map +1 -1
  198. package/lib/module/utils/utils.js +13 -1
  199. package/lib/module/utils/utils.js.map +1 -1
  200. package/lib/module/version.json +1 -1
  201. package/lib/typescript/components/Attachment/Attachment.d.ts +1 -1
  202. package/lib/typescript/components/Attachment/Attachment.d.ts.map +1 -1
  203. package/lib/typescript/components/Attachment/Card.d.ts +1 -1
  204. package/lib/typescript/components/Attachment/Card.d.ts.map +1 -1
  205. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +1 -1
  206. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts.map +1 -1
  207. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  208. package/lib/typescript/components/Attachment/Gallery.d.ts.map +1 -1
  209. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
  210. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts.map +1 -1
  211. package/lib/typescript/components/AttachmentPicker/AttachmentPicker.d.ts.map +1 -1
  212. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts +1 -1
  213. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.d.ts.map +1 -1
  214. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerItem.d.ts.map +1 -1
  215. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
  216. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  217. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  218. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  219. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  220. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +1 -1
  221. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts.map +1 -1
  222. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts.map +1 -1
  223. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +1 -1
  224. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts.map +1 -1
  225. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts.map +1 -1
  226. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +1 -1
  227. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts.map +1 -1
  228. package/lib/typescript/components/Message/Message.d.ts +1 -1
  229. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  230. package/lib/typescript/components/MessageInput/AttachButton.d.ts +3 -1
  231. package/lib/typescript/components/MessageInput/AttachButton.d.ts.map +1 -1
  232. package/lib/typescript/components/MessageInput/CommandsButton.d.ts.map +1 -1
  233. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts.map +1 -1
  234. package/lib/typescript/components/MessageInput/InputButtons.d.ts.map +1 -1
  235. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  236. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  237. package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts +9 -0
  238. package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts.map +1 -0
  239. package/lib/typescript/components/MessageList/MessageList.d.ts +1 -1
  240. package/lib/typescript/components/MessageList/MessageList.d.ts.map +1 -1
  241. package/lib/typescript/components/Reply/Reply.d.ts +1 -1
  242. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  243. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +15 -3
  244. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  245. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  246. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  247. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts +1 -1
  248. package/lib/typescript/contexts/messageInputContext/hooks/useMessageDetailsForState.d.ts.map +1 -1
  249. package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
  250. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +5 -0
  251. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  252. package/lib/typescript/i18n/en.json +1 -0
  253. package/lib/typescript/i18n/es.json +1 -0
  254. package/lib/typescript/i18n/fr.json +1 -0
  255. package/lib/typescript/i18n/he.json +1 -0
  256. package/lib/typescript/i18n/hi.json +1 -0
  257. package/lib/typescript/i18n/it.json +1 -0
  258. package/lib/typescript/i18n/ja.json +1 -0
  259. package/lib/typescript/i18n/ko.json +1 -0
  260. package/lib/typescript/i18n/nl.json +1 -0
  261. package/lib/typescript/i18n/pt-br.json +1 -0
  262. package/lib/typescript/i18n/ru.json +1 -0
  263. package/lib/typescript/i18n/tr.json +1 -0
  264. package/lib/typescript/icons/Attach.d.ts +5 -1
  265. package/lib/typescript/icons/Attach.d.ts.map +1 -1
  266. package/lib/typescript/icons/GiphyLightning.d.ts +8 -0
  267. package/lib/typescript/icons/GiphyLightning.d.ts.map +1 -0
  268. package/lib/typescript/icons/Lightning.d.ts +5 -1
  269. package/lib/typescript/icons/Lightning.d.ts.map +1 -1
  270. package/lib/typescript/icons/index.d.ts +1 -0
  271. package/lib/typescript/icons/index.d.ts.map +1 -1
  272. package/lib/typescript/native.d.ts +13 -5
  273. package/lib/typescript/native.d.ts.map +1 -1
  274. package/lib/typescript/types/types.d.ts +10 -1
  275. package/lib/typescript/types/types.d.ts.map +1 -1
  276. package/lib/typescript/utils/i18n/Streami18n.d.ts +1 -0
  277. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  278. package/lib/typescript/utils/utils.d.ts +6 -0
  279. package/lib/typescript/utils/utils.d.ts.map +1 -1
  280. package/package.json +1 -1
  281. package/src/components/Attachment/Attachment.tsx +7 -7
  282. package/src/components/Attachment/Card.tsx +2 -2
  283. package/src/components/Attachment/FileAttachmentGroup.tsx +2 -2
  284. package/src/components/Attachment/Gallery.tsx +3 -3
  285. package/src/components/Attachment/Giphy.tsx +1 -1
  286. package/src/components/Attachment/utils/getAspectRatio.ts +2 -2
  287. package/src/components/AttachmentPicker/AttachmentPicker.tsx +6 -0
  288. package/src/components/AttachmentPicker/components/AttachmentPickerIOSSelectMorePhotos.tsx +3 -0
  289. package/src/components/AttachmentPicker/components/AttachmentPickerItem.tsx +6 -15
  290. package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +6 -30
  291. package/src/components/AutoCompleteInput/AutoCompleteInput.tsx +1 -1
  292. package/src/components/AutoCompleteInput/AutoCompleteSuggestionCommandIcon.tsx +1 -1
  293. package/src/components/AutoCompleteInput/AutoCompleteSuggestionHeader.tsx +1 -1
  294. package/src/components/Channel/Channel.tsx +8 -6
  295. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  296. package/src/components/ImageGallery/ImageGallery.tsx +6 -6
  297. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +5 -4
  298. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +1 -0
  299. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +1 -0
  300. package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +2 -2
  301. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +3 -3
  302. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +5 -4
  303. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +4 -4
  304. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +8 -17
  305. package/src/components/ImageGallery/components/ImageGrid.tsx +2 -2
  306. package/src/components/Message/Message.tsx +12 -8
  307. package/src/components/MessageInput/AttachButton.tsx +74 -8
  308. package/src/components/MessageInput/CommandsButton.tsx +2 -1
  309. package/src/components/MessageInput/FileUploadPreview.tsx +8 -17
  310. package/src/components/MessageInput/InputButtons.tsx +1 -2
  311. package/src/components/MessageInput/MessageInput.tsx +43 -30
  312. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +1 -0
  313. package/src/components/MessageInput/__tests__/__snapshots__/AttachButton.test.js.snap +139 -45
  314. package/src/components/MessageInput/components/InputGiphySearch.tsx +3 -3
  315. package/src/components/MessageInput/components/NativeAttachmentPicker.tsx +179 -0
  316. package/src/components/MessageInput/hooks/useAudioController.tsx +2 -2
  317. package/src/components/MessageList/MessageList.tsx +2 -2
  318. package/src/components/Reply/Reply.tsx +31 -29
  319. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +86 -37
  320. package/src/contexts/messageInputContext/MessageInputContext.tsx +94 -23
  321. package/src/contexts/messageInputContext/__tests__/MessageInputContext.test.tsx +1 -38
  322. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +6 -1
  323. package/src/contexts/messageInputContext/hooks/useMessageDetailsForState.ts +11 -6
  324. package/src/contexts/overlayContext/OverlayProvider.tsx +4 -1
  325. package/src/contexts/themeContext/utils/theme.ts +10 -0
  326. package/src/i18n/en.json +1 -0
  327. package/src/i18n/es.json +1 -0
  328. package/src/i18n/fr.json +1 -0
  329. package/src/i18n/he.json +1 -0
  330. package/src/i18n/hi.json +1 -0
  331. package/src/i18n/it.json +1 -0
  332. package/src/i18n/ja.json +1 -0
  333. package/src/i18n/ko.json +1 -0
  334. package/src/i18n/nl.json +1 -0
  335. package/src/i18n/pt-br.json +1 -0
  336. package/src/i18n/ru.json +1 -0
  337. package/src/i18n/tr.json +1 -0
  338. package/src/icons/Attach.tsx +22 -9
  339. package/src/icons/GiphyLightning.tsx +18 -0
  340. package/src/icons/Lightning.tsx +14 -5
  341. package/src/icons/index.ts +1 -0
  342. package/src/native.ts +28 -14
  343. package/src/types/types.ts +11 -1
  344. package/src/utils/utils.ts +20 -0
  345. 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
  );
@@ -51,7 +51,7 @@ export const AnimatedGalleryImage = React.memo(
51
51
  * image as it is scaled. If the scale is less than one they stay in
52
52
  * place as to not come into the screen when the image shrinks.
53
53
  */
54
- const AnimatedGalleryImageStyle = useAnimatedStyle<ImageStyle>(() => {
54
+ const animatedGalleryImageStyle = useAnimatedStyle<ImageStyle>(() => {
55
55
  const xScaleOffset = -7 * screenWidth * (0.5 + index);
56
56
  const yScaleOffset = -screenHeight * 3.5;
57
57
  return {
@@ -91,8 +91,7 @@ export const AnimatedGalleryImage = React.memo(
91
91
  resizeMode={'contain'}
92
92
  source={{ uri: photo.uri }}
93
93
  style={[
94
- style,
95
- AnimatedGalleryImageStyle,
94
+ animatedGalleryImageStyle,
96
95
  {
97
96
  transform: [
98
97
  { scaleX: -1 },
@@ -103,6 +102,7 @@ export const AnimatedGalleryImage = React.memo(
103
102
  { scale: oneEighth },
104
103
  ],
105
104
  },
105
+ style,
106
106
  ]}
107
107
  />
108
108
  );
@@ -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
 
@@ -173,7 +174,6 @@ export const AnimatedGalleryVideo = React.memo(
173
174
  <Animated.View
174
175
  accessibilityLabel='Image Gallery Video'
175
176
  style={[
176
- style,
177
177
  animatedViewStyles,
178
178
  {
179
179
  transform: [
@@ -185,6 +185,7 @@ export const AnimatedGalleryVideo = React.memo(
185
185
  { scale: oneEighth },
186
186
  ],
187
187
  },
188
+ style,
188
189
  ]}
189
190
  >
190
191
  {isVideoPackageAvailable() && (
@@ -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
@@ -181,8 +181,8 @@ export const ImageGalleryFooterWithContext = <
181
181
  pointerEvents={'box-none'}
182
182
  style={styles.wrapper}
183
183
  >
184
- <ReanimatedSafeAreaView style={[container, footerStyle, { backgroundColor: white }]}>
185
- {photo.type === 'video' ? (
184
+ <ReanimatedSafeAreaView style={[container, { backgroundColor: white }, footerStyle]}>
185
+ {photo.type === FileTypes.Video ? (
186
186
  videoControlElement ? (
187
187
  videoControlElement({ duration, onPlayPause, paused, progress, videoRef })
188
188
  ) : (
@@ -195,7 +195,7 @@ export const ImageGalleryFooterWithContext = <
195
195
  />
196
196
  )
197
197
  ) : null}
198
- <View style={[styles.innerContainer, innerContainer, { backgroundColor: white }]}>
198
+ <View style={[styles.innerContainer, { backgroundColor: white }, innerContainer]}>
199
199
  {leftElement ? (
200
200
  leftElement({ openGridView, photo, share, shareMenuOpen })
201
201
  ) : (
@@ -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: {
@@ -73,7 +64,7 @@ export const ImageGalleryVideoControl = React.memo(
73
64
  return (
74
65
  <View style={[styles.videoContainer, videoContainer]}>
75
66
  <TouchableOpacity accessibilityLabel='Play Pause Button' onPress={handlePlayPause}>
76
- <View style={[styles.roundedView, roundedView, { backgroundColor: static_white }]}>
67
+ <View style={[styles.roundedView, { backgroundColor: static_white }, roundedView]}>
77
68
  {paused ? (
78
69
  <Play accessibilityLabel='Play Icon' fill={static_black} height={32} width={32} />
79
70
  ) : (
@@ -83,9 +74,9 @@ export const ImageGalleryVideoControl = React.memo(
83
74
  </TouchableOpacity>
84
75
  <Text
85
76
  accessibilityLabel='Progress Duration'
86
- style={[styles.durationTextStyle, durationTextStyle, { color: black }]}
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}
@@ -97,9 +88,9 @@ export const ImageGalleryVideoControl = React.memo(
97
88
  />
98
89
  <Text
99
90
  accessibilityLabel='Video Duration'
100
- style={[styles.durationTextStyle, durationTextStyle, { color: black }]}
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 && (