@droppii-org/chat-mobile 0.2.6 → 0.2.8
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/module/components/AttachmentPreview.js +250 -0
- package/lib/module/components/AttachmentPreview.js.map +1 -0
- package/lib/module/components/MediaViewer/index.js +2 -0
- package/lib/module/components/MediaViewer/index.js.map +1 -0
- package/lib/module/components/MediaViewerModal.js +57 -0
- package/lib/module/components/MediaViewerModal.js.map +1 -0
- package/lib/module/components/MergedImageGrid.js +173 -0
- package/lib/module/components/MergedImageGrid.js.map +1 -0
- package/lib/module/components/ThreadCard/AvatarSection.js +4 -4
- package/lib/module/components/ThreadCard/AvatarSection.js.map +1 -1
- package/lib/module/components/ThreadCard/NamePrefixIcon.js +13 -16
- package/lib/module/components/ThreadCard/NamePrefixIcon.js.map +1 -1
- package/lib/module/components/ThreadCard/ThreadCard.js +13 -33
- package/lib/module/components/ThreadCard/ThreadCard.js.map +1 -1
- package/lib/module/components/ThreadCard/thread-card.utils.js +80 -4
- package/lib/module/components/ThreadCard/thread-card.utils.js.map +1 -1
- package/lib/module/components/messages/fileMessage/index.js +26 -0
- package/lib/module/components/messages/fileMessage/index.js.map +1 -0
- package/lib/module/components/messages/imageMessage/index.js +118 -0
- package/lib/module/components/messages/imageMessage/index.js.map +1 -0
- package/lib/module/components/messages/linkMessage/index.js +122 -0
- package/lib/module/components/messages/linkMessage/index.js.map +1 -0
- package/lib/module/components/messages/mergedMessage/index.js +37 -0
- package/lib/module/components/messages/mergedMessage/index.js.map +1 -0
- package/lib/module/components/messages/styles.js +41 -0
- package/lib/module/components/messages/styles.js.map +1 -0
- package/lib/module/components/messages/textMessage/index.js +38 -0
- package/lib/module/components/messages/textMessage/index.js.map +1 -0
- package/lib/module/components/messages/types.js +14 -0
- package/lib/module/components/messages/types.js.map +1 -0
- package/lib/module/components/messages/videoMessage/index.js +110 -0
- package/lib/module/components/messages/videoMessage/index.js.map +1 -0
- package/lib/module/config/api-endpoints.js +66 -0
- package/lib/module/config/api-endpoints.js.map +1 -0
- package/lib/module/config/attachment-priority.js +81 -0
- package/lib/module/config/attachment-priority.js.map +1 -0
- package/lib/module/config/configuration.js +50 -0
- package/lib/module/config/configuration.js.map +1 -0
- package/lib/module/config/index.js +22 -0
- package/lib/module/config/index.js.map +1 -0
- package/lib/module/context/ChatContext.js +7 -6
- package/lib/module/context/ChatContext.js.map +1 -1
- package/lib/module/core/index.js +19 -1
- package/lib/module/core/index.js.map +1 -1
- package/lib/module/core/useChatListener.js +0 -14
- package/lib/module/core/useChatListener.js.map +1 -1
- package/lib/module/hooks/message/useSendMessage.js +106 -0
- package/lib/module/hooks/message/useSendMessage.js.map +1 -0
- package/lib/module/hooks/useChatMessages.js +36 -121
- package/lib/module/hooks/useChatMessages.js.map +1 -1
- package/lib/module/hooks/useConversationList.js +29 -17
- package/lib/module/hooks/useConversationList.js.map +1 -1
- package/lib/module/hooks/useImageAttachment.js +263 -0
- package/lib/module/hooks/useImageAttachment.js.map +1 -0
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js +3 -2
- package/lib/module/hooks/useLinkPreview/useLinkPreview.js.map +1 -1
- package/lib/module/hooks/useMediaViewer.js +24 -0
- package/lib/module/hooks/useMediaViewer.js.map +1 -0
- package/lib/module/hooks/useSendAttachment.js +182 -0
- package/lib/module/hooks/useSendAttachment.js.map +1 -0
- package/lib/module/hooks/useVideoAttachment.js +251 -0
- package/lib/module/hooks/useVideoAttachment.js.map +1 -0
- package/lib/module/index.js +13 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/screens/MediaView/VideoPlayer.js +177 -0
- package/lib/module/screens/MediaView/VideoPlayer.js.map +1 -0
- package/lib/module/screens/MediaView/index.js +264 -0
- package/lib/module/screens/MediaView/index.js.map +1 -0
- package/lib/module/screens/chat-detail/ChatComposer.js +190 -196
- package/lib/module/screens/chat-detail/ChatComposer.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetail.js +106 -71
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatDetailHeader.js +5 -8
- package/lib/module/screens/chat-detail/ChatDetailHeader.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js +1 -1
- package/lib/module/screens/chat-detail/ChatLinkPreview.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +5 -15
- package/lib/module/screens/chat-detail/ChatListLegend.js.map +1 -1
- package/lib/module/screens/chat-detail/components/ChatInputActions.js +51 -0
- package/lib/module/screens/chat-detail/components/ChatInputActions.js.map +1 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js +93 -0
- package/lib/module/screens/chat-detail/components/ChatMessageInput.js.map +1 -0
- package/lib/module/screens/chat-detail/conversationHeader.utils.js +7 -9
- package/lib/module/screens/chat-detail/conversationHeader.utils.js.map +1 -1
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js +221 -0
- package/lib/module/screens/chat-detail/hooks/useAttachmentSendHandler.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js +114 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerAnimation.js.map +1 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js +26 -0
- package/lib/module/screens/chat-detail/hooks/useChatComposerState.js.map +1 -0
- package/lib/module/screens/chat-detail/index.js +0 -1
- package/lib/module/screens/chat-detail/index.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js +32 -25
- package/lib/module/screens/chat-detail/legend/LegendChatMessage.js.map +1 -1
- package/lib/module/screens/chat-detail/legend/messageTypes.js +15 -0
- package/lib/module/screens/chat-detail/legend/messageTypes.js.map +1 -0
- package/lib/module/screens/inbox/MessagesTab.js.map +1 -1
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js +61 -0
- package/lib/module/services/attachmentHandlers/fileAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js +54 -0
- package/lib/module/services/attachmentHandlers/imageAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentHandlers/index.js +12 -0
- package/lib/module/services/attachmentHandlers/index.js.map +1 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js +85 -0
- package/lib/module/services/attachmentHandlers/videoAttachmentHandler.js.map +1 -0
- package/lib/module/services/attachmentOrchestrator.js +225 -0
- package/lib/module/services/attachmentOrchestrator.js.map +1 -0
- package/lib/module/services/auth.js +35 -0
- package/lib/module/services/auth.js.map +1 -0
- package/lib/module/services/endpoints.js +20 -1
- package/lib/module/services/endpoints.js.map +1 -1
- package/lib/module/services/imageUpload.js +126 -0
- package/lib/module/services/imageUpload.js.map +1 -0
- package/lib/module/store/conversation.js +1 -1
- package/lib/module/store/conversation.js.map +1 -1
- package/lib/module/store/message.js +45 -0
- package/lib/module/store/message.js.map +1 -0
- package/lib/module/translation/resources/i18n.js +22 -2
- package/lib/module/translation/resources/i18n.js.map +1 -1
- package/lib/module/types/attachment.js +2 -0
- package/lib/module/types/attachment.js.map +1 -0
- package/lib/module/types/attachmentHandler.js +20 -0
- package/lib/module/types/attachmentHandler.js.map +1 -0
- package/lib/module/types/chat.js +2 -7
- package/lib/module/types/chat.js.map +1 -1
- package/lib/module/types/imageUpload.js +2 -0
- package/lib/module/types/imageUpload.js.map +1 -0
- package/lib/module/types/message.js +1 -0
- package/lib/module/types/message.js.map +1 -1
- package/lib/module/utils/chatImageDimens.js +148 -0
- package/lib/module/utils/chatImageDimens.js.map +1 -0
- package/lib/module/utils/conversation.js +34 -13
- package/lib/module/utils/conversation.js.map +1 -1
- package/lib/module/utils/device.js +65 -0
- package/lib/module/utils/device.js.map +1 -0
- package/lib/module/utils/imageUrlOptimizer.js +41 -0
- package/lib/module/utils/imageUrlOptimizer.js.map +1 -0
- package/lib/module/utils/imageUtils.js +69 -0
- package/lib/module/utils/imageUtils.js.map +1 -0
- package/lib/module/utils/legendListMessage.js +0 -3
- package/lib/module/utils/legendListMessage.js.map +1 -1
- package/lib/module/utils/message.js +5 -8
- package/lib/module/utils/message.js.map +1 -1
- package/lib/module/utils/resolveMessageType.js +3 -0
- package/lib/module/utils/resolveMessageType.js.map +1 -1
- package/lib/module/utils/ui.js +17 -0
- package/lib/module/utils/ui.js.map +1 -0
- package/lib/module/utils/url.js +3 -3
- package/lib/module/utils/url.js.map +1 -1
- package/lib/module/utils/videoThumbnail.js +62 -0
- package/lib/module/utils/videoThumbnail.js.map +1 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts +28 -0
- package/lib/typescript/src/components/AttachmentPreview.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts +1 -0
- package/lib/typescript/src/components/MediaViewer/index.d.ts.map +1 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts +10 -0
- package/lib/typescript/src/components/MediaViewerModal.d.ts.map +1 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts +16 -0
- package/lib/typescript/src/components/MergedImageGrid.d.ts.map +1 -0
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts +2 -2
- package/lib/typescript/src/components/ThreadCard/AvatarSection.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts +3 -4
- package/lib/typescript/src/components/ThreadCard/NamePrefixIcon.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/ThreadCard.d.ts.map +1 -1
- package/lib/typescript/src/components/ThreadCard/thread-card.utils.d.ts.map +1 -1
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/fileMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/imageMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/linkMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/mergedMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/styles.d.ts +36 -0
- package/lib/typescript/src/components/messages/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts +9 -0
- package/lib/typescript/src/components/messages/textMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/types.d.ts +10 -0
- package/lib/typescript/src/components/messages/types.d.ts.map +1 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts +3 -0
- package/lib/typescript/src/components/messages/videoMessage/index.d.ts.map +1 -0
- package/lib/typescript/src/config/api-endpoints.d.ts +40 -0
- package/lib/typescript/src/config/api-endpoints.d.ts.map +1 -0
- package/lib/typescript/src/config/attachment-priority.d.ts +31 -0
- package/lib/typescript/src/config/attachment-priority.d.ts.map +1 -0
- package/lib/typescript/src/config/configuration.d.ts +30 -0
- package/lib/typescript/src/config/configuration.d.ts.map +1 -0
- package/lib/typescript/src/config/index.d.ts +15 -0
- package/lib/typescript/src/config/index.d.ts.map +1 -0
- package/lib/typescript/src/context/ChatContext.d.ts +1 -1
- package/lib/typescript/src/context/ChatContext.d.ts.map +1 -1
- package/lib/typescript/src/core/index.d.ts +13 -1
- package/lib/typescript/src/core/index.d.ts.map +1 -1
- package/lib/typescript/src/core/useChatListener.d.ts.map +1 -1
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts +12 -0
- package/lib/typescript/src/hooks/message/useSendMessage.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useChatMessages.d.ts +0 -1
- package/lib/typescript/src/hooks/useChatMessages.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts +2 -1
- package/lib/typescript/src/hooks/useConversationList.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useImageAttachment.d.ts +20 -0
- package/lib/typescript/src/hooks/useImageAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useLinkPreview/useLinkPreview.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useMediaViewer.d.ts +13 -0
- package/lib/typescript/src/hooks/useMediaViewer.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts +59 -0
- package/lib/typescript/src/hooks/useSendAttachment.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts +29 -0
- package/lib/typescript/src/hooks/useVideoAttachment.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts +12 -0
- package/lib/typescript/src/screens/MediaView/VideoPlayer.d.ts.map +1 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts +11 -0
- package/lib/typescript/src/screens/MediaView/index.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatComposer.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetail.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatDetailHeader.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/ChatListLegend.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts +8 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatInputActions.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/components/ChatMessageInput.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts +1 -1
- package/lib/typescript/src/screens/chat-detail/conversationHeader.utils.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts +23 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useAttachmentSendHandler.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts +15 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerAnimation.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/hooks/useChatComposerState.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/index.d.ts +0 -2
- package/lib/typescript/src/screens/chat-detail/index.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts +3 -3
- package/lib/typescript/src/screens/chat-detail/legend/LegendChatMessage.d.ts.map +1 -1
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts +13 -0
- package/lib/typescript/src/screens/chat-detail/legend/messageTypes.d.ts.map +1 -0
- package/lib/typescript/src/screens/chat-detail/types.d.ts +10 -8
- package/lib/typescript/src/screens/chat-detail/types.d.ts.map +1 -1
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts +22 -0
- package/lib/typescript/src/services/attachmentHandlers/fileAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts +3 -0
- package/lib/typescript/src/services/attachmentHandlers/imageAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts +5 -0
- package/lib/typescript/src/services/attachmentHandlers/index.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts +31 -0
- package/lib/typescript/src/services/attachmentHandlers/videoAttachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts +5 -0
- package/lib/typescript/src/services/attachmentOrchestrator.d.ts.map +1 -0
- package/lib/typescript/src/services/auth.d.ts +19 -0
- package/lib/typescript/src/services/auth.d.ts.map +1 -0
- package/lib/typescript/src/services/endpoints.d.ts +11 -1
- package/lib/typescript/src/services/endpoints.d.ts.map +1 -1
- package/lib/typescript/src/services/imageUpload.d.ts +7 -0
- package/lib/typescript/src/services/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/store/message.d.ts +3 -0
- package/lib/typescript/src/store/message.d.ts.map +1 -0
- package/lib/typescript/src/translation/resources/i18n.d.ts.map +1 -1
- package/lib/typescript/src/types/attachment.d.ts +72 -0
- package/lib/typescript/src/types/attachment.d.ts.map +1 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts +13 -0
- package/lib/typescript/src/types/attachmentHandler.d.ts.map +1 -0
- package/lib/typescript/src/types/chat.d.ts +28 -27
- package/lib/typescript/src/types/chat.d.ts.map +1 -1
- package/lib/typescript/src/types/common.d.ts +1 -0
- package/lib/typescript/src/types/common.d.ts.map +1 -1
- package/lib/typescript/src/types/imageUpload.d.ts +26 -0
- package/lib/typescript/src/types/imageUpload.d.ts.map +1 -0
- package/lib/typescript/src/types/message.d.ts +1 -0
- package/lib/typescript/src/types/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/chatImageDimens.d.ts +34 -0
- package/lib/typescript/src/utils/chatImageDimens.d.ts.map +1 -0
- package/lib/typescript/src/utils/conversation.d.ts +3 -2
- package/lib/typescript/src/utils/conversation.d.ts.map +1 -1
- package/lib/typescript/src/utils/device.d.ts +7 -0
- package/lib/typescript/src/utils/device.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts +12 -0
- package/lib/typescript/src/utils/imageUrlOptimizer.d.ts.map +1 -0
- package/lib/typescript/src/utils/imageUtils.d.ts +9 -0
- package/lib/typescript/src/utils/imageUtils.d.ts.map +1 -0
- package/lib/typescript/src/utils/legendListMessage.d.ts +0 -2
- package/lib/typescript/src/utils/legendListMessage.d.ts.map +1 -1
- package/lib/typescript/src/utils/message.d.ts.map +1 -1
- package/lib/typescript/src/utils/resolveMessageType.d.ts.map +1 -1
- package/lib/typescript/src/utils/ui.d.ts +13 -0
- package/lib/typescript/src/utils/ui.d.ts.map +1 -0
- package/lib/typescript/src/utils/url.d.ts +1 -1
- package/lib/typescript/src/utils/url.d.ts.map +1 -1
- package/lib/typescript/src/utils/videoThumbnail.d.ts +16 -0
- package/lib/typescript/src/utils/videoThumbnail.d.ts.map +1 -0
- package/package.json +15 -3
- package/src/components/AttachmentPreview.tsx +304 -0
- package/src/components/MediaViewer/index.tsx +0 -0
- package/src/components/MediaViewerModal.tsx +70 -0
- package/src/components/MergedImageGrid.tsx +238 -0
- package/src/components/ThreadCard/AvatarSection.tsx +5 -8
- package/src/components/ThreadCard/NamePrefixIcon.tsx +27 -38
- package/src/components/ThreadCard/ThreadCard.tsx +16 -30
- package/src/components/ThreadCard/thread-card.utils.ts +95 -4
- package/src/components/messages/fileMessage/index.tsx +30 -0
- package/src/components/messages/imageMessage/index.tsx +137 -0
- package/src/components/messages/linkMessage/index.tsx +162 -0
- package/src/components/messages/mergedMessage/index.tsx +45 -0
- package/src/components/messages/styles.ts +39 -0
- package/src/components/messages/textMessage/index.tsx +53 -0
- package/src/components/messages/types.ts +22 -0
- package/src/components/messages/videoMessage/index.tsx +120 -0
- package/src/config/api-endpoints.ts +72 -0
- package/src/config/attachment-priority.ts +93 -0
- package/src/config/configuration.ts +50 -0
- package/src/config/index.ts +19 -0
- package/src/context/ChatContext.tsx +12 -4
- package/src/core/index.ts +25 -1
- package/src/core/useChatListener.ts +0 -21
- package/src/hooks/message/useSendMessage.ts +143 -0
- package/src/hooks/useChatMessages.ts +69 -161
- package/src/hooks/useConversationList.ts +34 -16
- package/src/hooks/useImageAttachment.ts +348 -0
- package/src/hooks/useLinkPreview/useLinkPreview.ts +3 -2
- package/src/hooks/useMediaViewer.ts +32 -0
- package/src/hooks/useSendAttachment.ts +295 -0
- package/src/hooks/useVideoAttachment.ts +334 -0
- package/src/index.tsx +13 -1
- package/src/screens/MediaView/VideoPlayer.tsx +211 -0
- package/src/screens/MediaView/index.tsx +327 -0
- package/src/screens/chat-detail/ChatComposer.tsx +206 -271
- package/src/screens/chat-detail/ChatDetail.tsx +164 -104
- package/src/screens/chat-detail/ChatDetailHeader.tsx +4 -10
- package/src/screens/chat-detail/ChatLinkPreview.tsx +1 -1
- package/src/screens/chat-detail/ChatListLegend.tsx +10 -13
- package/src/screens/chat-detail/components/ChatInputActions.tsx +71 -0
- package/src/screens/chat-detail/components/ChatMessageInput.tsx +127 -0
- package/src/screens/chat-detail/conversationHeader.utils.ts +11 -14
- package/src/screens/chat-detail/hooks/useAttachmentSendHandler.ts +291 -0
- package/src/screens/chat-detail/hooks/useChatComposerAnimation.ts +184 -0
- package/src/screens/chat-detail/hooks/useChatComposerState.ts +40 -0
- package/src/screens/chat-detail/index.ts +0 -2
- package/src/screens/chat-detail/legend/LegendChatMessage.tsx +44 -39
- package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
- package/src/screens/chat-detail/types.ts +11 -9
- package/src/screens/inbox/MessagesTab.tsx +1 -1
- package/src/services/attachmentHandlers/fileAttachmentHandler.ts +78 -0
- package/src/services/attachmentHandlers/imageAttachmentHandler.ts +54 -0
- package/src/services/attachmentHandlers/index.ts +10 -0
- package/src/services/attachmentHandlers/videoAttachmentHandler.ts +114 -0
- package/src/services/attachmentOrchestrator.ts +300 -0
- package/src/services/auth.ts +34 -0
- package/src/services/endpoints.ts +24 -1
- package/src/services/imageUpload.ts +162 -0
- package/src/store/conversation.ts +1 -1
- package/src/store/message.ts +44 -0
- package/src/translation/resources/i18n.ts +22 -2
- package/src/types/attachment.ts +85 -0
- package/src/types/attachmentHandler.ts +31 -0
- package/src/types/chat.ts +31 -30
- package/src/types/common.ts +1 -0
- package/src/types/imageUpload.ts +28 -0
- package/src/types/message.ts +1 -0
- package/src/utils/chatImageDimens.ts +178 -0
- package/src/utils/conversation.ts +44 -17
- package/src/utils/device.ts +73 -0
- package/src/utils/imageUrlOptimizer.ts +56 -0
- package/src/utils/imageUtils.ts +76 -0
- package/src/utils/legendListMessage.ts +0 -5
- package/src/utils/message.ts +10 -12
- package/src/utils/resolveMessageType.ts +2 -0
- package/src/utils/ui.ts +19 -0
- package/src/utils/url.ts +3 -3
- package/src/utils/videoThumbnail.ts +85 -0
- package/lib/module/screens/chat-detail/ChatList.js +0 -147
- package/lib/module/screens/chat-detail/ChatList.js.map +0 -1
- package/lib/module/screens/chat-detail/ChatTextBubble.js +0 -62
- package/lib/module/screens/chat-detail/ChatTextBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/legend/message-types.js +0 -122
- package/lib/module/screens/chat-detail/legend/message-types.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js +0 -24
- package/lib/module/screens/chat-detail/messages/ChatMessageBubble.js.map +0 -1
- package/lib/module/screens/chat-detail/messages/types.js +0 -4
- package/lib/module/screens/chat-detail/messages/types.js.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatList.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/ChatTextBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts +0 -12
- package/lib/typescript/src/screens/chat-detail/legend/message-types.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts +0 -3
- package/lib/typescript/src/screens/chat-detail/messages/ChatMessageBubble.d.ts.map +0 -1
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts +0 -13
- package/lib/typescript/src/screens/chat-detail/messages/types.d.ts.map +0 -1
- package/src/screens/chat-detail/ChatList.tsx +0 -190
- package/src/screens/chat-detail/ChatTextBubble.tsx +0 -73
- package/src/screens/chat-detail/legend/message-types.tsx +0 -149
- package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
- package/src/screens/chat-detail/messages/types.ts +0 -14
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo, useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import { ActivityIndicator, StyleSheet } from 'react-native';
|
|
5
|
-
import { GiftedChat } from 'react-native-gifted-chat';
|
|
6
|
-
import { KContainer, KColors, KSpacingValue } from '@droppii/libs';
|
|
7
|
-
import { mapOpenIMMessagesToGiftedChat } from "../../utils/giftedChatMessage.js";
|
|
8
|
-
import { ChatDay } from "./ChatDay.js";
|
|
9
|
-
import { ChatLoadEarlier } from "./ChatLoadEarlier.js";
|
|
10
|
-
import { ChatScrollToBottom } from "./ChatScrollToBottom.js";
|
|
11
|
-
import { ChatMessageBubble } from "./messages/ChatMessageBubble.js";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export const ChatList = /*#__PURE__*/memo(({
|
|
14
|
-
messages = [],
|
|
15
|
-
currentUserId = '',
|
|
16
|
-
renderChat,
|
|
17
|
-
onLoadEarlier,
|
|
18
|
-
isLoading,
|
|
19
|
-
isLoadingEarlier,
|
|
20
|
-
hasMoreEarlier
|
|
21
|
-
// Note: onLoadNewer, isLoadingNewer, hasMoreNewer are not used in GiftedChat
|
|
22
|
-
// as it has its own pagination mechanism. They're kept for API compatibility.
|
|
23
|
-
}) => {
|
|
24
|
-
const giftedMessages = useMemo(() => mapOpenIMMessagesToGiftedChat(messages), [messages]);
|
|
25
|
-
const user = useMemo(() => ({
|
|
26
|
-
_id: String(currentUserId)
|
|
27
|
-
}), [currentUserId]);
|
|
28
|
-
const renderMessage = useCallback(props => {
|
|
29
|
-
const currentMessage = props.currentMessage;
|
|
30
|
-
if (!currentMessage) {
|
|
31
|
-
return /*#__PURE__*/_jsx(KContainer.View, {});
|
|
32
|
-
}
|
|
33
|
-
const isOutgoing = props.position === 'right';
|
|
34
|
-
return /*#__PURE__*/_jsx(KContainer.View, {
|
|
35
|
-
style: [styles.messageRow, isOutgoing ? styles.messageRowRight : styles.messageRowLeft],
|
|
36
|
-
children: renderChat ? renderChat(currentMessage.openIMMessage) : /*#__PURE__*/_jsx(ChatMessageBubble, {
|
|
37
|
-
message: currentMessage,
|
|
38
|
-
position: props.position
|
|
39
|
-
})
|
|
40
|
-
});
|
|
41
|
-
}, [renderChat]);
|
|
42
|
-
const renderDay = useCallback(props => /*#__PURE__*/_jsx(ChatDay, {
|
|
43
|
-
...props
|
|
44
|
-
}), []);
|
|
45
|
-
const renderLoadEarlier = useCallback(props => /*#__PURE__*/_jsx(ChatLoadEarlier, {
|
|
46
|
-
...props
|
|
47
|
-
}), []);
|
|
48
|
-
const onLoadEarlierRef = useRef(onLoadEarlier);
|
|
49
|
-
onLoadEarlierRef.current = onLoadEarlier;
|
|
50
|
-
const handleLoadEarlier = useCallback(() => {
|
|
51
|
-
onLoadEarlierRef.current?.();
|
|
52
|
-
}, []);
|
|
53
|
-
const loadEarlierMessagesProps = useMemo(() => onLoadEarlier ? {
|
|
54
|
-
isAvailable: !!hasMoreEarlier,
|
|
55
|
-
isInfiniteScrollEnabled: true,
|
|
56
|
-
onPress: handleLoadEarlier,
|
|
57
|
-
isLoading: isLoadingEarlier ?? false
|
|
58
|
-
} : undefined, [hasMoreEarlier, isLoadingEarlier, onLoadEarlier, handleLoadEarlier]);
|
|
59
|
-
const renderScrollToBottom = useCallback(() => /*#__PURE__*/_jsx(ChatScrollToBottom, {}), []);
|
|
60
|
-
return /*#__PURE__*/_jsx(KContainer.View, {
|
|
61
|
-
flex: true,
|
|
62
|
-
background: KColors.white,
|
|
63
|
-
children: isLoading ? /*#__PURE__*/_jsx(KContainer.View, {
|
|
64
|
-
flex: true,
|
|
65
|
-
center: true,
|
|
66
|
-
children: /*#__PURE__*/_jsx(ActivityIndicator, {
|
|
67
|
-
color: KColors.palette.primary.w400,
|
|
68
|
-
size: "small"
|
|
69
|
-
})
|
|
70
|
-
}) : /*#__PURE__*/_jsx(GiftedChat, {
|
|
71
|
-
messages: giftedMessages,
|
|
72
|
-
user: user,
|
|
73
|
-
renderInputToolbar: () => null,
|
|
74
|
-
renderAvatar: () => null,
|
|
75
|
-
renderMessage: renderMessage,
|
|
76
|
-
renderDay: renderDay,
|
|
77
|
-
renderLoadEarlier: onLoadEarlier ? renderLoadEarlier : undefined,
|
|
78
|
-
isDayAnimationEnabled: false,
|
|
79
|
-
keyboardAvoidingViewProps: {
|
|
80
|
-
enabled: false
|
|
81
|
-
},
|
|
82
|
-
messagesContainerStyle: styles.messagesContainer,
|
|
83
|
-
minInputToolbarHeight: 0,
|
|
84
|
-
loadEarlierMessagesProps: loadEarlierMessagesProps,
|
|
85
|
-
listProps: {
|
|
86
|
-
showsVerticalScrollIndicator: false,
|
|
87
|
-
keyboardShouldPersistTaps: 'handled',
|
|
88
|
-
contentContainerStyle: styles.content,
|
|
89
|
-
onEndReachedThreshold: 0.5
|
|
90
|
-
},
|
|
91
|
-
reply: {
|
|
92
|
-
swipe: {
|
|
93
|
-
isEnabled: true,
|
|
94
|
-
direction: 'left'
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
isScrollToBottomEnabled: true,
|
|
98
|
-
scrollToBottomComponent: renderScrollToBottom,
|
|
99
|
-
scrollToBottomStyle: styles.scrollToBottom,
|
|
100
|
-
scrollToBottomContentStyle: styles.scrollToBottomContent
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
ChatList.displayName = 'ChatList';
|
|
105
|
-
const styles = StyleSheet.create({
|
|
106
|
-
messagesContainer: {
|
|
107
|
-
backgroundColor: KColors.white
|
|
108
|
-
},
|
|
109
|
-
content: {
|
|
110
|
-
paddingVertical: KSpacingValue['0.75rem'],
|
|
111
|
-
flexGrow: 1
|
|
112
|
-
},
|
|
113
|
-
messageRow: {
|
|
114
|
-
width: '100%',
|
|
115
|
-
paddingHorizontal: KSpacingValue['0.75rem'],
|
|
116
|
-
marginBottom: KSpacingValue['0.25rem']
|
|
117
|
-
},
|
|
118
|
-
messageRowLeft: {
|
|
119
|
-
alignItems: 'flex-start'
|
|
120
|
-
},
|
|
121
|
-
messageRowRight: {
|
|
122
|
-
alignItems: 'flex-end'
|
|
123
|
-
},
|
|
124
|
-
scrollToBottom: {
|
|
125
|
-
position: 'absolute',
|
|
126
|
-
bottom: 20,
|
|
127
|
-
right: 16,
|
|
128
|
-
zIndex: 999
|
|
129
|
-
},
|
|
130
|
-
scrollToBottomContent: {
|
|
131
|
-
backgroundColor: KColors.white,
|
|
132
|
-
width: 32,
|
|
133
|
-
height: 32,
|
|
134
|
-
borderRadius: 16,
|
|
135
|
-
shadowColor: KColors.black,
|
|
136
|
-
shadowOffset: {
|
|
137
|
-
width: 0,
|
|
138
|
-
height: 1
|
|
139
|
-
},
|
|
140
|
-
shadowOpacity: 0.16,
|
|
141
|
-
shadowRadius: 8,
|
|
142
|
-
elevation: 8,
|
|
143
|
-
justifyContent: 'center',
|
|
144
|
-
alignItems: 'center'
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
//# sourceMappingURL=ChatList.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["memo","useCallback","useMemo","useRef","ActivityIndicator","StyleSheet","GiftedChat","KContainer","KColors","KSpacingValue","mapOpenIMMessagesToGiftedChat","ChatDay","ChatLoadEarlier","ChatScrollToBottom","ChatMessageBubble","jsx","_jsx","ChatList","messages","currentUserId","renderChat","onLoadEarlier","isLoading","isLoadingEarlier","hasMoreEarlier","giftedMessages","user","_id","String","renderMessage","props","currentMessage","View","isOutgoing","position","style","styles","messageRow","messageRowRight","messageRowLeft","children","openIMMessage","message","renderDay","renderLoadEarlier","onLoadEarlierRef","current","handleLoadEarlier","loadEarlierMessagesProps","isAvailable","isInfiniteScrollEnabled","onPress","undefined","renderScrollToBottom","flex","background","white","center","color","palette","primary","w400","size","renderInputToolbar","renderAvatar","isDayAnimationEnabled","keyboardAvoidingViewProps","enabled","messagesContainerStyle","messagesContainer","minInputToolbarHeight","listProps","showsVerticalScrollIndicator","keyboardShouldPersistTaps","contentContainerStyle","content","onEndReachedThreshold","reply","swipe","isEnabled","direction","isScrollToBottomEnabled","scrollToBottomComponent","scrollToBottomStyle","scrollToBottom","scrollToBottomContentStyle","scrollToBottomContent","displayName","create","backgroundColor","paddingVertical","flexGrow","width","paddingHorizontal","marginBottom","alignItems","bottom","right","zIndex","height","borderRadius","shadowColor","black","shadowOffset","shadowOpacity","shadowRadius","elevation","justifyContent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatList.tsx"],"mappings":";;AAAA,SAASA,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC1D,SAASC,iBAAiB,EAAEC,UAAU,QAAQ,cAAc;AAC5D,SACEC,UAAU,QAIL,0BAA0B;AACjC,SAASC,UAAU,EAAEC,OAAO,EAAEC,aAAa,QAAQ,eAAe;AAClE,SAASC,6BAA6B,QAAQ,kCAA+B;AAI7E,SAASC,OAAO,QAAQ,cAAW;AACnC,SAASC,eAAe,QAAQ,sBAAmB;AACnD,SAASC,kBAAkB,QAAQ,yBAAsB;AACzD,SAASC,iBAAiB,QAAQ,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEjE,OAAO,MAAMC,QAAQ,gBAAGjB,IAAI,CAC1B,CAAC;EACCkB,QAAQ,GAAG,EAAE;EACbC,aAAa,GAAG,EAAE;EAClBC,UAAU;EACVC,aAAa;EACbC,SAAS;EACTC,gBAAgB;EAChBC;EACA;EACA;AACa,CAAC,KAAK;EACnB,MAAMC,cAAc,GAAGvB,OAAO,CAC5B,MAAMQ,6BAA6B,CAACQ,QAAQ,CAAC,EAC7C,CAACA,QAAQ,CACX,CAAC;EAED,MAAMQ,IAAI,GAAGxB,OAAO,CAClB,OAAO;IAAEyB,GAAG,EAAEC,MAAM,CAACT,aAAa;EAAE,CAAC,CAAC,EACtC,CAACA,aAAa,CAChB,CAAC;EAED,MAAMU,aAAa,GAAG5B,WAAW,CAC9B6B,KAAuC,IAAK;IAC3C,MAAMC,cAAc,GAAGD,KAAK,CAACC,cAAc;IAE3C,IAAI,CAACA,cAAc,EAAE;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@@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { StyleSheet } from 'react-native';
|
|
5
|
-
import { KContainer, KLabel, KSpacingValue } from '@droppii/libs';
|
|
6
|
-
import { CHAT_BUBBLE_COLORS } from "./constants.js";
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
-
const formatMessageTime = createdAt => {
|
|
9
|
-
const date = new Date(createdAt);
|
|
10
|
-
if (Number.isNaN(date.getTime())) {
|
|
11
|
-
return '';
|
|
12
|
-
}
|
|
13
|
-
return date.toLocaleTimeString('vi-VN', {
|
|
14
|
-
hour: '2-digit',
|
|
15
|
-
minute: '2-digit',
|
|
16
|
-
hour12: false
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export const ChatTextBubble = /*#__PURE__*/memo(({
|
|
20
|
-
message,
|
|
21
|
-
position
|
|
22
|
-
}) => {
|
|
23
|
-
const isOutgoing = position === 'right';
|
|
24
|
-
const timeLabel = formatMessageTime(message.createdAt);
|
|
25
|
-
if (!message.text?.trim()) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return /*#__PURE__*/_jsxs(KContainer.View, {
|
|
29
|
-
style: styles.wrapper,
|
|
30
|
-
children: [/*#__PURE__*/_jsx(KContainer.View, {
|
|
31
|
-
style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
|
|
32
|
-
children: /*#__PURE__*/_jsx(KLabel.Text, {
|
|
33
|
-
typo: "TextMdNormal",
|
|
34
|
-
color: CHAT_BUBBLE_COLORS.text,
|
|
35
|
-
children: message.text
|
|
36
|
-
})
|
|
37
|
-
}), !isOutgoing && timeLabel ? /*#__PURE__*/_jsx(KLabel.Text, {
|
|
38
|
-
typo: "TextXsNormal",
|
|
39
|
-
color: CHAT_BUBBLE_COLORS.timestamp,
|
|
40
|
-
marginL: '0.25rem',
|
|
41
|
-
children: timeLabel
|
|
42
|
-
}) : null]
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
ChatTextBubble.displayName = 'ChatTextBubble';
|
|
46
|
-
const styles = StyleSheet.create({
|
|
47
|
-
wrapper: {
|
|
48
|
-
maxWidth: '80%'
|
|
49
|
-
},
|
|
50
|
-
bubble: {
|
|
51
|
-
paddingHorizontal: KSpacingValue['0.75rem'],
|
|
52
|
-
paddingVertical: KSpacingValue['0.5rem'],
|
|
53
|
-
borderRadius: KSpacingValue['1.25rem']
|
|
54
|
-
},
|
|
55
|
-
bubbleReceived: {
|
|
56
|
-
backgroundColor: CHAT_BUBBLE_COLORS.received
|
|
57
|
-
},
|
|
58
|
-
bubbleSent: {
|
|
59
|
-
backgroundColor: CHAT_BUBBLE_COLORS.sent
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
//# sourceMappingURL=ChatTextBubble.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["memo","StyleSheet","KContainer","KLabel","KSpacingValue","CHAT_BUBBLE_COLORS","jsx","_jsx","jsxs","_jsxs","formatMessageTime","createdAt","date","Date","Number","isNaN","getTime","toLocaleTimeString","hour","minute","hour12","ChatTextBubble","message","position","isOutgoing","timeLabel","text","trim","View","style","styles","wrapper","children","bubble","bubbleSent","bubbleReceived","Text","typo","color","timestamp","marginL","displayName","create","maxWidth","paddingHorizontal","paddingVertical","borderRadius","backgroundColor","received","sent"],"sourceRoot":"../../../../src","sources":["screens/chat-detail/ChatTextBubble.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,MAAM,EAAEC,aAAa,QAAQ,eAAe;AAEjE,SAASC,kBAAkB,QAAQ,gBAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEjD,MAAMC,iBAAiB,GAAIC,SAAwB,IAAK;EACtD,MAAMC,IAAI,GAAG,IAAIC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CAAC;AAEtB,CACF,CAAC;AAEDJ,cAAc,CAACoB,WAAW,GAAG,gBAAgB;AAE7C,MAAMX,MAAM,GAAG7B,UAAU,CAACyC,MAAM,CAAC;EAC/BX,OAAO,EAAE;IACPY,QAAQ,EAAE;EACZ,CAAC;EACDV,MAAM,EAAE;IACNW,iBAAiB,EAAExC,aAAa,CAAC,SAAS,CAAC;IAC3CyC,eAAe,EAAEzC,aAAa,CAAC,QAAQ,CAAC;IACxC0C,YAAY,EAAE1C,aAAa,CAAC,SAAS;EACvC,CAAC;EACD+B,cAAc,EAAE;IACdY,eAAe,EAAE1C,kBAAkB,CAAC2C;EACtC,CAAC;EACDd,UAAU,EAAE;IACVa,eAAe,EAAE1C,kBAAkB,CAAC4C;EACtC;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { StyleSheet } from 'react-native';
|
|
5
|
-
import { KContainer, KLabel, KSpacingValue } from '@droppii/libs';
|
|
6
|
-
import { getMessageText } from "../../../utils/legendListMessage.js";
|
|
7
|
-
import { CHAT_BUBBLE_COLORS } from "../constants.js";
|
|
8
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
const formatMessageTime = createdAt => {
|
|
10
|
-
const date = new Date(createdAt);
|
|
11
|
-
if (Number.isNaN(date.getTime())) {
|
|
12
|
-
return '';
|
|
13
|
-
}
|
|
14
|
-
return date.toLocaleTimeString('vi-VN', {
|
|
15
|
-
hour: '2-digit',
|
|
16
|
-
minute: '2-digit',
|
|
17
|
-
hour12: false
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// Text Message Component
|
|
22
|
-
export const LegendTextMessage = /*#__PURE__*/memo(({
|
|
23
|
-
message,
|
|
24
|
-
isOutgoing,
|
|
25
|
-
createdAtTime
|
|
26
|
-
}) => {
|
|
27
|
-
const messageText = getMessageText(message);
|
|
28
|
-
const timeLabel = formatMessageTime(createdAtTime);
|
|
29
|
-
if (!messageText?.trim()) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
return /*#__PURE__*/_jsxs(KContainer.View, {
|
|
33
|
-
style: styles.wrapper,
|
|
34
|
-
children: [/*#__PURE__*/_jsx(KContainer.View, {
|
|
35
|
-
style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
|
|
36
|
-
children: /*#__PURE__*/_jsx(KLabel.Text, {
|
|
37
|
-
typo: "TextMdNormal",
|
|
38
|
-
color: CHAT_BUBBLE_COLORS.text,
|
|
39
|
-
children: messageText
|
|
40
|
-
})
|
|
41
|
-
}), !isOutgoing && timeLabel ? /*#__PURE__*/_jsx(KLabel.Text, {
|
|
42
|
-
typo: "TextXsNormal",
|
|
43
|
-
color: CHAT_BUBBLE_COLORS.timestamp,
|
|
44
|
-
marginL: '0.25rem',
|
|
45
|
-
children: timeLabel
|
|
46
|
-
}) : null]
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
LegendTextMessage.displayName = 'LegendTextMessage';
|
|
50
|
-
|
|
51
|
-
// Image Message Component (placeholder)
|
|
52
|
-
export const LegendImageMessage = /*#__PURE__*/memo(({
|
|
53
|
-
isOutgoing
|
|
54
|
-
}) => {
|
|
55
|
-
return /*#__PURE__*/_jsx(KContainer.View, {
|
|
56
|
-
style: styles.wrapper,
|
|
57
|
-
children: /*#__PURE__*/_jsx(KContainer.View, {
|
|
58
|
-
style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
|
|
59
|
-
children: /*#__PURE__*/_jsx(KLabel.Text, {
|
|
60
|
-
typo: "TextSmNormal",
|
|
61
|
-
color: CHAT_BUBBLE_COLORS.text,
|
|
62
|
-
children: "[Image]"
|
|
63
|
-
})
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
LegendImageMessage.displayName = 'LegendImageMessage';
|
|
68
|
-
|
|
69
|
-
// Video Message Component (placeholder)
|
|
70
|
-
export const LegendVideoMessage = /*#__PURE__*/memo(({
|
|
71
|
-
isOutgoing
|
|
72
|
-
}) => {
|
|
73
|
-
return /*#__PURE__*/_jsx(KContainer.View, {
|
|
74
|
-
style: styles.wrapper,
|
|
75
|
-
children: /*#__PURE__*/_jsx(KContainer.View, {
|
|
76
|
-
style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
|
|
77
|
-
children: /*#__PURE__*/_jsx(KLabel.Text, {
|
|
78
|
-
typo: "TextSmNormal",
|
|
79
|
-
color: CHAT_BUBBLE_COLORS.text,
|
|
80
|
-
children: "[Video]"
|
|
81
|
-
})
|
|
82
|
-
})
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
LegendVideoMessage.displayName = 'LegendVideoMessage';
|
|
86
|
-
|
|
87
|
-
// File Message Component
|
|
88
|
-
export const LegendFileMessage = /*#__PURE__*/memo(({
|
|
89
|
-
message,
|
|
90
|
-
isOutgoing
|
|
91
|
-
}) => {
|
|
92
|
-
const fileName = message.fileElem?.fileName || message.content || '[File]';
|
|
93
|
-
return /*#__PURE__*/_jsx(KContainer.View, {
|
|
94
|
-
style: styles.wrapper,
|
|
95
|
-
children: /*#__PURE__*/_jsx(KContainer.View, {
|
|
96
|
-
style: [styles.bubble, isOutgoing ? styles.bubbleSent : styles.bubbleReceived],
|
|
97
|
-
children: /*#__PURE__*/_jsxs(KLabel.Text, {
|
|
98
|
-
typo: "TextSmNormal",
|
|
99
|
-
color: CHAT_BUBBLE_COLORS.text,
|
|
100
|
-
children: ["\uD83D\uDCCE ", fileName]
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
LegendFileMessage.displayName = 'LegendFileMessage';
|
|
106
|
-
const styles = StyleSheet.create({
|
|
107
|
-
wrapper: {
|
|
108
|
-
maxWidth: '80%'
|
|
109
|
-
},
|
|
110
|
-
bubble: {
|
|
111
|
-
paddingHorizontal: KSpacingValue['0.75rem'],
|
|
112
|
-
paddingVertical: KSpacingValue['0.5rem'],
|
|
113
|
-
borderRadius: KSpacingValue['1.25rem']
|
|
114
|
-
},
|
|
115
|
-
bubbleReceived: {
|
|
116
|
-
backgroundColor: CHAT_BUBBLE_COLORS.received
|
|
117
|
-
},
|
|
118
|
-
bubbleSent: {
|
|
119
|
-
backgroundColor: CHAT_BUBBLE_COLORS.sent
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
//# sourceMappingURL=message-types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["memo","StyleSheet","KContainer","KLabel","KSpacingValue","getMessageText","CHAT_BUBBLE_COLORS","jsx","_jsx","jsxs","_jsxs","formatMessageTime","createdAt","date","Date","Number","isNaN","getTime","toLocaleTimeString","hour","minute","hour12","LegendTextMessage","message","isOutgoing","createdAtTime","messageText","timeLabel","trim","View","style","styles","wrapper","children","bubble","bubbleSent","bubbleReceived","Text","typo","color","text","timestamp","marginL","displayName","LegendImageMessage","LegendVideoMessage","LegendFileMessage","fileName","fileElem","content","create","maxWidth","paddingHorizontal","paddingVertical","borderRadius","backgroundColor","received","sent"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/legend/message-types.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,UAAU,EAAEC,MAAM,EAAEC,aAAa,QAAQ,eAAe;AAEjE,SAASC,cAAc,QAAQ,qCAAkC;AACjE,SAASC,kBAAkB,QAAQ,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAQlD,MAAMC,iBAAiB,GAAIC,SAAiB,IAAK;EAC/C,MAAMC,IAAI,GAAG,IAAIC,IAAI,CAACF,SAAS,CAAC;EAChC,IAAIG,MAAM,CAACC,KAAK,CAACH,IAAI,CAACI,OAAO,CAAC,CAAC,CAAC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,MAAMuB,QAAQ,GAAGxB,OAAO,CAACyB,QAAQ,EAAED,QAAQ,IAAIxB,OAAO,CAAC0B,OAAO,IAAI,QAAQ;EAE1E,oBACEzC,IAAA,CAACN,UAAU,CAAC2B,IAAI;IAACC,KAAK,EAAEC,MAAM,CAACC,OAAQ;IAAAC,QAAA,eACrCzB,IAAA,CAACN,UAAU,CAAC2B,IAAI;MACdC,KAAK,EAAE,CACLC,MAAM,CAACG,MAAM,EACbV,UAAU,GAAGO,MAAM,CAACI,UAAU,GAAGJ,MAAM,CAACK,cAAc,CACtD;MAAAH,QAAA,eAEFvB,KAAA,CAACP,MAAM,CAACkC,IAAI;QAACC,IAAI,EAAC,cAAc;QAACC,KAAK,EAAEjC,kBAAkB,CAACkC,IAAK;QAAAP,QAAA,GAAC,eAC5D,EAACc,QAAQ;MAAA,CACD;IAAC,CACC;EAAC,CACH,CAAC;AAEtB,CACF,CAAC;AAEDD,iBAAiB,CAACH,WAAW,GAAG,mBAAmB;AAEnD,MAAMZ,MAAM,GAAG9B,UAAU,CAACiD,MAAM,CAAC;EAC/BlB,OAAO,EAAE;IACPmB,QAAQ,EAAE;EACZ,CAAC;EACDjB,MAAM,EAAE;IACNkB,iBAAiB,EAAEhD,aAAa,CAAC,SAAS,CAAC;IAC3CiD,eAAe,EAAEjD,aAAa,CAAC,QAAQ,CAAC;IACxCkD,YAAY,EAAElD,aAAa,CAAC,SAAS;EACvC,CAAC;EACDgC,cAAc,EAAE;IACdmB,eAAe,EAAEjD,kBAAkB,CAACkD;EACtC,CAAC;EACDrB,UAAU,EAAE;IACVoB,eAAe,EAAEjD,kBAAkB,CAACmD;EACtC;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { DChatMessageType } from "../../../types/message.js";
|
|
5
|
-
import { ChatTextBubble } from "../ChatTextBubble.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const getMessageRenderers = () => ({
|
|
8
|
-
[DChatMessageType.Text]: ChatTextBubble
|
|
9
|
-
});
|
|
10
|
-
export const ChatMessageBubble = /*#__PURE__*/memo(({
|
|
11
|
-
message,
|
|
12
|
-
position
|
|
13
|
-
}) => {
|
|
14
|
-
const Renderer = getMessageRenderers()[message.messageType];
|
|
15
|
-
if (!Renderer) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return /*#__PURE__*/_jsx(Renderer, {
|
|
19
|
-
message: message,
|
|
20
|
-
position: position
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
ChatMessageBubble.displayName = 'ChatMessageBubble';
|
|
24
|
-
//# sourceMappingURL=ChatMessageBubble.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["memo","DChatMessageType","ChatTextBubble","jsx","_jsx","getMessageRenderers","Text","ChatMessageBubble","message","position","Renderer","messageType","displayName"],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/messages/ChatMessageBubble.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,OAAO;AAC5B,SAASC,gBAAgB,QAAQ,2BAAwB;AACzD,SAASC,cAAc,QAAQ,sBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGnD,MAAMC,mBAAmB,GAAGA,CAAA,MAEtB;EACJ,CAACJ,gBAAgB,CAACK,IAAI,GAAGJ;AAC3B,CAAC,CAAC;AAEF,OAAO,MAAMK,iBAAiB,gBAAGP,IAAI,CACnC,CAAC;EAAEQ,OAAO;EAAEC;AAAiC,CAAC,KAAK;EACjD,MAAMC,QAAQ,GAAGL,mBAAmB,CAAC,CAAC,CAACG,OAAO,CAACG,WAAW,CAAC;EAC3D,IAAI,CAACD,QAAQ,EAAE;IACb,OAAO,IAAI;EACb;EAEA,oBAAON,IAAA,CAACM,QAAQ;IAACF,OAAO,EAAEA,OAAQ;IAACC,QAAQ,EAAEA;EAAS,CAAE,CAAC;AAC3D,CACF,CAAC;AAEDF,iBAAiB,CAACK,WAAW,GAAG,mBAAmB","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["screens/chat-detail/messages/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { ChatListProps } from './types';
|
|
2
|
-
export declare const ChatList: import("react").MemoExoticComponent<({ messages, currentUserId, renderChat, onLoadEarlier, isLoading, isLoadingEarlier, hasMoreEarlier, }: ChatListProps) => import("react").JSX.Element>;
|
|
3
|
-
//# sourceMappingURL=ChatList.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatList.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatList.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAM7C,eAAO,MAAM,QAAQ,6IAWhB,aAAa,iCAsHjB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatTextBubble.d.ts","sourceRoot":"","sources":["../../../../../src/screens/chat-detail/ChatTextBubble.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAgB/D,eAAO,MAAM,cAAc,8DACD,sBAAsB,iCAiC/C,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { DMessageItem } from '../../../types/chat';
|
|
2
|
-
interface BaseLegendMessageProps {
|
|
3
|
-
message: DMessageItem;
|
|
4
|
-
isOutgoing: boolean;
|
|
5
|
-
createdAtTime: number;
|
|
6
|
-
}
|
|
7
|
-
export declare const LegendTextMessage: import("react").MemoExoticComponent<({ message, isOutgoing, createdAtTime }: BaseLegendMessageProps) => import("react").JSX.Element>;
|
|
8
|
-
export declare const LegendImageMessage: import("react").MemoExoticComponent<({ isOutgoing }: BaseLegendMessageProps) => import("react").JSX.Element>;
|
|
9
|
-
export declare const LegendVideoMessage: import("react").MemoExoticComponent<({ isOutgoing }: BaseLegendMessageProps) => import("react").JSX.Element>;
|
|
10
|
-
export declare const LegendFileMessage: import("react").MemoExoticComponent<({ message, isOutgoing }: BaseLegendMessageProps) => import("react").JSX.Element>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=message-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-types.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/legend/message-types.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAIxD,UAAU,sBAAsB;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAgBD,eAAO,MAAM,iBAAiB,+EACa,sBAAsB,iCAiChE,CAAC;AAKF,eAAO,MAAM,kBAAkB,uDACZ,sBAAsB,iCAgBxC,CAAC;AAKF,eAAO,MAAM,kBAAkB,uDACZ,sBAAsB,iCAgBxC,CAAC;AAKF,eAAO,MAAM,iBAAiB,gEACF,sBAAsB,iCAkBjD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageBubble.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messages/ChatMessageBubble.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAuB,MAAM,SAAS,CAAC;AAQ3E,eAAO,MAAM,iBAAiB,8DACJ,sBAAsB,iCAQ/C,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ComponentType } from 'react';
|
|
2
|
-
import type { IMessage } from 'react-native-gifted-chat';
|
|
3
|
-
import type { DMessageItem } from '../../../types/chat';
|
|
4
|
-
import type { DChatMessageType } from '../../../types/message';
|
|
5
|
-
export type ChatMessageBubbleProps = {
|
|
6
|
-
message: IMessage & {
|
|
7
|
-
openIMMessage: DMessageItem;
|
|
8
|
-
messageType: DChatMessageType;
|
|
9
|
-
};
|
|
10
|
-
position: 'left' | 'right';
|
|
11
|
-
};
|
|
12
|
-
export type ChatMessageRenderer = ComponentType<ChatMessageBubbleProps>;
|
|
13
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/screens/chat-detail/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,EAAE,QAAQ,GAAG;QAClB,aAAa,EAAE,YAAY,CAAC;QAC5B,WAAW,EAAE,gBAAgB,CAAC;KAC/B,CAAC;IACF,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { memo, useCallback, useMemo, useRef } from 'react';
|
|
2
|
-
import { ActivityIndicator, StyleSheet } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
GiftedChat,
|
|
5
|
-
type DayProps,
|
|
6
|
-
type LoadEarlierMessagesProps,
|
|
7
|
-
type MessageProps,
|
|
8
|
-
} from 'react-native-gifted-chat';
|
|
9
|
-
import { KContainer, KColors, KSpacingValue } from '@droppii/libs';
|
|
10
|
-
import { mapOpenIMMessagesToGiftedChat } from '../../utils/giftedChatMessage';
|
|
11
|
-
import type { DGiftedChatMessage } from '../../utils/giftedChatMessage';
|
|
12
|
-
|
|
13
|
-
import type { ChatListProps } from './types';
|
|
14
|
-
import { ChatDay } from './ChatDay';
|
|
15
|
-
import { ChatLoadEarlier } from './ChatLoadEarlier';
|
|
16
|
-
import { ChatScrollToBottom } from './ChatScrollToBottom';
|
|
17
|
-
import { ChatMessageBubble } from './messages/ChatMessageBubble';
|
|
18
|
-
|
|
19
|
-
export const ChatList = memo(
|
|
20
|
-
({
|
|
21
|
-
messages = [],
|
|
22
|
-
currentUserId = '',
|
|
23
|
-
renderChat,
|
|
24
|
-
onLoadEarlier,
|
|
25
|
-
isLoading,
|
|
26
|
-
isLoadingEarlier,
|
|
27
|
-
hasMoreEarlier,
|
|
28
|
-
// Note: onLoadNewer, isLoadingNewer, hasMoreNewer are not used in GiftedChat
|
|
29
|
-
// as it has its own pagination mechanism. They're kept for API compatibility.
|
|
30
|
-
}: ChatListProps) => {
|
|
31
|
-
const giftedMessages = useMemo(
|
|
32
|
-
() => mapOpenIMMessagesToGiftedChat(messages),
|
|
33
|
-
[messages]
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const user = useMemo(
|
|
37
|
-
() => ({ _id: String(currentUserId) }),
|
|
38
|
-
[currentUserId]
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
const renderMessage = useCallback(
|
|
42
|
-
(props: MessageProps<DGiftedChatMessage>) => {
|
|
43
|
-
const currentMessage = props.currentMessage;
|
|
44
|
-
|
|
45
|
-
if (!currentMessage) {
|
|
46
|
-
return <KContainer.View />;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const isOutgoing = props.position === 'right';
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<KContainer.View
|
|
53
|
-
style={[
|
|
54
|
-
styles.messageRow,
|
|
55
|
-
isOutgoing ? styles.messageRowRight : styles.messageRowLeft,
|
|
56
|
-
]}
|
|
57
|
-
>
|
|
58
|
-
{renderChat ? (
|
|
59
|
-
renderChat(currentMessage.openIMMessage)
|
|
60
|
-
) : (
|
|
61
|
-
<ChatMessageBubble
|
|
62
|
-
message={currentMessage}
|
|
63
|
-
position={props.position}
|
|
64
|
-
/>
|
|
65
|
-
)}
|
|
66
|
-
</KContainer.View>
|
|
67
|
-
);
|
|
68
|
-
},
|
|
69
|
-
[renderChat]
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const renderDay = useCallback(
|
|
73
|
-
(props: DayProps) => <ChatDay {...props} />,
|
|
74
|
-
[]
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
const renderLoadEarlier = useCallback(
|
|
78
|
-
(props: LoadEarlierMessagesProps) => <ChatLoadEarlier {...props} />,
|
|
79
|
-
[]
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
const onLoadEarlierRef = useRef(onLoadEarlier);
|
|
83
|
-
onLoadEarlierRef.current = onLoadEarlier;
|
|
84
|
-
|
|
85
|
-
const handleLoadEarlier = useCallback(() => {
|
|
86
|
-
onLoadEarlierRef.current?.();
|
|
87
|
-
}, []);
|
|
88
|
-
|
|
89
|
-
const loadEarlierMessagesProps = useMemo(
|
|
90
|
-
() =>
|
|
91
|
-
onLoadEarlier
|
|
92
|
-
? {
|
|
93
|
-
isAvailable: !!hasMoreEarlier,
|
|
94
|
-
isInfiniteScrollEnabled: true,
|
|
95
|
-
onPress: handleLoadEarlier,
|
|
96
|
-
isLoading: isLoadingEarlier ?? false,
|
|
97
|
-
}
|
|
98
|
-
: undefined,
|
|
99
|
-
[hasMoreEarlier, isLoadingEarlier, onLoadEarlier, handleLoadEarlier]
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
const renderScrollToBottom = useCallback(() => <ChatScrollToBottom />, []);
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<KContainer.View flex background={KColors.white}>
|
|
106
|
-
{isLoading ? (
|
|
107
|
-
<KContainer.View flex center>
|
|
108
|
-
<ActivityIndicator
|
|
109
|
-
color={KColors.palette.primary.w400}
|
|
110
|
-
size="small"
|
|
111
|
-
/>
|
|
112
|
-
</KContainer.View>
|
|
113
|
-
) : (
|
|
114
|
-
<GiftedChat
|
|
115
|
-
messages={giftedMessages}
|
|
116
|
-
user={user}
|
|
117
|
-
renderInputToolbar={() => null}
|
|
118
|
-
renderAvatar={() => null}
|
|
119
|
-
renderMessage={renderMessage}
|
|
120
|
-
renderDay={renderDay}
|
|
121
|
-
renderLoadEarlier={onLoadEarlier ? renderLoadEarlier : undefined}
|
|
122
|
-
isDayAnimationEnabled={false}
|
|
123
|
-
keyboardAvoidingViewProps={{ enabled: false }}
|
|
124
|
-
messagesContainerStyle={styles.messagesContainer}
|
|
125
|
-
minInputToolbarHeight={0}
|
|
126
|
-
loadEarlierMessagesProps={loadEarlierMessagesProps}
|
|
127
|
-
listProps={{
|
|
128
|
-
showsVerticalScrollIndicator: false,
|
|
129
|
-
keyboardShouldPersistTaps: 'handled',
|
|
130
|
-
contentContainerStyle: styles.content,
|
|
131
|
-
onEndReachedThreshold: 0.5,
|
|
132
|
-
}}
|
|
133
|
-
reply={{
|
|
134
|
-
swipe: {
|
|
135
|
-
isEnabled: true,
|
|
136
|
-
direction: 'left',
|
|
137
|
-
},
|
|
138
|
-
}}
|
|
139
|
-
isScrollToBottomEnabled
|
|
140
|
-
scrollToBottomComponent={renderScrollToBottom}
|
|
141
|
-
scrollToBottomStyle={styles.scrollToBottom}
|
|
142
|
-
scrollToBottomContentStyle={styles.scrollToBottomContent}
|
|
143
|
-
/>
|
|
144
|
-
)}
|
|
145
|
-
</KContainer.View>
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
ChatList.displayName = 'ChatList';
|
|
151
|
-
|
|
152
|
-
const styles = StyleSheet.create({
|
|
153
|
-
messagesContainer: {
|
|
154
|
-
backgroundColor: KColors.white,
|
|
155
|
-
},
|
|
156
|
-
content: {
|
|
157
|
-
paddingVertical: KSpacingValue['0.75rem'],
|
|
158
|
-
flexGrow: 1,
|
|
159
|
-
},
|
|
160
|
-
messageRow: {
|
|
161
|
-
width: '100%',
|
|
162
|
-
paddingHorizontal: KSpacingValue['0.75rem'],
|
|
163
|
-
marginBottom: KSpacingValue['0.25rem'],
|
|
164
|
-
},
|
|
165
|
-
messageRowLeft: {
|
|
166
|
-
alignItems: 'flex-start',
|
|
167
|
-
},
|
|
168
|
-
messageRowRight: {
|
|
169
|
-
alignItems: 'flex-end',
|
|
170
|
-
},
|
|
171
|
-
scrollToBottom: {
|
|
172
|
-
position: 'absolute',
|
|
173
|
-
bottom: 20,
|
|
174
|
-
right: 16,
|
|
175
|
-
zIndex: 999,
|
|
176
|
-
},
|
|
177
|
-
scrollToBottomContent: {
|
|
178
|
-
backgroundColor: KColors.white,
|
|
179
|
-
width: 32,
|
|
180
|
-
height: 32,
|
|
181
|
-
borderRadius: 16,
|
|
182
|
-
shadowColor: KColors.black,
|
|
183
|
-
shadowOffset: { width: 0, height: 1 },
|
|
184
|
-
shadowOpacity: 0.16,
|
|
185
|
-
shadowRadius: 8,
|
|
186
|
-
elevation: 8,
|
|
187
|
-
justifyContent: 'center',
|
|
188
|
-
alignItems: 'center',
|
|
189
|
-
},
|
|
190
|
-
});
|