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
@@ -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(),
@@ -6,7 +6,7 @@ exports[`AttachButton should render a disabled AttachButton 1`] = `
6
6
  {
7
7
  "busy": undefined,
8
8
  "checked": undefined,
9
- "disabled": undefined,
9
+ "disabled": true,
10
10
  "expanded": undefined,
11
11
  "selected": undefined,
12
12
  }
@@ -25,6 +25,7 @@ exports[`AttachButton should render a disabled AttachButton 1`] = `
25
25
  onBlur={[Function]}
26
26
  onClick={[Function]}
27
27
  onFocus={[Function]}
28
+ onLayout={[Function]}
28
29
  onResponderGrant={[Function]}
29
30
  onResponderMove={[Function]}
30
31
  onResponderRelease={[Function]}
@@ -40,14 +41,14 @@ exports[`AttachButton should render a disabled AttachButton 1`] = `
40
41
  >
41
42
  <RNSVGSvgView
42
43
  align="xMidYMid"
43
- bbHeight={24}
44
- bbWidth={24}
44
+ bbHeight={32}
45
+ bbWidth={32}
46
+ fill="#7A7A7A"
45
47
  focusable={false}
46
- height={24}
48
+ height={32}
47
49
  meetOrSlice={0}
48
50
  minX={0}
49
51
  minY={0}
50
- pathFill="#7A7A7A"
51
52
  style={
52
53
  [
53
54
  {
@@ -56,40 +57,86 @@ exports[`AttachButton should render a disabled AttachButton 1`] = `
56
57
  },
57
58
  {
58
59
  "flex": 0,
59
- "height": 24,
60
- "width": 24,
60
+ "height": 32,
61
+ "width": 32,
61
62
  },
62
63
  ]
63
64
  }
64
- vbHeight={24}
65
- vbWidth={24}
66
- width={24}
65
+ vbHeight={32}
66
+ vbWidth={32}
67
+ width={32}
67
68
  >
68
69
  <RNSVGGroup
69
70
  fill={
70
71
  {
71
- "payload": 4278190080,
72
+ "payload": 4286216826,
72
73
  "type": 0,
73
74
  }
74
75
  }
76
+ propList={
77
+ [
78
+ "fill",
79
+ ]
80
+ }
75
81
  >
76
- <RNSVGPath
77
- clipRule={0}
78
- d="M13.468 2.888a5.07 5.07 0 012.983.635 5.07 5.07 0 012.041 2.265c.45 1.01.546 2.254-.144 3.449l-4.5 7.794a3.232 3.232 0 01-1.427 1.294c-.757.342-1.696.367-2.671-.196-.975-.563-1.422-1.389-1.506-2.215a3.233 3.233 0 01.408-1.883l4-6.928a1 1 0 011.732 1l-4 6.928c-.087.15-.176.425-.15.682.02.196.105.447.516.684.41.237.671.185.85.105.236-.107.43-.32.516-.47l4.5-7.795c.31-.538.29-1.093.049-1.636a3.072 3.072 0 00-1.214-1.346 3.072 3.072 0 00-1.773-.378c-.591.062-1.082.322-1.392.86l-5 8.66c-.654 1.133-.286 3.3 1.964 4.598 2.25 1.3 4.31.535 4.964-.598l3.5-6.062a1 1 0 111.732 1l-3.5 6.062c-1.345 2.33-4.75 3.031-7.696 1.33-2.946-1.7-4.042-5-2.696-7.33l5-8.66c.69-1.195 1.815-1.733 2.914-1.85z"
82
+ <RNSVGGroup
83
+ clipPath="id"
79
84
  fill={
80
85
  {
81
- "payload": 4286216826,
86
+ "payload": 4278190080,
82
87
  "type": 0,
83
88
  }
84
89
  }
85
- fillRule={0}
86
- propList={
87
- [
88
- "fill",
89
- "fillRule",
90
- ]
91
- }
92
- />
90
+ >
91
+ <RNSVGPath
92
+ d="M17.5245 9.33332L14.8579 9.33332L14.8579 14.6666L9.52453 14.6666L9.52453 17.3333L14.8579 17.3333L14.8579 22.6667L17.5245 22.6667L17.5245 17.3333L22.8579 17.3333L22.8579 14.6666L17.5245 14.6666L17.5245 9.33332ZM16.1912 2.66665C8.83119 2.66665 2.85786 8.63998 2.85786 16C2.85786 23.36 8.83119 29.3333 16.1912 29.3333C23.5512 29.3333 29.5245 23.36 29.5245 16C29.5245 8.63998 23.5512 2.66665 16.1912 2.66665ZM16.1912 26.6667C10.3112 26.6666 5.52453 21.88 5.52453 16C5.52453 10.12 10.3112 5.33332 16.1912 5.33332C22.0712 5.33332 26.8579 10.12 26.8579 16C26.8579 21.88 22.0712 26.6666 16.1912 26.6667Z"
93
+ fill={
94
+ {
95
+ "payload": 4286216826,
96
+ "type": 0,
97
+ }
98
+ }
99
+ propList={
100
+ [
101
+ "fill",
102
+ ]
103
+ }
104
+ />
105
+ </RNSVGGroup>
106
+ <RNSVGDefs>
107
+ <RNSVGClipPath
108
+ fill={
109
+ {
110
+ "payload": 4278190080,
111
+ "type": 0,
112
+ }
113
+ }
114
+ name="id"
115
+ >
116
+ <RNSVGRect
117
+ fill={
118
+ {
119
+ "payload": 4278190080,
120
+ "type": 0,
121
+ }
122
+ }
123
+ height={32}
124
+ matrix={
125
+ [
126
+ 1,
127
+ 0,
128
+ 0,
129
+ 1,
130
+ 0.191406,
131
+ 0,
132
+ ]
133
+ }
134
+ width={32}
135
+ x={0}
136
+ y={0}
137
+ />
138
+ </RNSVGClipPath>
139
+ </RNSVGDefs>
93
140
  </RNSVGGroup>
94
141
  </RNSVGSvgView>
95
142
  </View>
@@ -120,6 +167,7 @@ exports[`AttachButton should render an enabled AttachButton 1`] = `
120
167
  onBlur={[Function]}
121
168
  onClick={[Function]}
122
169
  onFocus={[Function]}
170
+ onLayout={[Function]}
123
171
  onResponderGrant={[Function]}
124
172
  onResponderMove={[Function]}
125
173
  onResponderRelease={[Function]}
@@ -135,14 +183,14 @@ exports[`AttachButton should render an enabled AttachButton 1`] = `
135
183
  >
136
184
  <RNSVGSvgView
137
185
  align="xMidYMid"
138
- bbHeight={24}
139
- bbWidth={24}
186
+ bbHeight={32}
187
+ bbWidth={32}
188
+ fill="#7A7A7A"
140
189
  focusable={false}
141
- height={24}
190
+ height={32}
142
191
  meetOrSlice={0}
143
192
  minX={0}
144
193
  minY={0}
145
- pathFill="#7A7A7A"
146
194
  style={
147
195
  [
148
196
  {
@@ -151,40 +199,86 @@ exports[`AttachButton should render an enabled AttachButton 1`] = `
151
199
  },
152
200
  {
153
201
  "flex": 0,
154
- "height": 24,
155
- "width": 24,
202
+ "height": 32,
203
+ "width": 32,
156
204
  },
157
205
  ]
158
206
  }
159
- vbHeight={24}
160
- vbWidth={24}
161
- width={24}
207
+ vbHeight={32}
208
+ vbWidth={32}
209
+ width={32}
162
210
  >
163
211
  <RNSVGGroup
164
212
  fill={
165
213
  {
166
- "payload": 4278190080,
214
+ "payload": 4286216826,
167
215
  "type": 0,
168
216
  }
169
217
  }
218
+ propList={
219
+ [
220
+ "fill",
221
+ ]
222
+ }
170
223
  >
171
- <RNSVGPath
172
- clipRule={0}
173
- d="M13.468 2.888a5.07 5.07 0 012.983.635 5.07 5.07 0 012.041 2.265c.45 1.01.546 2.254-.144 3.449l-4.5 7.794a3.232 3.232 0 01-1.427 1.294c-.757.342-1.696.367-2.671-.196-.975-.563-1.422-1.389-1.506-2.215a3.233 3.233 0 01.408-1.883l4-6.928a1 1 0 011.732 1l-4 6.928c-.087.15-.176.425-.15.682.02.196.105.447.516.684.41.237.671.185.85.105.236-.107.43-.32.516-.47l4.5-7.795c.31-.538.29-1.093.049-1.636a3.072 3.072 0 00-1.214-1.346 3.072 3.072 0 00-1.773-.378c-.591.062-1.082.322-1.392.86l-5 8.66c-.654 1.133-.286 3.3 1.964 4.598 2.25 1.3 4.31.535 4.964-.598l3.5-6.062a1 1 0 111.732 1l-3.5 6.062c-1.345 2.33-4.75 3.031-7.696 1.33-2.946-1.7-4.042-5-2.696-7.33l5-8.66c.69-1.195 1.815-1.733 2.914-1.85z"
224
+ <RNSVGGroup
225
+ clipPath="id"
174
226
  fill={
175
227
  {
176
- "payload": 4286216826,
228
+ "payload": 4278190080,
177
229
  "type": 0,
178
230
  }
179
231
  }
180
- fillRule={0}
181
- propList={
182
- [
183
- "fill",
184
- "fillRule",
185
- ]
186
- }
187
- />
232
+ >
233
+ <RNSVGPath
234
+ d="M17.5245 9.33332L14.8579 9.33332L14.8579 14.6666L9.52453 14.6666L9.52453 17.3333L14.8579 17.3333L14.8579 22.6667L17.5245 22.6667L17.5245 17.3333L22.8579 17.3333L22.8579 14.6666L17.5245 14.6666L17.5245 9.33332ZM16.1912 2.66665C8.83119 2.66665 2.85786 8.63998 2.85786 16C2.85786 23.36 8.83119 29.3333 16.1912 29.3333C23.5512 29.3333 29.5245 23.36 29.5245 16C29.5245 8.63998 23.5512 2.66665 16.1912 2.66665ZM16.1912 26.6667C10.3112 26.6666 5.52453 21.88 5.52453 16C5.52453 10.12 10.3112 5.33332 16.1912 5.33332C22.0712 5.33332 26.8579 10.12 26.8579 16C26.8579 21.88 22.0712 26.6666 16.1912 26.6667Z"
235
+ fill={
236
+ {
237
+ "payload": 4286216826,
238
+ "type": 0,
239
+ }
240
+ }
241
+ propList={
242
+ [
243
+ "fill",
244
+ ]
245
+ }
246
+ />
247
+ </RNSVGGroup>
248
+ <RNSVGDefs>
249
+ <RNSVGClipPath
250
+ fill={
251
+ {
252
+ "payload": 4278190080,
253
+ "type": 0,
254
+ }
255
+ }
256
+ name="id"
257
+ >
258
+ <RNSVGRect
259
+ fill={
260
+ {
261
+ "payload": 4278190080,
262
+ "type": 0,
263
+ }
264
+ }
265
+ height={32}
266
+ matrix={
267
+ [
268
+ 1,
269
+ 0,
270
+ 0,
271
+ 1,
272
+ 0.191406,
273
+ 0,
274
+ ]
275
+ }
276
+ width={32}
277
+ x={0}
278
+ y={0}
279
+ />
280
+ </RNSVGClipPath>
281
+ </RNSVGDefs>
188
282
  </RNSVGGroup>
189
283
  </RNSVGSvgView>
190
284
  </View>
@@ -7,7 +7,7 @@ import {
7
7
  } from '../../../contexts/messageInputContext/MessageInputContext';
8
8
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
9
9
 
10
- import { CircleClose, Lightning } from '../../../icons';
10
+ import { CircleClose, GiphyLightning } from '../../../icons';
11
11
  import type { DefaultStreamChatGenerics } from '../../../types/types';
12
12
  import { AutoCompleteInput } from '../../AutoCompleteInput/AutoCompleteInput';
13
13
  import { useCountdown } from '../hooks/useCountdown';
@@ -23,9 +23,9 @@ const styles = StyleSheet.create({
23
23
  alignItems: 'center',
24
24
  borderRadius: 12,
25
25
  flexDirection: 'row',
26
- height: 24,
27
26
  marginRight: 8,
28
27
  paddingHorizontal: 8,
28
+ paddingVertical: 4,
29
29
  },
30
30
  giphyText: {
31
31
  fontSize: 12,
@@ -80,7 +80,7 @@ export const InputGiphySearch = <
80
80
  return (
81
81
  <View style={[styles.autoCompleteInputContainer, autoCompleteInputContainer]}>
82
82
  <View style={[styles.giphyContainer, { backgroundColor: accent_blue }, giphyContainer]}>
83
- <Lightning height={16} pathFill={white} width={16} />
83
+ <GiphyLightning fill={white} size={16} />
84
84
  <Text style={[styles.giphyText, { color: white }, giphyText]}>GIPHY</Text>
85
85
  </View>
86
86
 
@@ -0,0 +1,179 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import { Animated, Easing, LayoutRectangle, Pressable, StyleSheet } from 'react-native';
3
+
4
+ import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext';
5
+ import { useTheme } from '../../../contexts/themeContext/ThemeContext';
6
+
7
+ import { CameraSelectorIcon } from '../../AttachmentPicker/components/CameraSelectorIcon';
8
+ import { FileSelectorIcon } from '../../AttachmentPicker/components/FileSelectorIcon';
9
+ import { ImageSelectorIcon } from '../../AttachmentPicker/components/ImageSelectorIcon';
10
+
11
+ type NativeAttachmentPickerProps = {
12
+ onRequestedClose: () => void;
13
+ attachButtonLayoutRectangle?: LayoutRectangle;
14
+ };
15
+
16
+ const TOP_PADDING = 4;
17
+ const ATTACH_MARGIN_BOTTOM = 4;
18
+
19
+ export const NativeAttachmentPicker = ({
20
+ attachButtonLayoutRectangle,
21
+ onRequestedClose,
22
+ }: NativeAttachmentPickerProps) => {
23
+ const size = attachButtonLayoutRectangle?.width ?? 0;
24
+ const attachButtonItemSize = 40;
25
+ const NUMBER_OF_BUTTONS = 3;
26
+ const {
27
+ theme: {
28
+ colors: { grey_whisper },
29
+ messageInput: {
30
+ nativeAttachmentPicker: {
31
+ buttonContainer,
32
+ buttonDimmerStyle: buttonDimmerStyleTheme,
33
+ container,
34
+ },
35
+ },
36
+ },
37
+ } = useTheme();
38
+ const {
39
+ hasFilePicker,
40
+ hasImagePicker,
41
+ pickAndUploadImageFromNativePicker,
42
+ pickFile,
43
+ takeAndUploadImage,
44
+ } = useMessageInputContext();
45
+
46
+ const popupHeight =
47
+ // the top padding
48
+ TOP_PADDING +
49
+ // take margins into account
50
+ ATTACH_MARGIN_BOTTOM * NUMBER_OF_BUTTONS +
51
+ // the size of the attachment icon items (same size as attach button * amount of attachment button types)
52
+ attachButtonItemSize * NUMBER_OF_BUTTONS;
53
+
54
+ const containerPopupStyle = {
55
+ borderTopEndRadius: size / 2,
56
+ // the popup should be rounded as the attach button
57
+ borderTopStartRadius: size / 2,
58
+ height: popupHeight,
59
+ // from the same side horizontal coordinate of the attach button
60
+ left: attachButtonLayoutRectangle?.x,
61
+ // we should show the popup right above the attach button and not top of it
62
+ top: (attachButtonLayoutRectangle?.y ?? 0) - popupHeight,
63
+ // the width of the popup should be the same as the attach button
64
+ width: size,
65
+ };
66
+
67
+ const elasticAnimRef = useRef(new Animated.Value(0.5)); // Initial value for scale: 0.5
68
+
69
+ useEffect(() => {
70
+ Animated.timing(elasticAnimRef.current, {
71
+ duration: 150,
72
+ easing: Easing.linear,
73
+ toValue: 1,
74
+ useNativeDriver: true,
75
+ }).start();
76
+ }, []);
77
+
78
+ const buttonStyle = {
79
+ borderRadius: attachButtonItemSize / 2,
80
+ height: attachButtonItemSize,
81
+ width: attachButtonItemSize,
82
+ };
83
+
84
+ const buttonDimmerStyle = {
85
+ ...styles.attachButtonDimmer,
86
+ height: size,
87
+ // from the same side horizontal coordinate of the attach button
88
+ left: attachButtonLayoutRectangle?.x,
89
+ // we should show the popup right on top of the attach button
90
+ top: attachButtonLayoutRectangle?.y ?? 0 - popupHeight + size,
91
+ width: size,
92
+ };
93
+
94
+ const onClose = ({ onPressHandler }: { onPressHandler?: () => Promise<void> }) => {
95
+ if (onPressHandler) {
96
+ onPressHandler();
97
+ }
98
+ Animated.timing(elasticAnimRef.current, {
99
+ duration: 150,
100
+ easing: Easing.linear,
101
+ toValue: 0.2,
102
+ useNativeDriver: true,
103
+ }).start(onRequestedClose);
104
+ };
105
+
106
+ const buttons = [];
107
+
108
+ if (hasImagePicker) {
109
+ buttons.push({
110
+ icon: <ImageSelectorIcon />,
111
+ id: 'Image',
112
+ onPressHandler: pickAndUploadImageFromNativePicker,
113
+ });
114
+ }
115
+ if (hasFilePicker) {
116
+ buttons.push({ icon: <FileSelectorIcon />, id: 'File', onPressHandler: pickFile });
117
+ }
118
+ buttons.push({ icon: <CameraSelectorIcon />, id: 'Camera', onPressHandler: takeAndUploadImage });
119
+
120
+ return (
121
+ <>
122
+ <Pressable
123
+ onPress={() => {
124
+ onClose({});
125
+ }}
126
+ style={[styles.container, containerPopupStyle, container]}
127
+ >
128
+ {/* all the attach buttons */}
129
+ {buttons.map(({ icon, id, onPressHandler }) => (
130
+ <Pressable key={id} onPress={() => onClose({ onPressHandler })}>
131
+ <Animated.View
132
+ style={[
133
+ styles.buttonContainer,
134
+ buttonStyle,
135
+ {
136
+ // temporary background color until we have theming
137
+ backgroundColor: grey_whisper,
138
+ },
139
+ {
140
+ transform: [
141
+ {
142
+ scaleY: elasticAnimRef.current,
143
+ },
144
+ {
145
+ scaleX: elasticAnimRef.current,
146
+ },
147
+ ],
148
+ },
149
+ buttonContainer,
150
+ ]}
151
+ >
152
+ {icon}
153
+ </Animated.View>
154
+ </Pressable>
155
+ ))}
156
+ </Pressable>
157
+ {/* a square view with 50% opacity that semi hides the attach button */}
158
+ <Pressable onPress={() => onClose({})} style={[buttonDimmerStyle, buttonDimmerStyleTheme]} />
159
+ </>
160
+ );
161
+ };
162
+
163
+ const styles = StyleSheet.create({
164
+ attachButtonDimmer: {
165
+ opacity: 0,
166
+ position: 'absolute',
167
+ },
168
+ buttonContainer: {
169
+ alignItems: 'center',
170
+ justifyContent: 'center',
171
+ marginBottom: ATTACH_MARGIN_BOTTOM,
172
+ },
173
+ container: {
174
+ alignItems: 'center',
175
+ justifyContent: 'flex-end',
176
+ paddingTop: TOP_PADDING,
177
+ position: 'absolute',
178
+ },
179
+ });
@@ -12,7 +12,7 @@ import {
12
12
  SoundReturnType,
13
13
  triggerHaptic,
14
14
  } from '../../../native';
15
- import { File } from '../../../types/types';
15
+ import { File, FileTypes } from '../../../types/types';
16
16
  import { resampleWaveformData } from '../utils/audioSampling';
17
17
  import { normalizeAudioLevel } from '../utils/normalizeAudioLevel';
18
18
 
@@ -255,7 +255,7 @@ export const useAudioController = () => {
255
255
  duration: durationInSeconds,
256
256
  mimeType: 'audio/aac',
257
257
  name: `audio_recording_${date}.aac`,
258
- type: 'voiceRecording',
258
+ type: FileTypes.VoiceRecording,
259
259
  uri: typeof recording !== 'string' ? (recording?.getURI() as string) : (recording as string),
260
260
  waveform_data: resampledWaveformData,
261
261
  };
@@ -52,7 +52,7 @@ import {
52
52
  import { mergeThemes, ThemeProvider, useTheme } from '../../contexts/themeContext/ThemeContext';
53
53
  import { ThreadContextValue, useThreadContext } from '../../contexts/threadContext/ThreadContext';
54
54
 
55
- import type { DefaultStreamChatGenerics } from '../../types/types';
55
+ import { DefaultStreamChatGenerics, FileTypes } from '../../types/types';
56
56
 
57
57
  const WAIT_FOR_SCROLL_TO_OFFSET_TIMEOUT = 150;
58
58
  const MAX_RETRIES_AFTER_SCROLL_FAILURE = 10;
@@ -973,7 +973,7 @@ const MessageListWithContext = <
973
973
  if (!isMessageTypeDeleted && message.attachments) {
974
974
  return message.attachments.some(
975
975
  (attachment) =>
976
- attachment.type === 'image' &&
976
+ attachment.type === FileTypes.Image &&
977
977
  !attachment.title_link &&
978
978
  !attachment.og_scrape_url &&
979
979
  (attachment.image_url || attachment.thumb_url),