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
@@ -0,0 +1,465 @@
1
+ import React, { useCallback, useState } from 'react';
2
+ import { Modal, SafeAreaView, StyleSheet, Text, TouchableOpacity } from 'react-native';
3
+
4
+ import { Poll, PollOption } from 'stream-chat';
5
+
6
+ import { PollAnswersList } from './PollAnswersList';
7
+ import { PollInputDialog } from './PollInputDialog';
8
+ import { PollModalHeader } from './PollModalHeader';
9
+ import { PollAllOptions } from './PollOption';
10
+
11
+ import { PollOptionFullResults, PollResults } from './PollResults';
12
+
13
+ import {
14
+ useChatContext,
15
+ useOwnCapabilitiesContext,
16
+ usePollContext,
17
+ useTheme,
18
+ useTranslationContext,
19
+ } from '../../../contexts';
20
+ import { Check } from '../../../icons';
21
+ import type { DefaultStreamChatGenerics } from '../../../types/types';
22
+ import { MessageType } from '../../MessageList/hooks/useMessageList';
23
+ import { usePollState } from '../hooks/usePollState';
24
+
25
+ export type PollButtonProps<
26
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
27
+ > = {
28
+ onPress?: ({
29
+ message,
30
+ poll,
31
+ }: {
32
+ message: MessageType<StreamChatGenerics>;
33
+ poll: Poll<StreamChatGenerics>;
34
+ }) => void;
35
+ };
36
+
37
+ export type ShowAllVotesButtonProps<
38
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
39
+ > = {
40
+ option: PollOption<StreamChatGenerics>;
41
+ onPress?: ({
42
+ message,
43
+ option,
44
+ poll,
45
+ }: {
46
+ message: MessageType<StreamChatGenerics>;
47
+ option: PollOption<StreamChatGenerics>;
48
+ poll: Poll<StreamChatGenerics>;
49
+ }) => void;
50
+ };
51
+
52
+ export type PollVoteButtonProps = {
53
+ option: PollOption;
54
+ } & Pick<PollButtonProps, 'onPress'>;
55
+
56
+ export const GenericPollButton = ({ onPress, title }: { onPress?: () => void; title?: string }) => {
57
+ const {
58
+ theme: {
59
+ colors: { accent_dark_blue },
60
+ poll: {
61
+ button: { container, text },
62
+ },
63
+ },
64
+ } = useTheme();
65
+
66
+ return (
67
+ <TouchableOpacity onPress={onPress} style={[styles.container, container]}>
68
+ <Text style={[styles.text, { color: accent_dark_blue }, text]}>{title}</Text>
69
+ </TouchableOpacity>
70
+ );
71
+ };
72
+
73
+ export const ViewResultsButton = (props: PollButtonProps) => {
74
+ const { t } = useTranslationContext();
75
+ const { message, poll } = usePollContext();
76
+ const [showResults, setShowResults] = useState(false);
77
+ const { onPress } = props;
78
+
79
+ const onPressHandler = useCallback(() => {
80
+ if (onPress) {
81
+ onPress({ message, poll });
82
+ return;
83
+ }
84
+
85
+ setShowResults(true);
86
+ }, [message, onPress, poll]);
87
+
88
+ const {
89
+ theme: {
90
+ colors: { white },
91
+ },
92
+ } = useTheme();
93
+
94
+ return (
95
+ <>
96
+ <GenericPollButton onPress={onPressHandler} title={t<string>('View Results')} />
97
+ {showResults ? (
98
+ <Modal
99
+ animationType='slide'
100
+ onRequestClose={() => setShowResults(false)}
101
+ visible={showResults}
102
+ >
103
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
104
+ <PollModalHeader
105
+ onPress={() => setShowResults(false)}
106
+ title={t<string>('Poll Results')}
107
+ />
108
+ <PollResults message={message} poll={poll} />
109
+ </SafeAreaView>
110
+ </Modal>
111
+ ) : null}
112
+ </>
113
+ );
114
+ };
115
+
116
+ export const EndVoteButton = () => {
117
+ const { t } = useTranslationContext();
118
+ const { created_by, endVote, is_closed } = usePollState();
119
+ const { client } = useChatContext();
120
+
121
+ return !is_closed && created_by?.id === client.userID ? (
122
+ <GenericPollButton onPress={endVote} title={t<string>('End Vote')} />
123
+ ) : null;
124
+ };
125
+
126
+ export const AddCommentButton = (props: PollButtonProps) => {
127
+ const { t } = useTranslationContext();
128
+ const { message, poll } = usePollContext();
129
+ const { addComment, allow_answers, is_closed, ownAnswer } = usePollState();
130
+ const [showAddCommentDialog, setShowAddCommentDialog] = useState(false);
131
+ const { onPress } = props;
132
+
133
+ const onPressHandler = useCallback(() => {
134
+ if (onPress) {
135
+ onPress({ message, poll });
136
+ return;
137
+ }
138
+
139
+ setShowAddCommentDialog(true);
140
+ }, [message, onPress, poll]);
141
+
142
+ return (
143
+ <>
144
+ {!is_closed && allow_answers ? (
145
+ <GenericPollButton onPress={onPressHandler} title={t<string>('Add a comment')} />
146
+ ) : null}
147
+ {showAddCommentDialog ? (
148
+ <PollInputDialog
149
+ closeDialog={() => setShowAddCommentDialog(false)}
150
+ initialValue={ownAnswer?.answer_text ?? ''}
151
+ onSubmit={addComment}
152
+ title={t<string>('Add a comment')}
153
+ visible={showAddCommentDialog}
154
+ />
155
+ ) : null}
156
+ </>
157
+ );
158
+ };
159
+
160
+ export const ShowAllCommentsButton = (props: PollButtonProps) => {
161
+ const { t } = useTranslationContext();
162
+ const { message, poll } = usePollContext();
163
+ const { answers_count } = usePollState();
164
+ const [showAnswers, setShowAnswers] = useState(false);
165
+ const { onPress } = props;
166
+
167
+ const onPressHandler = useCallback(() => {
168
+ if (onPress) {
169
+ onPress({ message, poll });
170
+ return;
171
+ }
172
+
173
+ setShowAnswers(true);
174
+ }, [message, onPress, poll]);
175
+
176
+ const {
177
+ theme: {
178
+ colors: { white },
179
+ },
180
+ } = useTheme();
181
+
182
+ return (
183
+ <>
184
+ {answers_count && answers_count > 0 ? (
185
+ <GenericPollButton
186
+ onPress={onPressHandler}
187
+ title={t<string>('View {{count}} comments', { count: answers_count })}
188
+ />
189
+ ) : null}
190
+ {showAnswers ? (
191
+ <Modal
192
+ animationType='slide'
193
+ onRequestClose={() => setShowAnswers(false)}
194
+ visible={showAnswers}
195
+ >
196
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
197
+ <PollModalHeader
198
+ onPress={() => setShowAnswers(false)}
199
+ title={t<string>('Poll Comments')}
200
+ />
201
+ <PollAnswersList message={message} poll={poll} />
202
+ </SafeAreaView>
203
+ </Modal>
204
+ ) : null}
205
+ </>
206
+ );
207
+ };
208
+
209
+ export const AnswerListAddCommentButton = (props: PollButtonProps) => {
210
+ const { t } = useTranslationContext();
211
+ const { message, poll } = usePollContext();
212
+ const { addComment, ownAnswer } = usePollState();
213
+ const [showAddCommentDialog, setShowAddCommentDialog] = useState(false);
214
+ const { onPress } = props;
215
+
216
+ const onPressHandler = useCallback(() => {
217
+ if (onPress) {
218
+ onPress({ message, poll });
219
+ return;
220
+ }
221
+
222
+ setShowAddCommentDialog(true);
223
+ }, [message, onPress, poll]);
224
+
225
+ const {
226
+ theme: {
227
+ colors: { accent_dark_blue, bg_user },
228
+ poll: {
229
+ answersList: { buttonContainer },
230
+ button: { text },
231
+ },
232
+ },
233
+ } = useTheme();
234
+
235
+ return (
236
+ <>
237
+ <TouchableOpacity
238
+ onPress={onPressHandler}
239
+ style={[
240
+ styles.answerListAddCommentContainer,
241
+ { backgroundColor: bg_user },
242
+ buttonContainer,
243
+ ]}
244
+ >
245
+ <Text style={[styles.text, { color: accent_dark_blue }, text]}>
246
+ {ownAnswer ? t<string>('Update your comment') : t<string>('Add a comment')}
247
+ </Text>
248
+ </TouchableOpacity>
249
+ {showAddCommentDialog ? (
250
+ <PollInputDialog
251
+ closeDialog={() => setShowAddCommentDialog(false)}
252
+ initialValue={ownAnswer?.answer_text ?? ''}
253
+ onSubmit={addComment}
254
+ title={t<string>('Add a comment')}
255
+ visible={showAddCommentDialog}
256
+ />
257
+ ) : null}
258
+ </>
259
+ );
260
+ };
261
+
262
+ export const SuggestOptionButton = (props: PollButtonProps) => {
263
+ const { t } = useTranslationContext();
264
+ const { message, poll } = usePollContext();
265
+ const { addOption, allow_user_suggested_options, is_closed } = usePollState();
266
+ const [showAddOptionDialog, setShowAddOptionDialog] = useState(false);
267
+ const { onPress } = props;
268
+
269
+ const onPressHandler = useCallback(() => {
270
+ if (onPress) {
271
+ onPress({ message, poll });
272
+ return;
273
+ }
274
+
275
+ setShowAddOptionDialog(true);
276
+ }, [message, onPress, poll]);
277
+
278
+ return (
279
+ <>
280
+ {!is_closed && allow_user_suggested_options ? (
281
+ <GenericPollButton onPress={onPressHandler} title={t<string>('Suggest an option')} />
282
+ ) : null}
283
+ {showAddOptionDialog ? (
284
+ <PollInputDialog
285
+ closeDialog={() => setShowAddOptionDialog(false)}
286
+ onSubmit={addOption}
287
+ title={t<string>('Suggest an option')}
288
+ visible={showAddOptionDialog}
289
+ />
290
+ ) : null}
291
+ </>
292
+ );
293
+ };
294
+
295
+ export const ShowAllOptionsButton = (props: PollButtonProps) => {
296
+ const { t } = useTranslationContext();
297
+ const [showAllOptions, setShowAllOptions] = useState(false);
298
+ const { message, poll } = usePollContext();
299
+ const { options } = usePollState();
300
+ const { onPress } = props;
301
+
302
+ const onPressHandler = useCallback(() => {
303
+ if (onPress) {
304
+ onPress({ message, poll });
305
+ return;
306
+ }
307
+
308
+ setShowAllOptions(true);
309
+ }, [message, onPress, poll]);
310
+
311
+ const {
312
+ theme: {
313
+ colors: { white },
314
+ },
315
+ } = useTheme();
316
+
317
+ return (
318
+ <>
319
+ {options && options.length > 10 ? (
320
+ <GenericPollButton
321
+ onPress={onPressHandler}
322
+ title={t<string>('See all {{count}} options', { count: options.length })}
323
+ />
324
+ ) : null}
325
+ {showAllOptions ? (
326
+ <Modal
327
+ animationType='slide'
328
+ onRequestClose={() => setShowAllOptions(false)}
329
+ visible={showAllOptions}
330
+ >
331
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
332
+ <PollModalHeader
333
+ onPress={() => setShowAllOptions(false)}
334
+ title={t<string>('Poll Options')}
335
+ />
336
+ <PollAllOptions message={message} poll={poll} />
337
+ </SafeAreaView>
338
+ </Modal>
339
+ ) : null}
340
+ </>
341
+ );
342
+ };
343
+
344
+ export const VoteButton = ({ onPress, option }: PollVoteButtonProps) => {
345
+ const { message, poll } = usePollContext();
346
+ const { is_closed, ownVotesByOptionId } = usePollState();
347
+ const ownCapabilities = useOwnCapabilitiesContext();
348
+
349
+ const {
350
+ theme: {
351
+ colors: { accent_dark_blue, disabled },
352
+ poll: {
353
+ message: {
354
+ option: { voteButtonActive, voteButtonContainer, voteButtonInactive },
355
+ },
356
+ },
357
+ },
358
+ } = useTheme();
359
+
360
+ const toggleVote = useCallback(async () => {
361
+ if (ownVotesByOptionId[option.id]) {
362
+ await poll.removeVote(ownVotesByOptionId[option.id]?.id, message.id);
363
+ } else {
364
+ await poll.castVote(option.id, message.id);
365
+ }
366
+ }, [message.id, option.id, ownVotesByOptionId, poll]);
367
+
368
+ const onPressHandler = useCallback(() => {
369
+ if (onPress) {
370
+ onPress({ message, poll });
371
+ return;
372
+ }
373
+
374
+ toggleVote();
375
+ }, [message, onPress, poll, toggleVote]);
376
+
377
+ return ownCapabilities.castPollVote && !is_closed ? (
378
+ <TouchableOpacity
379
+ onPress={onPressHandler}
380
+ style={[
381
+ styles.voteContainer,
382
+ {
383
+ backgroundColor: ownVotesByOptionId[option.id]
384
+ ? voteButtonActive || accent_dark_blue
385
+ : 'transparent',
386
+ borderColor: ownVotesByOptionId[option.id]
387
+ ? voteButtonActive || accent_dark_blue
388
+ : voteButtonInactive || disabled,
389
+ },
390
+ voteButtonContainer,
391
+ ]}
392
+ >
393
+ {ownVotesByOptionId[option.id] ? <Check height={15} pathFill='white' width={20} /> : null}
394
+ </TouchableOpacity>
395
+ ) : null;
396
+ };
397
+
398
+ export const ShowAllVotesButton = (props: ShowAllVotesButtonProps) => {
399
+ const { t } = useTranslationContext();
400
+ const { message, poll } = usePollContext();
401
+ const { vote_counts_by_option } = usePollState();
402
+ const ownCapabilities = useOwnCapabilitiesContext();
403
+ const [showAllVotes, setShowAllVotes] = useState(false);
404
+ const { onPress, option } = props;
405
+
406
+ const onPressHandler = useCallback(() => {
407
+ if (onPress) {
408
+ onPress({ message, option, poll });
409
+ return;
410
+ }
411
+
412
+ setShowAllVotes(true);
413
+ }, [message, onPress, option, poll]);
414
+
415
+ const {
416
+ theme: {
417
+ colors: { white },
418
+ },
419
+ } = useTheme();
420
+
421
+ return (
422
+ <>
423
+ {ownCapabilities.queryPollVotes &&
424
+ vote_counts_by_option &&
425
+ vote_counts_by_option?.[option.id] > 5 ? (
426
+ <GenericPollButton onPress={onPressHandler} title={t<string>('Show All')} />
427
+ ) : null}
428
+ {showAllVotes ? (
429
+ <Modal
430
+ animationType='fade'
431
+ onRequestClose={() => setShowAllVotes(false)}
432
+ visible={showAllVotes}
433
+ >
434
+ <SafeAreaView style={{ backgroundColor: white, flex: 1 }}>
435
+ <PollModalHeader onPress={() => setShowAllVotes(false)} title={option.text} />
436
+ <PollOptionFullResults message={message} option={option} poll={poll} />
437
+ </SafeAreaView>
438
+ </Modal>
439
+ ) : null}
440
+ </>
441
+ );
442
+ };
443
+
444
+ const styles = StyleSheet.create({
445
+ answerListAddCommentContainer: {
446
+ alignItems: 'center',
447
+ borderRadius: 12,
448
+ paddingHorizontal: 16,
449
+ paddingVertical: 18,
450
+ },
451
+ container: {
452
+ alignItems: 'center',
453
+ marginHorizontal: 16,
454
+ paddingVertical: 11,
455
+ },
456
+ text: { fontSize: 16 },
457
+ voteContainer: {
458
+ alignItems: 'center',
459
+ borderRadius: 18,
460
+ borderWidth: 1,
461
+ height: 18,
462
+ justifyContent: 'center',
463
+ width: 18,
464
+ },
465
+ });
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+
3
+ import { useTheme } from '../../../contexts';
4
+ import { PollThumbnail } from '../../../icons';
5
+
6
+ export const CreatePollIcon = () => {
7
+ const {
8
+ theme: {
9
+ colors: { grey },
10
+ },
11
+ } = useTheme();
12
+
13
+ return <PollThumbnail height={18} pathFill={grey} viewBox='0 0 18 18' width={18} />;
14
+ };