stream-chat-react-native-core 5.39.6 → 5.40.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 (433) hide show
  1. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +27 -0
  2. package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  3. package/lib/commonjs/components/Channel/Channel.js +17 -4
  4. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  5. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -1
  6. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  7. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +5 -1
  8. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  9. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +46 -3
  10. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  11. package/lib/commonjs/components/Chat/Chat.js +2 -0
  12. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  13. package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js +10 -0
  14. package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
  15. package/lib/commonjs/components/Message/Message.js +13 -0
  16. package/lib/commonjs/components/Message/Message.js.map +1 -1
  17. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +31 -15
  18. package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
  19. package/lib/commonjs/components/MessageInput/MessageInput.js +44 -1
  20. package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
  21. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js +18 -1
  22. package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -1
  23. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +10 -0
  24. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  25. package/lib/commonjs/components/Poll/CreatePollContent.js +386 -0
  26. package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -0
  27. package/lib/commonjs/components/Poll/Poll.js +112 -0
  28. package/lib/commonjs/components/Poll/Poll.js.map +1 -0
  29. package/lib/commonjs/components/Poll/components/Button.js +513 -0
  30. package/lib/commonjs/components/Poll/components/Button.js.map +1 -0
  31. package/lib/commonjs/components/Poll/components/CreatePollIcon.js +23 -0
  32. package/lib/commonjs/components/Poll/components/CreatePollIcon.js.map +1 -0
  33. package/lib/commonjs/components/Poll/components/CreatePollOptions.js +281 -0
  34. package/lib/commonjs/components/Poll/components/CreatePollOptions.js.map +1 -0
  35. package/lib/commonjs/components/Poll/components/PollAnswersList.js +154 -0
  36. package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -0
  37. package/lib/commonjs/components/Poll/components/PollInputDialog.js +139 -0
  38. package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -0
  39. package/lib/commonjs/components/Poll/components/PollModalHeader.js +60 -0
  40. package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -0
  41. package/lib/commonjs/components/Poll/components/PollOption.js +209 -0
  42. package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -0
  43. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +123 -0
  44. package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -0
  45. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +152 -0
  46. package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -0
  47. package/lib/commonjs/components/Poll/components/PollResults/PollResults.js +101 -0
  48. package/lib/commonjs/components/Poll/components/PollResults/PollResults.js.map +1 -0
  49. package/lib/commonjs/components/Poll/components/PollResults/index.js +37 -0
  50. package/lib/commonjs/components/Poll/components/PollResults/index.js.map +1 -0
  51. package/lib/commonjs/components/Poll/components/index.js +92 -0
  52. package/lib/commonjs/components/Poll/components/index.js.map +1 -0
  53. package/lib/commonjs/components/Poll/hooks/usePollAnswersPagination.js +129 -0
  54. package/lib/commonjs/components/Poll/hooks/usePollAnswersPagination.js.map +1 -0
  55. package/lib/commonjs/components/Poll/hooks/usePollOptionVotesPagination.js +140 -0
  56. package/lib/commonjs/components/Poll/hooks/usePollOptionVotesPagination.js.map +1 -0
  57. package/lib/commonjs/components/Poll/hooks/usePollState.js +103 -0
  58. package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -0
  59. package/lib/commonjs/components/Poll/hooks/usePollStateStore.js +13 -0
  60. package/lib/commonjs/components/Poll/hooks/usePollStateStore.js.map +1 -0
  61. package/lib/commonjs/components/Poll/index.js +81 -0
  62. package/lib/commonjs/components/Poll/index.js.map +1 -0
  63. package/lib/commonjs/components/Reply/Reply.js +1 -1
  64. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  65. package/lib/commonjs/components/index.js +11 -0
  66. package/lib/commonjs/components/index.js.map +1 -1
  67. package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  68. package/lib/commonjs/contexts/index.js +11 -0
  69. package/lib/commonjs/contexts/index.js.map +1 -1
  70. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +26 -3
  71. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  72. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -1
  73. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  74. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  75. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  76. package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
  77. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +4 -0
  78. package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
  79. package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +3 -0
  80. package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
  81. package/lib/commonjs/contexts/pollContext/createPollContentContext.js +33 -0
  82. package/lib/commonjs/contexts/pollContext/createPollContentContext.js.map +1 -0
  83. package/lib/commonjs/contexts/pollContext/index.js +26 -0
  84. package/lib/commonjs/contexts/pollContext/index.js.map +1 -0
  85. package/lib/commonjs/contexts/pollContext/pollContext.js +33 -0
  86. package/lib/commonjs/contexts/pollContext/pollContext.js.map +1 -0
  87. package/lib/commonjs/contexts/themeContext/utils/theme.js +126 -0
  88. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  89. package/lib/commonjs/i18n/en.json +34 -0
  90. package/lib/commonjs/i18n/es.json +38 -0
  91. package/lib/commonjs/i18n/fr.json +38 -0
  92. package/lib/commonjs/i18n/he.json +38 -0
  93. package/lib/commonjs/i18n/hi.json +34 -0
  94. package/lib/commonjs/i18n/it.json +38 -0
  95. package/lib/commonjs/i18n/ja.json +34 -0
  96. package/lib/commonjs/i18n/ko.json +34 -0
  97. package/lib/commonjs/i18n/nl.json +34 -0
  98. package/lib/commonjs/i18n/pt-br.json +38 -0
  99. package/lib/commonjs/i18n/ru.json +42 -0
  100. package/lib/commonjs/i18n/tr.json +34 -0
  101. package/lib/commonjs/icons/Back.js +19 -0
  102. package/lib/commonjs/icons/Back.js.map +1 -0
  103. package/lib/commonjs/icons/DragHandle.js +21 -0
  104. package/lib/commonjs/icons/DragHandle.js.map +1 -0
  105. package/lib/commonjs/icons/PollThumbnail.js +19 -0
  106. package/lib/commonjs/icons/PollThumbnail.js.map +1 -0
  107. package/lib/commonjs/icons/SendPoll.js +19 -0
  108. package/lib/commonjs/icons/SendPoll.js.map +1 -0
  109. package/lib/commonjs/icons/index.js +44 -0
  110. package/lib/commonjs/icons/index.js.map +1 -1
  111. package/lib/commonjs/store/QuickSqliteClient.js +1 -1
  112. package/lib/commonjs/store/apis/index.js +11 -0
  113. package/lib/commonjs/store/apis/index.js.map +1 -1
  114. package/lib/commonjs/store/apis/updatePollMessage.js +50 -0
  115. package/lib/commonjs/store/apis/updatePollMessage.js.map +1 -0
  116. package/lib/commonjs/store/mappers/mapMessageToStorable.js +5 -1
  117. package/lib/commonjs/store/mappers/mapMessageToStorable.js.map +1 -1
  118. package/lib/commonjs/store/mappers/mapStorableToMessage.js +5 -1
  119. package/lib/commonjs/store/mappers/mapStorableToMessage.js.map +1 -1
  120. package/lib/commonjs/store/schema.js +2 -0
  121. package/lib/commonjs/store/schema.js.map +1 -1
  122. package/lib/commonjs/version.json +1 -1
  123. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +27 -0
  124. package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
  125. package/lib/module/components/Channel/Channel.js +17 -4
  126. package/lib/module/components/Channel/Channel.js.map +1 -1
  127. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -1
  128. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  129. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +5 -1
  130. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  131. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +46 -3
  132. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  133. package/lib/module/components/Chat/Chat.js +2 -0
  134. package/lib/module/components/Chat/Chat.js.map +1 -1
  135. package/lib/module/components/Chat/hooks/handleEventToSyncDB.js +10 -0
  136. package/lib/module/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
  137. package/lib/module/components/Message/Message.js +13 -0
  138. package/lib/module/components/Message/Message.js.map +1 -1
  139. package/lib/module/components/Message/MessageSimple/MessageContent.js +31 -15
  140. package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
  141. package/lib/module/components/MessageInput/MessageInput.js +44 -1
  142. package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
  143. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js +18 -1
  144. package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -1
  145. package/lib/module/components/MessageOverlay/MessageOverlay.js +10 -0
  146. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  147. package/lib/module/components/Poll/CreatePollContent.js +386 -0
  148. package/lib/module/components/Poll/CreatePollContent.js.map +1 -0
  149. package/lib/module/components/Poll/Poll.js +112 -0
  150. package/lib/module/components/Poll/Poll.js.map +1 -0
  151. package/lib/module/components/Poll/components/Button.js +513 -0
  152. package/lib/module/components/Poll/components/Button.js.map +1 -0
  153. package/lib/module/components/Poll/components/CreatePollIcon.js +23 -0
  154. package/lib/module/components/Poll/components/CreatePollIcon.js.map +1 -0
  155. package/lib/module/components/Poll/components/CreatePollOptions.js +281 -0
  156. package/lib/module/components/Poll/components/CreatePollOptions.js.map +1 -0
  157. package/lib/module/components/Poll/components/PollAnswersList.js +154 -0
  158. package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -0
  159. package/lib/module/components/Poll/components/PollInputDialog.js +139 -0
  160. package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -0
  161. package/lib/module/components/Poll/components/PollModalHeader.js +60 -0
  162. package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -0
  163. package/lib/module/components/Poll/components/PollOption.js +209 -0
  164. package/lib/module/components/Poll/components/PollOption.js.map +1 -0
  165. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +123 -0
  166. package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -0
  167. package/lib/module/components/Poll/components/PollResults/PollResultItem.js +152 -0
  168. package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -0
  169. package/lib/module/components/Poll/components/PollResults/PollResults.js +101 -0
  170. package/lib/module/components/Poll/components/PollResults/PollResults.js.map +1 -0
  171. package/lib/module/components/Poll/components/PollResults/index.js +37 -0
  172. package/lib/module/components/Poll/components/PollResults/index.js.map +1 -0
  173. package/lib/module/components/Poll/components/index.js +92 -0
  174. package/lib/module/components/Poll/components/index.js.map +1 -0
  175. package/lib/module/components/Poll/hooks/usePollAnswersPagination.js +129 -0
  176. package/lib/module/components/Poll/hooks/usePollAnswersPagination.js.map +1 -0
  177. package/lib/module/components/Poll/hooks/usePollOptionVotesPagination.js +140 -0
  178. package/lib/module/components/Poll/hooks/usePollOptionVotesPagination.js.map +1 -0
  179. package/lib/module/components/Poll/hooks/usePollState.js +103 -0
  180. package/lib/module/components/Poll/hooks/usePollState.js.map +1 -0
  181. package/lib/module/components/Poll/hooks/usePollStateStore.js +13 -0
  182. package/lib/module/components/Poll/hooks/usePollStateStore.js.map +1 -0
  183. package/lib/module/components/Poll/index.js +81 -0
  184. package/lib/module/components/Poll/index.js.map +1 -0
  185. package/lib/module/components/Reply/Reply.js +1 -1
  186. package/lib/module/components/Reply/Reply.js.map +1 -1
  187. package/lib/module/components/index.js +11 -0
  188. package/lib/module/components/index.js.map +1 -1
  189. package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
  190. package/lib/module/contexts/index.js +11 -0
  191. package/lib/module/contexts/index.js.map +1 -1
  192. package/lib/module/contexts/messageInputContext/MessageInputContext.js +26 -3
  193. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  194. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -1
  195. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  196. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  197. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  198. package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
  199. package/lib/module/contexts/overlayContext/OverlayProvider.js +4 -0
  200. package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
  201. package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +3 -0
  202. package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
  203. package/lib/module/contexts/pollContext/createPollContentContext.js +33 -0
  204. package/lib/module/contexts/pollContext/createPollContentContext.js.map +1 -0
  205. package/lib/module/contexts/pollContext/index.js +26 -0
  206. package/lib/module/contexts/pollContext/index.js.map +1 -0
  207. package/lib/module/contexts/pollContext/pollContext.js +33 -0
  208. package/lib/module/contexts/pollContext/pollContext.js.map +1 -0
  209. package/lib/module/contexts/themeContext/utils/theme.js +126 -0
  210. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  211. package/lib/module/i18n/en.json +34 -0
  212. package/lib/module/i18n/es.json +38 -0
  213. package/lib/module/i18n/fr.json +38 -0
  214. package/lib/module/i18n/he.json +38 -0
  215. package/lib/module/i18n/hi.json +34 -0
  216. package/lib/module/i18n/it.json +38 -0
  217. package/lib/module/i18n/ja.json +34 -0
  218. package/lib/module/i18n/ko.json +34 -0
  219. package/lib/module/i18n/nl.json +34 -0
  220. package/lib/module/i18n/pt-br.json +38 -0
  221. package/lib/module/i18n/ru.json +42 -0
  222. package/lib/module/i18n/tr.json +34 -0
  223. package/lib/module/icons/Back.js +19 -0
  224. package/lib/module/icons/Back.js.map +1 -0
  225. package/lib/module/icons/DragHandle.js +21 -0
  226. package/lib/module/icons/DragHandle.js.map +1 -0
  227. package/lib/module/icons/PollThumbnail.js +19 -0
  228. package/lib/module/icons/PollThumbnail.js.map +1 -0
  229. package/lib/module/icons/SendPoll.js +19 -0
  230. package/lib/module/icons/SendPoll.js.map +1 -0
  231. package/lib/module/icons/index.js +44 -0
  232. package/lib/module/icons/index.js.map +1 -1
  233. package/lib/module/store/QuickSqliteClient.js +1 -1
  234. package/lib/module/store/apis/index.js +11 -0
  235. package/lib/module/store/apis/index.js.map +1 -1
  236. package/lib/module/store/apis/updatePollMessage.js +50 -0
  237. package/lib/module/store/apis/updatePollMessage.js.map +1 -0
  238. package/lib/module/store/mappers/mapMessageToStorable.js +5 -1
  239. package/lib/module/store/mappers/mapMessageToStorable.js.map +1 -1
  240. package/lib/module/store/mappers/mapStorableToMessage.js +5 -1
  241. package/lib/module/store/mappers/mapStorableToMessage.js.map +1 -1
  242. package/lib/module/store/schema.js +2 -0
  243. package/lib/module/store/schema.js.map +1 -1
  244. package/lib/module/version.json +1 -1
  245. package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
  246. package/lib/typescript/components/Channel/Channel.d.ts +2 -2
  247. package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
  248. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  249. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
  250. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  251. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
  252. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +5 -1
  253. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
  254. package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
  255. package/lib/typescript/components/Chat/hooks/handleEventToSyncDB.d.ts.map +1 -1
  256. package/lib/typescript/components/Message/Message.d.ts +1 -1
  257. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  258. package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
  259. package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
  260. package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
  261. package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts.map +1 -1
  262. package/lib/typescript/components/MessageOverlay/MessageOverlay.d.ts.map +1 -1
  263. package/lib/typescript/components/Poll/CreatePollContent.d.ts +6 -0
  264. package/lib/typescript/components/Poll/CreatePollContent.d.ts.map +1 -0
  265. package/lib/typescript/components/Poll/Poll.d.ts +13 -0
  266. package/lib/typescript/components/Poll/Poll.d.ts.map +1 -0
  267. package/lib/typescript/components/Poll/components/Button.d.ts +35 -0
  268. package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -0
  269. package/lib/typescript/components/Poll/components/CreatePollIcon.d.ts +3 -0
  270. package/lib/typescript/components/Poll/components/CreatePollIcon.d.ts.map +1 -0
  271. package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts +34 -0
  272. package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts.map +1 -0
  273. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts +15 -0
  274. package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -0
  275. package/lib/typescript/components/Poll/components/PollInputDialog.d.ts +10 -0
  276. package/lib/typescript/components/Poll/components/PollInputDialog.d.ts.map +1 -0
  277. package/lib/typescript/components/Poll/components/PollModalHeader.d.ts +7 -0
  278. package/lib/typescript/components/Poll/components/PollModalHeader.d.ts.map +1 -0
  279. package/lib/typescript/components/Poll/components/PollOption.d.ts +16 -0
  280. package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -0
  281. package/lib/typescript/components/Poll/components/PollResults/PollOptionFullResults.d.ts +18 -0
  282. package/lib/typescript/components/Poll/components/PollResults/PollOptionFullResults.d.ts.map +1 -0
  283. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +9 -0
  284. package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -0
  285. package/lib/typescript/components/Poll/components/PollResults/PollResults.d.ts +10 -0
  286. package/lib/typescript/components/Poll/components/PollResults/PollResults.d.ts.map +1 -0
  287. package/lib/typescript/components/Poll/components/PollResults/index.d.ts +4 -0
  288. package/lib/typescript/components/Poll/components/PollResults/index.d.ts.map +1 -0
  289. package/lib/typescript/components/Poll/components/index.d.ts +9 -0
  290. package/lib/typescript/components/Poll/components/index.d.ts.map +1 -0
  291. package/lib/typescript/components/Poll/hooks/usePollAnswersPagination.d.ts +29 -0
  292. package/lib/typescript/components/Poll/hooks/usePollAnswersPagination.d.ts.map +1 -0
  293. package/lib/typescript/components/Poll/hooks/usePollOptionVotesPagination.d.ts +32 -0
  294. package/lib/typescript/components/Poll/hooks/usePollOptionVotesPagination.d.ts.map +1 -0
  295. package/lib/typescript/components/Poll/hooks/usePollState.d.ts +26 -0
  296. package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -0
  297. package/lib/typescript/components/Poll/hooks/usePollStateStore.d.ts +3 -0
  298. package/lib/typescript/components/Poll/hooks/usePollStateStore.d.ts.map +1 -0
  299. package/lib/typescript/components/Poll/index.d.ts +8 -0
  300. package/lib/typescript/components/Poll/index.d.ts.map +1 -0
  301. package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
  302. package/lib/typescript/components/index.d.ts +1 -0
  303. package/lib/typescript/components/index.d.ts.map +1 -1
  304. package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +7 -1
  305. package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts.map +1 -1
  306. package/lib/typescript/contexts/index.d.ts +1 -0
  307. package/lib/typescript/contexts/index.d.ts.map +1 -1
  308. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +11 -2
  309. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
  310. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  311. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
  312. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +2 -1
  313. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts.map +1 -1
  314. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +9 -1
  315. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
  316. package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
  317. package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts.map +1 -1
  318. package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
  319. package/lib/typescript/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.d.ts +3 -0
  320. package/lib/typescript/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.d.ts.map +1 -1
  321. package/lib/typescript/contexts/pollContext/createPollContentContext.d.ts +20 -0
  322. package/lib/typescript/contexts/pollContext/createPollContentContext.d.ts.map +1 -0
  323. package/lib/typescript/contexts/pollContext/index.d.ts +3 -0
  324. package/lib/typescript/contexts/pollContext/index.d.ts.map +1 -0
  325. package/lib/typescript/contexts/pollContext/pollContext.d.ts +14 -0
  326. package/lib/typescript/contexts/pollContext/pollContext.d.ts.map +1 -0
  327. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +126 -0
  328. package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
  329. package/lib/typescript/i18n/en.json +34 -0
  330. package/lib/typescript/i18n/es.json +38 -0
  331. package/lib/typescript/i18n/fr.json +38 -0
  332. package/lib/typescript/i18n/he.json +38 -0
  333. package/lib/typescript/i18n/hi.json +34 -0
  334. package/lib/typescript/i18n/it.json +38 -0
  335. package/lib/typescript/i18n/ja.json +34 -0
  336. package/lib/typescript/i18n/ko.json +34 -0
  337. package/lib/typescript/i18n/nl.json +34 -0
  338. package/lib/typescript/i18n/pt-br.json +38 -0
  339. package/lib/typescript/i18n/ru.json +42 -0
  340. package/lib/typescript/i18n/tr.json +34 -0
  341. package/lib/typescript/icons/Back.d.ts +4 -0
  342. package/lib/typescript/icons/Back.d.ts.map +1 -0
  343. package/lib/typescript/icons/DragHandle.d.ts +4 -0
  344. package/lib/typescript/icons/DragHandle.d.ts.map +1 -0
  345. package/lib/typescript/icons/PollThumbnail.d.ts +4 -0
  346. package/lib/typescript/icons/PollThumbnail.d.ts.map +1 -0
  347. package/lib/typescript/icons/SendPoll.d.ts +4 -0
  348. package/lib/typescript/icons/SendPoll.d.ts.map +1 -0
  349. package/lib/typescript/icons/index.d.ts +4 -0
  350. package/lib/typescript/icons/index.d.ts.map +1 -1
  351. package/lib/typescript/store/apis/index.d.ts +1 -0
  352. package/lib/typescript/store/apis/index.d.ts.map +1 -1
  353. package/lib/typescript/store/apis/updatePollMessage.d.ts +7 -0
  354. package/lib/typescript/store/apis/updatePollMessage.d.ts.map +1 -0
  355. package/lib/typescript/store/mappers/mapMessageToStorable.d.ts.map +1 -1
  356. package/lib/typescript/store/mappers/mapStorableToMessage.d.ts.map +1 -1
  357. package/lib/typescript/store/schema.d.ts +2 -0
  358. package/lib/typescript/store/schema.d.ts.map +1 -1
  359. package/lib/typescript/utils/i18n/Streami18n.d.ts +34 -0
  360. package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
  361. package/package.json +2 -2
  362. package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +35 -2
  363. package/src/components/Channel/Channel.tsx +27 -4
  364. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +16 -1
  365. package/src/components/Channel/hooks/useCreateMessagesContext.ts +5 -0
  366. package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +63 -4
  367. package/src/components/Chat/Chat.tsx +2 -0
  368. package/src/components/Chat/hooks/handleEventToSyncDB.ts +19 -0
  369. package/src/components/Message/Message.tsx +15 -1
  370. package/src/components/Message/MessageSimple/MessageContent.tsx +16 -0
  371. package/src/components/MessageInput/MessageInput.tsx +58 -1
  372. package/src/components/MessageInput/__tests__/MessageInput.test.js +2 -0
  373. package/src/components/MessageInput/components/NativeAttachmentPicker.tsx +29 -2
  374. package/src/components/MessageOverlay/MessageOverlay.tsx +10 -0
  375. package/src/components/Poll/CreatePollContent.tsx +299 -0
  376. package/src/components/Poll/Poll.tsx +126 -0
  377. package/src/components/Poll/components/Button.tsx +465 -0
  378. package/src/components/Poll/components/CreatePollIcon.tsx +14 -0
  379. package/src/components/Poll/components/CreatePollOptions.tsx +351 -0
  380. package/src/components/Poll/components/PollAnswersList.tsx +134 -0
  381. package/src/components/Poll/components/PollInputDialog.tsx +117 -0
  382. package/src/components/Poll/components/PollModalHeader.tsx +42 -0
  383. package/src/components/Poll/components/PollOption.tsx +172 -0
  384. package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +108 -0
  385. package/src/components/Poll/components/PollResults/PollResultItem.tsx +115 -0
  386. package/src/components/Poll/components/PollResults/PollResults.tsx +79 -0
  387. package/src/components/Poll/components/PollResults/index.ts +3 -0
  388. package/src/components/Poll/components/index.ts +8 -0
  389. package/src/components/Poll/hooks/usePollAnswersPagination.ts +109 -0
  390. package/src/components/Poll/hooks/usePollOptionVotesPagination.ts +119 -0
  391. package/src/components/Poll/hooks/usePollState.ts +122 -0
  392. package/src/components/Poll/hooks/usePollStateStore.ts +13 -0
  393. package/src/components/Poll/index.ts +10 -0
  394. package/src/components/Reply/Reply.tsx +2 -0
  395. package/src/components/index.ts +1 -0
  396. package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +12 -1
  397. package/src/contexts/index.ts +1 -0
  398. package/src/contexts/messageInputContext/MessageInputContext.tsx +38 -10
  399. package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx +4 -2
  400. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +9 -0
  401. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +2 -1
  402. package/src/contexts/messagesContext/MessagesContext.tsx +15 -2
  403. package/src/contexts/overlayContext/OverlayContext.tsx +1 -0
  404. package/src/contexts/overlayContext/OverlayProvider.tsx +3 -0
  405. package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx +3 -0
  406. package/src/contexts/pollContext/createPollContentContext.tsx +49 -0
  407. package/src/contexts/pollContext/index.ts +2 -0
  408. package/src/contexts/pollContext/pollContext.tsx +43 -0
  409. package/src/contexts/themeContext/utils/theme.ts +233 -0
  410. package/src/i18n/en.json +34 -0
  411. package/src/i18n/es.json +38 -0
  412. package/src/i18n/fr.json +38 -0
  413. package/src/i18n/he.json +38 -0
  414. package/src/i18n/hi.json +34 -0
  415. package/src/i18n/it.json +38 -0
  416. package/src/i18n/ja.json +34 -0
  417. package/src/i18n/ko.json +34 -0
  418. package/src/i18n/nl.json +34 -0
  419. package/src/i18n/pt-br.json +38 -0
  420. package/src/i18n/ru.json +42 -0
  421. package/src/i18n/tr.json +34 -0
  422. package/src/icons/Back.tsx +12 -0
  423. package/src/icons/DragHandle.tsx +9 -0
  424. package/src/icons/PollThumbnail.tsx +12 -0
  425. package/src/icons/SendPoll.tsx +12 -0
  426. package/src/icons/index.ts +4 -0
  427. package/src/store/QuickSqliteClient.ts +1 -1
  428. package/src/store/apis/index.ts +1 -0
  429. package/src/store/apis/updatePollMessage.ts +48 -0
  430. package/src/store/mappers/mapMessageToStorable.ts +4 -0
  431. package/src/store/mappers/mapStorableToMessage.ts +4 -0
  432. package/src/store/schema.ts +4 -0
  433. package/src/version.json +1 -1
@@ -1,4 +1,4 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import React, { useCallback, useMemo, useState } from 'react';
2
2
  import { GestureResponderEvent, Keyboard, StyleProp, View, ViewStyle } from 'react-native';
3
3
 
4
4
  import type { Attachment, UserResponse } from 'stream-chat';
@@ -54,6 +54,7 @@ import {
54
54
  MessageType,
55
55
  } from '../MessageList/hooks/useMessageList';
56
56
  import type { MessageActionListItemProps } from '../MessageOverlay/MessageActionListItem';
57
+ import { Poll as PollComponent } from '../Poll';
57
58
 
58
59
  export type TouchableEmitter =
59
60
  | 'fileAttachment'
@@ -175,6 +176,7 @@ export type MessagePropsWithContext<
175
176
  | 'setQuotedMessageState'
176
177
  | 'supportedReactions'
177
178
  | 'updateMessage'
179
+ | 'PollContent'
178
180
  > &
179
181
  Pick<MessageOverlayContextValue<StreamChatGenerics>, 'setData'> &
180
182
  Pick<OverlayContextValue, 'setOverlay'> &
@@ -284,6 +286,7 @@ const MessageWithContext = <
284
286
  onThreadSelect,
285
287
  openThread,
286
288
  OverlayReactionList,
289
+ PollContent,
287
290
  preventPress,
288
291
  removeMessage,
289
292
  retrySendMessage,
@@ -451,6 +454,8 @@ const MessageWithContext = <
451
454
  return !!attachments.files.length;
452
455
  case 'gallery':
453
456
  return !!attachments.images.length || !!attachments.videos.length;
457
+ case 'poll':
458
+ return !!message.poll_id;
454
459
  case 'text':
455
460
  default:
456
461
  return !!message.text;
@@ -561,6 +566,14 @@ const MessageWithContext = <
561
566
 
562
567
  const { userLanguage } = useTranslationContext();
563
568
 
569
+ // TODO: Can be removed in V6 and from here completely once it becomes baseline.
570
+ const PollWrapper = useCallback(() => {
571
+ const poll = message?.poll_id ? client.polls.fromState(message.poll_id) : undefined;
572
+ return message?.poll_id && poll ? (
573
+ <PollComponent<StreamChatGenerics> message={message} poll={poll} PollContent={PollContent} />
574
+ ) : null;
575
+ }, [PollContent, client, message]);
576
+
564
577
  const showMessageOverlay = async (isMessageActionsVisible = true, error = errorOrFailed) => {
565
578
  await dismissKeyboard();
566
579
 
@@ -611,6 +624,7 @@ const MessageWithContext = <
611
624
  otherAttachments: attachments.other,
612
625
  OverlayReactionList,
613
626
  ownCapabilities,
627
+ Poll: PollWrapper,
614
628
  supportedReactions,
615
629
  threadList,
616
630
  userLanguage,
@@ -9,6 +9,7 @@ import {
9
9
 
10
10
  import { MessageTextContainer } from './MessageTextContainer';
11
11
 
12
+ import { useChatContext } from '../../../contexts';
12
13
  import {
13
14
  MessageContextValue,
14
15
  useMessageContext,
@@ -26,6 +27,7 @@ import {
26
27
  import { useViewport } from '../../../hooks/useViewport';
27
28
  import type { DefaultStreamChatGenerics } from '../../../types/types';
28
29
  import { MessageStatusTypes } from '../../../utils/utils';
30
+ import { Poll } from '../../Poll/Poll';
29
31
 
30
32
  const styles = StyleSheet.create({
31
33
  containerInner: {
@@ -142,6 +144,8 @@ const MessageContentWithContext = <
142
144
  showMessageStatus,
143
145
  threadList,
144
146
  } = props;
147
+ const { client } = useChatContext();
148
+ const { PollContent: PollContentOverride } = useMessagesContext();
145
149
 
146
150
  const {
147
151
  theme: {
@@ -377,6 +381,18 @@ const MessageContentWithContext = <
377
381
  );
378
382
  case 'gallery':
379
383
  return <Gallery key={`gallery_${messageContentOrderIndex}`} />;
384
+ case 'poll': {
385
+ const pollId = message.poll_id;
386
+ const poll = pollId && client.polls.fromState(pollId);
387
+ return pollId && poll ? (
388
+ <Poll
389
+ key={`poll_${message.poll_id}`}
390
+ message={message}
391
+ poll={poll}
392
+ PollContent={PollContentOverride}
393
+ />
394
+ ) : null;
395
+ }
380
396
  case 'text':
381
397
  default:
382
398
  return otherAttachments.length && otherAttachments[0].actions ? null : (
@@ -1,9 +1,17 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
- import { NativeSyntheticEvent, StyleSheet, TextInputFocusEventData, View } from 'react-native';
2
+ import {
3
+ Modal,
4
+ NativeSyntheticEvent,
5
+ SafeAreaView,
6
+ StyleSheet,
7
+ TextInputFocusEventData,
8
+ View,
9
+ } from 'react-native';
3
10
 
4
11
  import {
5
12
  Gesture,
6
13
  GestureDetector,
14
+ GestureHandlerRootView,
7
15
  PanGestureHandlerEventPayload,
8
16
  } from 'react-native-gesture-handler';
9
17
  import Animated, {
@@ -51,6 +59,7 @@ import {
51
59
  import { isImageMediaLibraryAvailable, triggerHaptic } from '../../native';
52
60
  import type { Asset, DefaultStreamChatGenerics } from '../../types/types';
53
61
  import { AutoCompleteInput } from '../AutoCompleteInput/AutoCompleteInput';
62
+ import { CreatePoll } from '../Poll/CreatePollContent';
54
63
 
55
64
  const styles = StyleSheet.create({
56
65
  attachmentSeparator: {
@@ -145,6 +154,11 @@ type MessageInputPropsWithContext<
145
154
  | 'text'
146
155
  | 'uploadNewFile'
147
156
  | 'uploadNewImage'
157
+ | 'openPollCreationDialog'
158
+ | 'closePollCreationDialog'
159
+ | 'showPollCreationDialog'
160
+ | 'sendMessage'
161
+ | 'CreatePollContent'
148
162
  > &
149
163
  Pick<MessagesContextValue<StreamChatGenerics>, 'Reply'> &
150
164
  Pick<
@@ -179,8 +193,10 @@ const MessageInputWithContext = <
179
193
  AudioRecordingPreview,
180
194
  AutoCompleteSuggestionList,
181
195
  closeAttachmentPicker,
196
+ closePollCreationDialog,
182
197
  cooldownEndsAt,
183
198
  CooldownTimer,
199
+ CreatePollContent,
184
200
  editing,
185
201
  FileUploadPreview,
186
202
  fileUploads,
@@ -206,8 +222,10 @@ const MessageInputWithContext = <
206
222
  resetInput,
207
223
  SendButton,
208
224
  sending,
225
+ sendMessage,
209
226
  sendMessageAsync,
210
227
  setShowMoreOptions,
228
+ showPollCreationDialog,
211
229
  ShowThreadMessageInChannelButton,
212
230
  StartAudioRecordingButton,
213
231
  suggestions,
@@ -876,6 +894,23 @@ const MessageInputWithContext = <
876
894
  <AttachmentPickerSelectionBar />
877
895
  </View>
878
896
  )}
897
+ {showPollCreationDialog ? (
898
+ <Modal
899
+ animationType='slide'
900
+ onRequestClose={closePollCreationDialog}
901
+ visible={showPollCreationDialog}
902
+ >
903
+ <GestureHandlerRootView style={{ flex: 1 }}>
904
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
905
+ <CreatePoll
906
+ closePollCreationDialog={closePollCreationDialog}
907
+ CreatePollContent={CreatePollContent}
908
+ sendMessage={sendMessage}
909
+ />
910
+ </SafeAreaView>
911
+ </GestureHandlerRootView>
912
+ </Modal>
913
+ ) : null}
879
914
  </>
880
915
  );
881
916
  };
@@ -891,6 +926,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
891
926
  asyncMessagesSlideToCancelDistance: prevAsyncMessagesSlideToCancelDistance,
892
927
  asyncUploads: prevAsyncUploads,
893
928
  audioRecordingEnabled: prevAsyncMessagesEnabled,
929
+ closePollCreationDialog: prevClosePollCreationDialog,
894
930
  editing: prevEditing,
895
931
  fileUploads: prevFileUploads,
896
932
  giphyActive: prevGiphyActive,
@@ -898,9 +934,11 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
898
934
  isOnline: prevIsOnline,
899
935
  isValidMessage: prevIsValidMessage,
900
936
  mentionedUsers: prevMentionedUsers,
937
+ openPollCreationDialog: prevOpenPollCreationDialog,
901
938
  quotedMessage: prevQuotedMessage,
902
939
  sending: prevSending,
903
940
  showMoreOptions: prevShowMoreOptions,
941
+ showPollCreationDialog: prevShowPollCreationDialog,
904
942
  suggestions: prevSuggestions,
905
943
  t: prevT,
906
944
  thread: prevThread,
@@ -913,6 +951,7 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
913
951
  asyncMessagesSlideToCancelDistance: nextAsyncMessagesSlideToCancelDistance,
914
952
  asyncUploads: nextAsyncUploads,
915
953
  audioRecordingEnabled: nextAsyncMessagesEnabled,
954
+ closePollCreationDialog: nextClosePollCreationDialog,
916
955
  editing: nextEditing,
917
956
  fileUploads: nextFileUploads,
918
957
  giphyActive: nextGiphyActive,
@@ -920,9 +959,11 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
920
959
  isOnline: nextIsOnline,
921
960
  isValidMessage: nextIsValidMessage,
922
961
  mentionedUsers: nextMentionedUsers,
962
+ openPollCreationDialog: nextOpenPollCreationDialog,
923
963
  quotedMessage: nextQuotedMessage,
924
964
  sending: nextSending,
925
965
  showMoreOptions: nextShowMoreOptions,
966
+ showPollCreationDialog: nextShowPollCreationDialog,
926
967
  suggestions: nextSuggestions,
927
968
  t: nextT,
928
969
  thread: nextThread,
@@ -932,6 +973,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
932
973
  const tEqual = prevT === nextT;
933
974
  if (!tEqual) return false;
934
975
 
976
+ const pollCreationInputPropsEqual =
977
+ prevOpenPollCreationDialog === nextOpenPollCreationDialog &&
978
+ prevClosePollCreationDialog === nextClosePollCreationDialog &&
979
+ prevShowPollCreationDialog === nextShowPollCreationDialog;
980
+ if (!pollCreationInputPropsEqual) return false;
981
+
935
982
  const additionalTextInputPropsEven =
936
983
  prevAdditionalTextInputProps === nextAdditionalTextInputProps;
937
984
  if (!additionalTextInputPropsEven) return false;
@@ -1059,8 +1106,10 @@ export const MessageInput = <
1059
1106
  clearEditingState,
1060
1107
  clearQuotedMessageState,
1061
1108
  closeAttachmentPicker,
1109
+ closePollCreationDialog,
1062
1110
  cooldownEndsAt,
1063
1111
  CooldownTimer,
1112
+ CreatePollContent,
1064
1113
  editing,
1065
1114
  FileUploadPreview,
1066
1115
  fileUploads,
@@ -1077,17 +1126,20 @@ export const MessageInput = <
1077
1126
  maxNumberOfFiles,
1078
1127
  mentionedUsers,
1079
1128
  numberOfUploads,
1129
+ openPollCreationDialog,
1080
1130
  quotedMessage,
1081
1131
  removeFile,
1082
1132
  removeImage,
1083
1133
  resetInput,
1084
1134
  SendButton,
1085
1135
  sending,
1136
+ sendMessage,
1086
1137
  sendMessageAsync,
1087
1138
  SendMessageDisallowedIndicator,
1088
1139
  setGiphyActive,
1089
1140
  setShowMoreOptions,
1090
1141
  showMoreOptions,
1142
+ showPollCreationDialog,
1091
1143
  ShowThreadMessageInChannelButton,
1092
1144
  StartAudioRecordingButton,
1093
1145
  text,
@@ -1140,8 +1192,10 @@ export const MessageInput = <
1140
1192
  clearEditingState,
1141
1193
  clearQuotedMessageState,
1142
1194
  closeAttachmentPicker,
1195
+ closePollCreationDialog,
1143
1196
  cooldownEndsAt,
1144
1197
  CooldownTimer,
1198
+ CreatePollContent,
1145
1199
  editing,
1146
1200
  FileUploadPreview,
1147
1201
  fileUploads,
@@ -1160,6 +1214,7 @@ export const MessageInput = <
1160
1214
  members,
1161
1215
  mentionedUsers,
1162
1216
  numberOfUploads,
1217
+ openPollCreationDialog,
1163
1218
  quotedMessage,
1164
1219
  removeFile,
1165
1220
  removeImage,
@@ -1167,11 +1222,13 @@ export const MessageInput = <
1167
1222
  resetInput,
1168
1223
  SendButton,
1169
1224
  sending,
1225
+ sendMessage,
1170
1226
  sendMessageAsync,
1171
1227
  SendMessageDisallowedIndicator,
1172
1228
  setGiphyActive,
1173
1229
  setShowMoreOptions,
1174
1230
  showMoreOptions,
1231
+ showPollCreationDialog,
1175
1232
  ShowThreadMessageInChannelButton,
1176
1233
  StartAudioRecordingButton,
1177
1234
  suggestions,
@@ -23,6 +23,7 @@ import { FileSelectorIcon } from '../../AttachmentPicker/components/FileSelector
23
23
  import { ImageSelectorIcon } from '../../AttachmentPicker/components/ImageSelectorIcon';
24
24
  import { Channel } from '../../Channel/Channel';
25
25
  import { Chat } from '../../Chat/Chat';
26
+ import { CreatePollIcon } from '../../Poll';
26
27
  import { MessageInput } from '../MessageInput';
27
28
 
28
29
  describe('MessageInput', () => {
@@ -32,6 +33,7 @@ describe('MessageInput', () => {
32
33
  AttachmentPickerSelectionBar,
33
34
  CameraSelectorIcon,
34
35
  closePicker: jest.fn(),
36
+ CreatePollIcon,
35
37
  FileSelectorIcon,
36
38
  ImageSelectorIcon,
37
39
  openPicker: jest.fn(),
@@ -1,12 +1,18 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import { Animated, Easing, LayoutRectangle, Pressable, StyleSheet } from 'react-native';
3
3
 
4
+ import {
5
+ useChannelContext,
6
+ useMessagesContext,
7
+ useOwnCapabilitiesContext,
8
+ } from '../../../contexts';
4
9
  import { useMessageInputContext } from '../../../contexts/messageInputContext/MessageInputContext';
5
10
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
6
11
 
7
12
  import { CameraSelectorIcon } from '../../AttachmentPicker/components/CameraSelectorIcon';
8
13
  import { FileSelectorIcon } from '../../AttachmentPicker/components/FileSelectorIcon';
9
14
  import { ImageSelectorIcon } from '../../AttachmentPicker/components/ImageSelectorIcon';
15
+ import { CreatePollIcon } from '../../Poll/components/CreatePollIcon';
10
16
 
11
17
  type NativeAttachmentPickerProps = {
12
18
  onRequestedClose: () => void;
@@ -38,10 +44,15 @@ export const NativeAttachmentPicker = ({
38
44
  const {
39
45
  hasFilePicker,
40
46
  hasImagePicker,
47
+ openPollCreationDialog,
41
48
  pickAndUploadImageFromNativePicker,
42
49
  pickFile,
50
+ sendMessage,
43
51
  takeAndUploadImage,
44
52
  } = useMessageInputContext();
53
+ const { threadList } = useChannelContext();
54
+ const { hasCreatePoll } = useMessagesContext();
55
+ const ownCapabilities = useOwnCapabilitiesContext();
45
56
 
46
57
  const popupHeight =
47
58
  // the top padding
@@ -91,7 +102,11 @@ export const NativeAttachmentPicker = ({
91
102
  width: size,
92
103
  };
93
104
 
94
- const onClose = ({ onPressHandler }: { onPressHandler?: () => Promise<void> }) => {
105
+ const onClose = ({
106
+ onPressHandler,
107
+ }: {
108
+ onPressHandler?: (() => Promise<void>) | (() => void);
109
+ }) => {
95
110
  if (onPressHandler) {
96
111
  onPressHandler();
97
112
  }
@@ -103,7 +118,19 @@ export const NativeAttachmentPicker = ({
103
118
  }).start(onRequestedClose);
104
119
  };
105
120
 
106
- const buttons = [];
121
+ // do not allow poll creation in threads
122
+ const buttons =
123
+ threadList && hasCreatePoll && ownCapabilities.sendPoll
124
+ ? []
125
+ : [
126
+ {
127
+ icon: <CreatePollIcon />,
128
+ id: 'Poll',
129
+ onPressHandler: () => {
130
+ openPollCreationDialog?.({ sendMessage });
131
+ },
132
+ },
133
+ ];
107
134
 
108
135
  if (hasImagePicker) {
109
136
  buttons.push({
@@ -25,6 +25,7 @@ import { MessageActionList as DefaultMessageActionList } from './MessageActionLi
25
25
  import { OverlayReactionList as OverlayReactionListDefault } from './OverlayReactionList';
26
26
  import { OverlayReactionsAvatar as OverlayReactionsAvatarDefault } from './OverlayReactionsAvatar';
27
27
 
28
+ import { OwnCapabilitiesProvider } from '../../contexts';
28
29
  import { ChatProvider } from '../../contexts/chatContext/ChatContext';
29
30
  import { MessageProvider } from '../../contexts/messageContext/MessageContext';
30
31
  import {
@@ -135,6 +136,7 @@ const MessageOverlayWithContext = <
135
136
  OverlayReactions = DefaultOverlayReactions,
136
137
  OverlayReactionsAvatar = OverlayReactionsAvatarDefault,
137
138
  ownCapabilities,
139
+ Poll,
138
140
  setOverlay,
139
141
  threadList,
140
142
  videos,
@@ -441,6 +443,14 @@ const MessageOverlayWithContext = <
441
443
  />
442
444
  )
443
445
  );
446
+ case 'poll': {
447
+ const pollId = message.poll_id;
448
+ return Poll && pollId && ownCapabilities ? (
449
+ <OwnCapabilitiesProvider key={`poll_${pollId}`} value={ownCapabilities}>
450
+ <Poll />
451
+ </OwnCapabilitiesProvider>
452
+ ) : null;
453
+ }
444
454
  case 'text':
445
455
  default:
446
456
  return otherAttachments?.length && otherAttachments[0].actions ? null : (