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.
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +27 -0
- package/lib/commonjs/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/commonjs/components/Channel/Channel.js +17 -4
- package/lib/commonjs/components/Channel/Channel.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -1
- package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +5 -1
- package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +46 -3
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/commonjs/components/Chat/Chat.js +2 -0
- package/lib/commonjs/components/Chat/Chat.js.map +1 -1
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js +10 -0
- package/lib/commonjs/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/commonjs/components/Message/Message.js +13 -0
- package/lib/commonjs/components/Message/Message.js.map +1 -1
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js +31 -15
- package/lib/commonjs/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js +44 -1
- package/lib/commonjs/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js +18 -1
- package/lib/commonjs/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -1
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +10 -0
- package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/commonjs/components/Poll/CreatePollContent.js +386 -0
- package/lib/commonjs/components/Poll/CreatePollContent.js.map +1 -0
- package/lib/commonjs/components/Poll/Poll.js +112 -0
- package/lib/commonjs/components/Poll/Poll.js.map +1 -0
- package/lib/commonjs/components/Poll/components/Button.js +513 -0
- package/lib/commonjs/components/Poll/components/Button.js.map +1 -0
- package/lib/commonjs/components/Poll/components/CreatePollIcon.js +23 -0
- package/lib/commonjs/components/Poll/components/CreatePollIcon.js.map +1 -0
- package/lib/commonjs/components/Poll/components/CreatePollOptions.js +281 -0
- package/lib/commonjs/components/Poll/components/CreatePollOptions.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollAnswersList.js +154 -0
- package/lib/commonjs/components/Poll/components/PollAnswersList.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollInputDialog.js +139 -0
- package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollModalHeader.js +60 -0
- package/lib/commonjs/components/Poll/components/PollModalHeader.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollOption.js +209 -0
- package/lib/commonjs/components/Poll/components/PollOption.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js +123 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js +152 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollResultItem.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollResults.js +101 -0
- package/lib/commonjs/components/Poll/components/PollResults/PollResults.js.map +1 -0
- package/lib/commonjs/components/Poll/components/PollResults/index.js +37 -0
- package/lib/commonjs/components/Poll/components/PollResults/index.js.map +1 -0
- package/lib/commonjs/components/Poll/components/index.js +92 -0
- package/lib/commonjs/components/Poll/components/index.js.map +1 -0
- package/lib/commonjs/components/Poll/hooks/usePollAnswersPagination.js +129 -0
- package/lib/commonjs/components/Poll/hooks/usePollAnswersPagination.js.map +1 -0
- package/lib/commonjs/components/Poll/hooks/usePollOptionVotesPagination.js +140 -0
- package/lib/commonjs/components/Poll/hooks/usePollOptionVotesPagination.js.map +1 -0
- package/lib/commonjs/components/Poll/hooks/usePollState.js +103 -0
- package/lib/commonjs/components/Poll/hooks/usePollState.js.map +1 -0
- package/lib/commonjs/components/Poll/hooks/usePollStateStore.js +13 -0
- package/lib/commonjs/components/Poll/hooks/usePollStateStore.js.map +1 -0
- package/lib/commonjs/components/Poll/index.js +81 -0
- package/lib/commonjs/components/Poll/index.js.map +1 -0
- package/lib/commonjs/components/Reply/Reply.js +1 -1
- package/lib/commonjs/components/Reply/Reply.js.map +1 -1
- package/lib/commonjs/components/index.js +11 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/commonjs/contexts/index.js +11 -0
- package/lib/commonjs/contexts/index.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +26 -3
- package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -1
- package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js +4 -0
- package/lib/commonjs/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +3 -0
- package/lib/commonjs/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/commonjs/contexts/pollContext/createPollContentContext.js +33 -0
- package/lib/commonjs/contexts/pollContext/createPollContentContext.js.map +1 -0
- package/lib/commonjs/contexts/pollContext/index.js +26 -0
- package/lib/commonjs/contexts/pollContext/index.js.map +1 -0
- package/lib/commonjs/contexts/pollContext/pollContext.js +33 -0
- package/lib/commonjs/contexts/pollContext/pollContext.js.map +1 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js +126 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/i18n/en.json +34 -0
- package/lib/commonjs/i18n/es.json +38 -0
- package/lib/commonjs/i18n/fr.json +38 -0
- package/lib/commonjs/i18n/he.json +38 -0
- package/lib/commonjs/i18n/hi.json +34 -0
- package/lib/commonjs/i18n/it.json +38 -0
- package/lib/commonjs/i18n/ja.json +34 -0
- package/lib/commonjs/i18n/ko.json +34 -0
- package/lib/commonjs/i18n/nl.json +34 -0
- package/lib/commonjs/i18n/pt-br.json +38 -0
- package/lib/commonjs/i18n/ru.json +42 -0
- package/lib/commonjs/i18n/tr.json +34 -0
- package/lib/commonjs/icons/Back.js +19 -0
- package/lib/commonjs/icons/Back.js.map +1 -0
- package/lib/commonjs/icons/DragHandle.js +21 -0
- package/lib/commonjs/icons/DragHandle.js.map +1 -0
- package/lib/commonjs/icons/PollThumbnail.js +19 -0
- package/lib/commonjs/icons/PollThumbnail.js.map +1 -0
- package/lib/commonjs/icons/SendPoll.js +19 -0
- package/lib/commonjs/icons/SendPoll.js.map +1 -0
- package/lib/commonjs/icons/index.js +44 -0
- package/lib/commonjs/icons/index.js.map +1 -1
- package/lib/commonjs/store/QuickSqliteClient.js +1 -1
- package/lib/commonjs/store/apis/index.js +11 -0
- package/lib/commonjs/store/apis/index.js.map +1 -1
- package/lib/commonjs/store/apis/updatePollMessage.js +50 -0
- package/lib/commonjs/store/apis/updatePollMessage.js.map +1 -0
- package/lib/commonjs/store/mappers/mapMessageToStorable.js +5 -1
- package/lib/commonjs/store/mappers/mapMessageToStorable.js.map +1 -1
- package/lib/commonjs/store/mappers/mapStorableToMessage.js +5 -1
- package/lib/commonjs/store/mappers/mapStorableToMessage.js.map +1 -1
- package/lib/commonjs/store/schema.js +2 -0
- package/lib/commonjs/store/schema.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js +27 -0
- package/lib/module/components/AttachmentPicker/components/AttachmentPickerSelectionBar.js.map +1 -1
- package/lib/module/components/Channel/Channel.js +17 -4
- package/lib/module/components/Channel/Channel.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +7 -1
- package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +5 -1
- package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +46 -3
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
- package/lib/module/components/Chat/Chat.js +2 -0
- package/lib/module/components/Chat/Chat.js.map +1 -1
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js +10 -0
- package/lib/module/components/Chat/hooks/handleEventToSyncDB.js.map +1 -1
- package/lib/module/components/Message/Message.js +13 -0
- package/lib/module/components/Message/Message.js.map +1 -1
- package/lib/module/components/Message/MessageSimple/MessageContent.js +31 -15
- package/lib/module/components/Message/MessageSimple/MessageContent.js.map +1 -1
- package/lib/module/components/MessageInput/MessageInput.js +44 -1
- package/lib/module/components/MessageInput/MessageInput.js.map +1 -1
- package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js +18 -1
- package/lib/module/components/MessageInput/components/NativeAttachmentPicker.js.map +1 -1
- package/lib/module/components/MessageOverlay/MessageOverlay.js +10 -0
- package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
- package/lib/module/components/Poll/CreatePollContent.js +386 -0
- package/lib/module/components/Poll/CreatePollContent.js.map +1 -0
- package/lib/module/components/Poll/Poll.js +112 -0
- package/lib/module/components/Poll/Poll.js.map +1 -0
- package/lib/module/components/Poll/components/Button.js +513 -0
- package/lib/module/components/Poll/components/Button.js.map +1 -0
- package/lib/module/components/Poll/components/CreatePollIcon.js +23 -0
- package/lib/module/components/Poll/components/CreatePollIcon.js.map +1 -0
- package/lib/module/components/Poll/components/CreatePollOptions.js +281 -0
- package/lib/module/components/Poll/components/CreatePollOptions.js.map +1 -0
- package/lib/module/components/Poll/components/PollAnswersList.js +154 -0
- package/lib/module/components/Poll/components/PollAnswersList.js.map +1 -0
- package/lib/module/components/Poll/components/PollInputDialog.js +139 -0
- package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -0
- package/lib/module/components/Poll/components/PollModalHeader.js +60 -0
- package/lib/module/components/Poll/components/PollModalHeader.js.map +1 -0
- package/lib/module/components/Poll/components/PollOption.js +209 -0
- package/lib/module/components/Poll/components/PollOption.js.map +1 -0
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js +123 -0
- package/lib/module/components/Poll/components/PollResults/PollOptionFullResults.js.map +1 -0
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js +152 -0
- package/lib/module/components/Poll/components/PollResults/PollResultItem.js.map +1 -0
- package/lib/module/components/Poll/components/PollResults/PollResults.js +101 -0
- package/lib/module/components/Poll/components/PollResults/PollResults.js.map +1 -0
- package/lib/module/components/Poll/components/PollResults/index.js +37 -0
- package/lib/module/components/Poll/components/PollResults/index.js.map +1 -0
- package/lib/module/components/Poll/components/index.js +92 -0
- package/lib/module/components/Poll/components/index.js.map +1 -0
- package/lib/module/components/Poll/hooks/usePollAnswersPagination.js +129 -0
- package/lib/module/components/Poll/hooks/usePollAnswersPagination.js.map +1 -0
- package/lib/module/components/Poll/hooks/usePollOptionVotesPagination.js +140 -0
- package/lib/module/components/Poll/hooks/usePollOptionVotesPagination.js.map +1 -0
- package/lib/module/components/Poll/hooks/usePollState.js +103 -0
- package/lib/module/components/Poll/hooks/usePollState.js.map +1 -0
- package/lib/module/components/Poll/hooks/usePollStateStore.js +13 -0
- package/lib/module/components/Poll/hooks/usePollStateStore.js.map +1 -0
- package/lib/module/components/Poll/index.js +81 -0
- package/lib/module/components/Poll/index.js.map +1 -0
- package/lib/module/components/Reply/Reply.js +1 -1
- package/lib/module/components/Reply/Reply.js.map +1 -1
- package/lib/module/components/index.js +11 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/contexts/attachmentPickerContext/AttachmentPickerContext.js.map +1 -1
- package/lib/module/contexts/index.js +11 -0
- package/lib/module/contexts/index.js.map +1 -1
- package/lib/module/contexts/messageInputContext/MessageInputContext.js +26 -3
- package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +9 -1
- package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
- package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
- package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayContext.js.map +1 -1
- package/lib/module/contexts/overlayContext/OverlayProvider.js +4 -0
- package/lib/module/contexts/overlayContext/OverlayProvider.js.map +1 -1
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js +3 -0
- package/lib/module/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.js.map +1 -1
- package/lib/module/contexts/pollContext/createPollContentContext.js +33 -0
- package/lib/module/contexts/pollContext/createPollContentContext.js.map +1 -0
- package/lib/module/contexts/pollContext/index.js +26 -0
- package/lib/module/contexts/pollContext/index.js.map +1 -0
- package/lib/module/contexts/pollContext/pollContext.js +33 -0
- package/lib/module/contexts/pollContext/pollContext.js.map +1 -0
- package/lib/module/contexts/themeContext/utils/theme.js +126 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/i18n/en.json +34 -0
- package/lib/module/i18n/es.json +38 -0
- package/lib/module/i18n/fr.json +38 -0
- package/lib/module/i18n/he.json +38 -0
- package/lib/module/i18n/hi.json +34 -0
- package/lib/module/i18n/it.json +38 -0
- package/lib/module/i18n/ja.json +34 -0
- package/lib/module/i18n/ko.json +34 -0
- package/lib/module/i18n/nl.json +34 -0
- package/lib/module/i18n/pt-br.json +38 -0
- package/lib/module/i18n/ru.json +42 -0
- package/lib/module/i18n/tr.json +34 -0
- package/lib/module/icons/Back.js +19 -0
- package/lib/module/icons/Back.js.map +1 -0
- package/lib/module/icons/DragHandle.js +21 -0
- package/lib/module/icons/DragHandle.js.map +1 -0
- package/lib/module/icons/PollThumbnail.js +19 -0
- package/lib/module/icons/PollThumbnail.js.map +1 -0
- package/lib/module/icons/SendPoll.js +19 -0
- package/lib/module/icons/SendPoll.js.map +1 -0
- package/lib/module/icons/index.js +44 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/store/QuickSqliteClient.js +1 -1
- package/lib/module/store/apis/index.js +11 -0
- package/lib/module/store/apis/index.js.map +1 -1
- package/lib/module/store/apis/updatePollMessage.js +50 -0
- package/lib/module/store/apis/updatePollMessage.js.map +1 -0
- package/lib/module/store/mappers/mapMessageToStorable.js +5 -1
- package/lib/module/store/mappers/mapMessageToStorable.js.map +1 -1
- package/lib/module/store/mappers/mapStorableToMessage.js +5 -1
- package/lib/module/store/mappers/mapStorableToMessage.js.map +1 -1
- package/lib/module/store/schema.js +2 -0
- package/lib/module/store/schema.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/AttachmentPicker/components/AttachmentPickerSelectionBar.d.ts.map +1 -1
- package/lib/typescript/components/Channel/Channel.d.ts +2 -2
- package/lib/typescript/components/Channel/Channel.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts.map +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +5 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
- package/lib/typescript/components/Chat/Chat.d.ts.map +1 -1
- package/lib/typescript/components/Chat/hooks/handleEventToSyncDB.d.ts.map +1 -1
- package/lib/typescript/components/Message/Message.d.ts +1 -1
- package/lib/typescript/components/Message/Message.d.ts.map +1 -1
- package/lib/typescript/components/Message/MessageSimple/MessageContent.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts +1 -1
- package/lib/typescript/components/MessageInput/MessageInput.d.ts.map +1 -1
- package/lib/typescript/components/MessageInput/components/NativeAttachmentPicker.d.ts.map +1 -1
- package/lib/typescript/components/MessageOverlay/MessageOverlay.d.ts.map +1 -1
- package/lib/typescript/components/Poll/CreatePollContent.d.ts +6 -0
- package/lib/typescript/components/Poll/CreatePollContent.d.ts.map +1 -0
- package/lib/typescript/components/Poll/Poll.d.ts +13 -0
- package/lib/typescript/components/Poll/Poll.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/Button.d.ts +35 -0
- package/lib/typescript/components/Poll/components/Button.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/CreatePollIcon.d.ts +3 -0
- package/lib/typescript/components/Poll/components/CreatePollIcon.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts +34 -0
- package/lib/typescript/components/Poll/components/CreatePollOptions.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts +15 -0
- package/lib/typescript/components/Poll/components/PollAnswersList.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollInputDialog.d.ts +10 -0
- package/lib/typescript/components/Poll/components/PollInputDialog.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollModalHeader.d.ts +7 -0
- package/lib/typescript/components/Poll/components/PollModalHeader.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollOption.d.ts +16 -0
- package/lib/typescript/components/Poll/components/PollOption.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollResults/PollOptionFullResults.d.ts +18 -0
- package/lib/typescript/components/Poll/components/PollResults/PollOptionFullResults.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts +9 -0
- package/lib/typescript/components/Poll/components/PollResults/PollResultItem.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollResults/PollResults.d.ts +10 -0
- package/lib/typescript/components/Poll/components/PollResults/PollResults.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/PollResults/index.d.ts +4 -0
- package/lib/typescript/components/Poll/components/PollResults/index.d.ts.map +1 -0
- package/lib/typescript/components/Poll/components/index.d.ts +9 -0
- package/lib/typescript/components/Poll/components/index.d.ts.map +1 -0
- package/lib/typescript/components/Poll/hooks/usePollAnswersPagination.d.ts +29 -0
- package/lib/typescript/components/Poll/hooks/usePollAnswersPagination.d.ts.map +1 -0
- package/lib/typescript/components/Poll/hooks/usePollOptionVotesPagination.d.ts +32 -0
- package/lib/typescript/components/Poll/hooks/usePollOptionVotesPagination.d.ts.map +1 -0
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts +26 -0
- package/lib/typescript/components/Poll/hooks/usePollState.d.ts.map +1 -0
- package/lib/typescript/components/Poll/hooks/usePollStateStore.d.ts +3 -0
- package/lib/typescript/components/Poll/hooks/usePollStateStore.d.ts.map +1 -0
- package/lib/typescript/components/Poll/index.d.ts +8 -0
- package/lib/typescript/components/Poll/index.d.ts.map +1 -0
- package/lib/typescript/components/Reply/Reply.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts +7 -1
- package/lib/typescript/contexts/attachmentPickerContext/AttachmentPickerContext.d.ts.map +1 -1
- package/lib/typescript/contexts/index.d.ts +1 -0
- package/lib/typescript/contexts/index.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +11 -2
- package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
- package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +2 -1
- package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts.map +1 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +9 -1
- package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayContext.d.ts.map +1 -1
- package/lib/typescript/contexts/overlayContext/OverlayProvider.d.ts.map +1 -1
- package/lib/typescript/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.d.ts +3 -0
- package/lib/typescript/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.d.ts.map +1 -1
- package/lib/typescript/contexts/pollContext/createPollContentContext.d.ts +20 -0
- package/lib/typescript/contexts/pollContext/createPollContentContext.d.ts.map +1 -0
- package/lib/typescript/contexts/pollContext/index.d.ts +3 -0
- package/lib/typescript/contexts/pollContext/index.d.ts.map +1 -0
- package/lib/typescript/contexts/pollContext/pollContext.d.ts +14 -0
- package/lib/typescript/contexts/pollContext/pollContext.d.ts.map +1 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +126 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/i18n/en.json +34 -0
- package/lib/typescript/i18n/es.json +38 -0
- package/lib/typescript/i18n/fr.json +38 -0
- package/lib/typescript/i18n/he.json +38 -0
- package/lib/typescript/i18n/hi.json +34 -0
- package/lib/typescript/i18n/it.json +38 -0
- package/lib/typescript/i18n/ja.json +34 -0
- package/lib/typescript/i18n/ko.json +34 -0
- package/lib/typescript/i18n/nl.json +34 -0
- package/lib/typescript/i18n/pt-br.json +38 -0
- package/lib/typescript/i18n/ru.json +42 -0
- package/lib/typescript/i18n/tr.json +34 -0
- package/lib/typescript/icons/Back.d.ts +4 -0
- package/lib/typescript/icons/Back.d.ts.map +1 -0
- package/lib/typescript/icons/DragHandle.d.ts +4 -0
- package/lib/typescript/icons/DragHandle.d.ts.map +1 -0
- package/lib/typescript/icons/PollThumbnail.d.ts +4 -0
- package/lib/typescript/icons/PollThumbnail.d.ts.map +1 -0
- package/lib/typescript/icons/SendPoll.d.ts +4 -0
- package/lib/typescript/icons/SendPoll.d.ts.map +1 -0
- package/lib/typescript/icons/index.d.ts +4 -0
- package/lib/typescript/icons/index.d.ts.map +1 -1
- package/lib/typescript/store/apis/index.d.ts +1 -0
- package/lib/typescript/store/apis/index.d.ts.map +1 -1
- package/lib/typescript/store/apis/updatePollMessage.d.ts +7 -0
- package/lib/typescript/store/apis/updatePollMessage.d.ts.map +1 -0
- package/lib/typescript/store/mappers/mapMessageToStorable.d.ts.map +1 -1
- package/lib/typescript/store/mappers/mapStorableToMessage.d.ts.map +1 -1
- package/lib/typescript/store/schema.d.ts +2 -0
- package/lib/typescript/store/schema.d.ts.map +1 -1
- package/lib/typescript/utils/i18n/Streami18n.d.ts +34 -0
- package/lib/typescript/utils/i18n/Streami18n.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/AttachmentPicker/components/AttachmentPickerSelectionBar.tsx +35 -2
- package/src/components/Channel/Channel.tsx +27 -4
- package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +16 -1
- package/src/components/Channel/hooks/useCreateMessagesContext.ts +5 -0
- package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +63 -4
- package/src/components/Chat/Chat.tsx +2 -0
- package/src/components/Chat/hooks/handleEventToSyncDB.ts +19 -0
- package/src/components/Message/Message.tsx +15 -1
- package/src/components/Message/MessageSimple/MessageContent.tsx +16 -0
- package/src/components/MessageInput/MessageInput.tsx +58 -1
- package/src/components/MessageInput/__tests__/MessageInput.test.js +2 -0
- package/src/components/MessageInput/components/NativeAttachmentPicker.tsx +29 -2
- package/src/components/MessageOverlay/MessageOverlay.tsx +10 -0
- package/src/components/Poll/CreatePollContent.tsx +299 -0
- package/src/components/Poll/Poll.tsx +126 -0
- package/src/components/Poll/components/Button.tsx +465 -0
- package/src/components/Poll/components/CreatePollIcon.tsx +14 -0
- package/src/components/Poll/components/CreatePollOptions.tsx +351 -0
- package/src/components/Poll/components/PollAnswersList.tsx +134 -0
- package/src/components/Poll/components/PollInputDialog.tsx +117 -0
- package/src/components/Poll/components/PollModalHeader.tsx +42 -0
- package/src/components/Poll/components/PollOption.tsx +172 -0
- package/src/components/Poll/components/PollResults/PollOptionFullResults.tsx +108 -0
- package/src/components/Poll/components/PollResults/PollResultItem.tsx +115 -0
- package/src/components/Poll/components/PollResults/PollResults.tsx +79 -0
- package/src/components/Poll/components/PollResults/index.ts +3 -0
- package/src/components/Poll/components/index.ts +8 -0
- package/src/components/Poll/hooks/usePollAnswersPagination.ts +109 -0
- package/src/components/Poll/hooks/usePollOptionVotesPagination.ts +119 -0
- package/src/components/Poll/hooks/usePollState.ts +122 -0
- package/src/components/Poll/hooks/usePollStateStore.ts +13 -0
- package/src/components/Poll/index.ts +10 -0
- package/src/components/Reply/Reply.tsx +2 -0
- package/src/components/index.ts +1 -0
- package/src/contexts/attachmentPickerContext/AttachmentPickerContext.tsx +12 -1
- package/src/contexts/index.ts +1 -0
- package/src/contexts/messageInputContext/MessageInputContext.tsx +38 -10
- package/src/contexts/messageInputContext/__tests__/pickFile.test.tsx +4 -2
- package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +9 -0
- package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +2 -1
- package/src/contexts/messagesContext/MessagesContext.tsx +15 -2
- package/src/contexts/overlayContext/OverlayContext.tsx +1 -0
- package/src/contexts/overlayContext/OverlayProvider.tsx +3 -0
- package/src/contexts/ownCapabilitiesContext/OwnCapabilitiesContext.tsx +3 -0
- package/src/contexts/pollContext/createPollContentContext.tsx +49 -0
- package/src/contexts/pollContext/index.ts +2 -0
- package/src/contexts/pollContext/pollContext.tsx +43 -0
- package/src/contexts/themeContext/utils/theme.ts +233 -0
- package/src/i18n/en.json +34 -0
- package/src/i18n/es.json +38 -0
- package/src/i18n/fr.json +38 -0
- package/src/i18n/he.json +38 -0
- package/src/i18n/hi.json +34 -0
- package/src/i18n/it.json +38 -0
- package/src/i18n/ja.json +34 -0
- package/src/i18n/ko.json +34 -0
- package/src/i18n/nl.json +34 -0
- package/src/i18n/pt-br.json +38 -0
- package/src/i18n/ru.json +42 -0
- package/src/i18n/tr.json +34 -0
- package/src/icons/Back.tsx +12 -0
- package/src/icons/DragHandle.tsx +9 -0
- package/src/icons/PollThumbnail.tsx +12 -0
- package/src/icons/SendPoll.tsx +12 -0
- package/src/icons/index.ts +4 -0
- package/src/store/QuickSqliteClient.ts +1 -1
- package/src/store/apis/index.ts +1 -0
- package/src/store/apis/updatePollMessage.ts +48 -0
- package/src/store/mappers/mapMessageToStorable.ts +4 -0
- package/src/store/mappers/mapStorableToMessage.ts +4 -0
- package/src/store/schema.ts +4 -0
- 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 {
|
|
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 = ({
|
|
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
|
-
|
|
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 : (
|