@droppii-org/chat-mobile 0.2.7 → 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/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/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 +10 -5
- package/lib/module/hooks/message/useSendMessage.js.map +1 -1
- package/lib/module/hooks/useChatMessages.js +0 -3
- package/lib/module/hooks/useChatMessages.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/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 +94 -63
- package/lib/module/screens/chat-detail/ChatDetail.js.map +1 -1
- package/lib/module/screens/chat-detail/ChatListLegend.js +5 -13
- 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/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 +33 -13
- 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/translation/resources/i18n.js +22 -8
- 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/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/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/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 +1 -1
- 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/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/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.map +1 -1
- package/lib/typescript/src/hooks/useChatMessages.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/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/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/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 -1
- 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 +4 -1
- 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/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/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/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/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/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/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/core/index.ts +25 -1
- package/src/core/useChatListener.ts +0 -21
- package/src/hooks/message/useSendMessage.ts +12 -5
- package/src/hooks/useChatMessages.ts +0 -4
- package/src/hooks/useImageAttachment.ts +348 -0
- 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 +142 -89
- package/src/screens/chat-detail/ChatListLegend.tsx +9 -11
- 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/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 +47 -24
- package/src/screens/chat-detail/legend/messageTypes.tsx +13 -0
- package/src/screens/chat-detail/types.ts +5 -1
- 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/translation/resources/i18n.ts +22 -8
- package/src/types/attachment.ts +85 -0
- package/src/types/attachmentHandler.ts +31 -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/device.ts +73 -0
- package/src/utils/imageUrlOptimizer.ts +56 -0
- package/src/utils/imageUtils.ts +76 -0
- package/src/utils/resolveMessageType.ts +2 -0
- package/src/utils/ui.ts +19 -0
- package/src/utils/url.ts +1 -1
- 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 -244
- 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 -13
- 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 -304
- package/src/screens/chat-detail/messages/ChatMessageBubble.tsx +0 -23
- package/src/screens/chat-detail/messages/types.ts +0 -14
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { memo, useState, useCallback, useEffect, useMemo } from 'react';
|
|
1
|
+
import { memo, useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
6
6
|
import { KContainer } from '@droppii/libs';
|
|
7
|
+
import { useNavigation } from '@react-navigation/native';
|
|
7
8
|
import { useChatMessages } from '../../hooks/useChatMessages';
|
|
9
|
+
import {
|
|
10
|
+
MediaViewerModal,
|
|
11
|
+
type MediaViewerModalHandle,
|
|
12
|
+
} from '../../components/MediaViewerModal';
|
|
8
13
|
import { useConversation, useConversationStore } from '../../store';
|
|
9
14
|
import ChatDetailHeader from './ChatDetailHeader';
|
|
10
|
-
import { ChatList } from './ChatList';
|
|
11
15
|
import { ChatListLegend } from './ChatListLegend';
|
|
12
16
|
import { ChatComposer } from './ChatComposer';
|
|
13
17
|
import {
|
|
@@ -20,10 +24,14 @@ import {
|
|
|
20
24
|
getConversationTitle,
|
|
21
25
|
shouldShowAddMember,
|
|
22
26
|
} from './conversationHeader.utils';
|
|
23
|
-
import {
|
|
24
|
-
|
|
27
|
+
import type {
|
|
28
|
+
ChatDetailProps,
|
|
29
|
+
DChatQuickAction,
|
|
30
|
+
DChatAttachmentAction,
|
|
31
|
+
} from './types';
|
|
25
32
|
import { useSendMessage } from '../../hooks/message/useSendMessage';
|
|
26
33
|
import type { IUrlMetadata } from '../../types/common';
|
|
34
|
+
import { useMessageStore } from '../../store/message';
|
|
27
35
|
|
|
28
36
|
const ChatDetail = memo(
|
|
29
37
|
({
|
|
@@ -44,9 +52,7 @@ const ChatDetail = memo(
|
|
|
44
52
|
onPressAvatar,
|
|
45
53
|
renderChat,
|
|
46
54
|
showQuickActions = true,
|
|
47
|
-
showAttachmentActions = true,
|
|
48
55
|
quickActions,
|
|
49
|
-
getQuickActions,
|
|
50
56
|
inputValue,
|
|
51
57
|
inputPlaceholder,
|
|
52
58
|
onChangeInput,
|
|
@@ -60,10 +66,41 @@ const ChatDetail = memo(
|
|
|
60
66
|
renderAttachmentAction,
|
|
61
67
|
attachmentColumns,
|
|
62
68
|
}: ChatDetailProps) => {
|
|
63
|
-
const
|
|
69
|
+
const navigation = useNavigation();
|
|
70
|
+
const [internalInput, setInternalInput] = useState<string>('');
|
|
71
|
+
const mediaViewerRef = useRef<MediaViewerModalHandle>(null);
|
|
64
72
|
const conversation = useConversation(conversationId);
|
|
73
|
+
// const user = conversation?.peer;
|
|
74
|
+
|
|
75
|
+
// Default handlers when props not provided
|
|
76
|
+
const handleBackDefault = useCallback(() => {
|
|
77
|
+
navigation.goBack();
|
|
78
|
+
}, [navigation]);
|
|
79
|
+
|
|
80
|
+
const quickActionsDefault = useMemo<DChatQuickAction[]>(
|
|
81
|
+
() =>
|
|
82
|
+
DEFAULT_Chat_QUICK_ACTIONS.map((action) => ({
|
|
83
|
+
...action,
|
|
84
|
+
onPress: () => {
|
|
85
|
+
console.log('[quick-action]', action.id);
|
|
86
|
+
},
|
|
87
|
+
})),
|
|
88
|
+
[]
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const attachmentActionsDefault = useMemo<DChatAttachmentAction[]>(
|
|
92
|
+
() =>
|
|
93
|
+
DEFAULT_ATTACHMENT_ACTIONS.map((action) => ({
|
|
94
|
+
...action,
|
|
95
|
+
onPress: () => {
|
|
96
|
+
console.log('[attachment-action]', action.id);
|
|
97
|
+
},
|
|
98
|
+
})),
|
|
99
|
+
[]
|
|
100
|
+
);
|
|
65
101
|
|
|
66
102
|
const { sendMessage } = useSendMessage();
|
|
103
|
+
const { pushNewMessage } = useMessageStore();
|
|
67
104
|
|
|
68
105
|
const {
|
|
69
106
|
messages,
|
|
@@ -77,6 +114,21 @@ const ChatDetail = memo(
|
|
|
77
114
|
enabled,
|
|
78
115
|
});
|
|
79
116
|
|
|
117
|
+
// Callback for attachment messages - add them to the message list
|
|
118
|
+
const handleAttachmentMessageSent = useCallback(
|
|
119
|
+
(message: any) => {
|
|
120
|
+
if (__DEV__)
|
|
121
|
+
console.log('[ChatDetail] Attachment message received:', {
|
|
122
|
+
clientMsgID: message?.clientMsgID,
|
|
123
|
+
contentType: message?.contentType,
|
|
124
|
+
});
|
|
125
|
+
if (message) {
|
|
126
|
+
pushNewMessage(message);
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
[pushNewMessage]
|
|
130
|
+
);
|
|
131
|
+
|
|
80
132
|
useEffect(() => {
|
|
81
133
|
useConversationStore.getState().setCurrentConversation(conversationId);
|
|
82
134
|
}, [conversationId]);
|
|
@@ -85,7 +137,7 @@ const ChatDetail = memo(
|
|
|
85
137
|
const resolvedAvatarUri =
|
|
86
138
|
avatarUri ?? getConversationAvatarUri(conversation);
|
|
87
139
|
const resolvedAvatarFullName = avatarFullName ?? resolvedTitle;
|
|
88
|
-
const resolvedPeerType = peerType
|
|
140
|
+
const resolvedPeerType = peerType;
|
|
89
141
|
const resolvedApplicationType =
|
|
90
142
|
applicationType ?? conversation?.applicationType;
|
|
91
143
|
const resolvedShowAddMember =
|
|
@@ -102,77 +154,66 @@ const ChatDetail = memo(
|
|
|
102
154
|
return getConversationSubtitle(conversation);
|
|
103
155
|
}, [conversation, getSubtitle, subtitle]);
|
|
104
156
|
|
|
105
|
-
const
|
|
106
|
-
if (!showQuickActions) {
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
if (quickActions) {
|
|
111
|
-
return quickActions;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (getQuickActions && conversation) {
|
|
115
|
-
return getQuickActions(conversation);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
return DEFAULT_Chat_QUICK_ACTIONS;
|
|
119
|
-
}, [conversation, getQuickActions, quickActions, showQuickActions]);
|
|
120
|
-
|
|
121
|
-
const resolvedAttachmentActions = useMemo(() => {
|
|
122
|
-
if (!showAttachmentActions) {
|
|
123
|
-
return undefined;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return attachmentActions ?? DEFAULT_ATTACHMENT_ACTIONS;
|
|
127
|
-
}, [attachmentActions, showAttachmentActions]);
|
|
128
|
-
const [variant, setVariant] = useState<'gifted' | 'legend'>(
|
|
129
|
-
() => getFeatureFlag('CHAT_LIST_VARIANT') as 'gifted' | 'legend'
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
useEffect(() => {
|
|
133
|
-
const unsubscribe = onFlagsChange(() => {
|
|
134
|
-
const newVariant = getFeatureFlag('CHAT_LIST_VARIANT') as
|
|
135
|
-
| 'gifted'
|
|
136
|
-
| 'legend';
|
|
137
|
-
setVariant(newVariant);
|
|
138
|
-
});
|
|
139
|
-
return unsubscribe;
|
|
140
|
-
}, []);
|
|
157
|
+
const currentInput = inputValue ?? internalInput;
|
|
141
158
|
|
|
142
|
-
const
|
|
143
|
-
(text
|
|
159
|
+
const handleChangeText = useCallback(
|
|
160
|
+
(text?: string) => {
|
|
161
|
+
const newText = text ?? '';
|
|
144
162
|
if (onChangeInput) {
|
|
145
|
-
onChangeInput(
|
|
146
|
-
|
|
163
|
+
onChangeInput(newText);
|
|
164
|
+
} else {
|
|
165
|
+
setInternalInput(newText);
|
|
147
166
|
}
|
|
148
|
-
setInternalInput(text);
|
|
149
167
|
},
|
|
150
168
|
[onChangeInput]
|
|
151
169
|
);
|
|
152
170
|
|
|
153
|
-
const currentInput = inputValue ?? internalInput;
|
|
154
|
-
|
|
155
171
|
const handleSend = useCallback(
|
|
156
|
-
async (urlMetadata?:
|
|
157
|
-
|
|
158
|
-
|
|
172
|
+
async (urlMetadata?: any) => {
|
|
173
|
+
// Support captured text passed from attachment handler
|
|
174
|
+
const capturedText = (urlMetadata as any)?._capturedText;
|
|
175
|
+
const cleanMetadata = capturedText
|
|
176
|
+
? (({ _capturedText, ...rest }) => rest)(urlMetadata)
|
|
177
|
+
: (urlMetadata as IUrlMetadata);
|
|
178
|
+
|
|
179
|
+
const text = (capturedText || currentInput).trim();
|
|
180
|
+
|
|
181
|
+
// Validate: must have text OR preview metadata (text is optional if preview exists)
|
|
182
|
+
// If metadata exists, trust it (useLinkPreview is responsible for validity)
|
|
183
|
+
if (!text && !cleanMetadata) {
|
|
184
|
+
if (__DEV__)
|
|
185
|
+
console.warn('[ChatDetail] No text or preview link to send');
|
|
159
186
|
return;
|
|
160
187
|
}
|
|
161
188
|
|
|
189
|
+
// Log if metadata seems incomplete
|
|
190
|
+
if (cleanMetadata && !cleanMetadata.url) {
|
|
191
|
+
if (__DEV__)
|
|
192
|
+
console.warn(
|
|
193
|
+
'[ChatDetail] Preview metadata missing URL - check useLinkPreview'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
162
197
|
try {
|
|
163
198
|
await sendMessage({
|
|
164
199
|
files: [],
|
|
165
200
|
plainText: text,
|
|
166
|
-
urlMetadata,
|
|
201
|
+
urlMetadata: cleanMetadata || undefined,
|
|
167
202
|
});
|
|
168
203
|
|
|
204
|
+
// Clear input after successful send
|
|
169
205
|
if (onChangeInput) {
|
|
170
206
|
onChangeInput('');
|
|
171
207
|
} else {
|
|
172
208
|
setInternalInput('');
|
|
173
209
|
}
|
|
174
210
|
} catch (error) {
|
|
175
|
-
|
|
211
|
+
if (__DEV__)
|
|
212
|
+
console.error('[ChatDetail] Failed to send message:', {
|
|
213
|
+
error,
|
|
214
|
+
text: text.substring(0, 50),
|
|
215
|
+
hasPreview: !!cleanMetadata,
|
|
216
|
+
});
|
|
176
217
|
}
|
|
177
218
|
},
|
|
178
219
|
[currentInput, onChangeInput, sendMessage]
|
|
@@ -190,11 +231,17 @@ const ChatDetail = memo(
|
|
|
190
231
|
peerType={resolvedPeerType}
|
|
191
232
|
applicationType={resolvedApplicationType}
|
|
192
233
|
showAddMember={resolvedShowAddMember}
|
|
193
|
-
onBack={onBack}
|
|
194
|
-
onPressSearch={
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
234
|
+
onBack={onBack ?? handleBackDefault}
|
|
235
|
+
onPressSearch={
|
|
236
|
+
onPressSearch ?? (() => console.log('[onPressSearch]'))
|
|
237
|
+
}
|
|
238
|
+
onPressAddMember={
|
|
239
|
+
onPressAddMember ?? (() => console.log('[onPressAddMember]'))
|
|
240
|
+
}
|
|
241
|
+
onPressMenu={onPressMenu ?? (() => console.log('[onPressMenu]'))}
|
|
242
|
+
onPressAvatar={
|
|
243
|
+
onPressAvatar ?? (() => console.log('[onPressAvatar]'))
|
|
244
|
+
}
|
|
198
245
|
/>
|
|
199
246
|
|
|
200
247
|
<KeyboardAvoidingView
|
|
@@ -205,46 +252,52 @@ const ChatDetail = memo(
|
|
|
205
252
|
default: 0,
|
|
206
253
|
})}
|
|
207
254
|
>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
messages={messages}
|
|
221
|
-
currentUserId={currentUserId}
|
|
222
|
-
renderChat={renderChat}
|
|
223
|
-
onLoadEarlier={onLoadEarlier}
|
|
224
|
-
isLoading={isLoading}
|
|
225
|
-
isLoadingEarlier={isLoadingEarlier}
|
|
226
|
-
hasMoreEarlier={hasMoreEarlier}
|
|
227
|
-
/>
|
|
228
|
-
)}
|
|
255
|
+
<ChatListLegend
|
|
256
|
+
messages={messages}
|
|
257
|
+
currentUserId={currentUserId}
|
|
258
|
+
renderChat={renderChat}
|
|
259
|
+
onLoadEarlier={onLoadEarlier}
|
|
260
|
+
isLoading={isLoading}
|
|
261
|
+
isLoadingEarlier={isLoadingEarlier}
|
|
262
|
+
hasMoreEarlier={hasMoreEarlier}
|
|
263
|
+
onMediaPress={(items, index) => {
|
|
264
|
+
mediaViewerRef.current?.show(items, index);
|
|
265
|
+
}}
|
|
266
|
+
/>
|
|
229
267
|
|
|
230
268
|
<ChatComposer
|
|
231
269
|
value={currentInput}
|
|
232
270
|
placeholder={inputPlaceholder}
|
|
233
|
-
onChangeText={
|
|
271
|
+
onChangeText={handleChangeText}
|
|
234
272
|
onSend={handleSend}
|
|
235
|
-
|
|
236
|
-
|
|
273
|
+
onMessageSent={handleAttachmentMessageSent}
|
|
274
|
+
onPressAttach={
|
|
275
|
+
onPressAttach ?? (() => console.log('[onPressAttach]'))
|
|
276
|
+
}
|
|
277
|
+
onPressEmoji={onPressEmoji ?? (() => console.log('[onPressEmoji]'))}
|
|
237
278
|
showQuickActions={showQuickActions}
|
|
238
|
-
quickActions={
|
|
239
|
-
attachmentActions={
|
|
240
|
-
onQuickActionPress={
|
|
241
|
-
|
|
279
|
+
quickActions={quickActions ?? quickActionsDefault}
|
|
280
|
+
attachmentActions={attachmentActions ?? attachmentActionsDefault}
|
|
281
|
+
onQuickActionPress={
|
|
282
|
+
onQuickActionPress ??
|
|
283
|
+
((action: DChatQuickAction) => {
|
|
284
|
+
console.log('[onQuickActionPress]', action.id, action.meta);
|
|
285
|
+
})
|
|
286
|
+
}
|
|
287
|
+
onAttachmentAction={
|
|
288
|
+
onAttachmentAction ??
|
|
289
|
+
((action: DChatAttachmentAction) => {
|
|
290
|
+
console.log('[onAttachmentAction]', action.id, action.meta);
|
|
291
|
+
})
|
|
292
|
+
}
|
|
242
293
|
renderQuickAction={renderQuickAction}
|
|
243
294
|
renderQuickActions={renderQuickActions}
|
|
244
295
|
renderAttachmentAction={renderAttachmentAction}
|
|
245
296
|
attachmentColumns={attachmentColumns}
|
|
246
297
|
/>
|
|
247
298
|
</KeyboardAvoidingView>
|
|
299
|
+
|
|
300
|
+
<MediaViewerModal ref={mediaViewerRef} />
|
|
248
301
|
</KContainer.Page>
|
|
249
302
|
);
|
|
250
303
|
}
|
|
@@ -26,17 +26,8 @@ export const ChatListLegend = memo(
|
|
|
26
26
|
onLoadNewer,
|
|
27
27
|
isLoadingNewer,
|
|
28
28
|
hasMoreNewer,
|
|
29
|
+
onMediaPress,
|
|
29
30
|
}: ChatListProps) => {
|
|
30
|
-
if (__DEV__) {
|
|
31
|
-
console.log('[LegendList] Props:', {
|
|
32
|
-
hasMoreEarlier,
|
|
33
|
-
isLoadingEarlier,
|
|
34
|
-
hasMoreNewer,
|
|
35
|
-
isLoadingNewer,
|
|
36
|
-
messagesCount: messages.length,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
31
|
// Precompute all message data in single pass (O(n))
|
|
41
32
|
const messageDataMap = useMemo(
|
|
42
33
|
() => precomputeLegendListData(messages),
|
|
@@ -118,6 +109,7 @@ export const ChatListLegend = memo(
|
|
|
118
109
|
message={message}
|
|
119
110
|
isOutgoing={isOutgoing}
|
|
120
111
|
createdAtTime={createdAt}
|
|
112
|
+
onMediaPress={onMediaPress}
|
|
121
113
|
/>
|
|
122
114
|
)}
|
|
123
115
|
</KContainer.View>
|
|
@@ -135,7 +127,13 @@ export const ChatListLegend = memo(
|
|
|
135
127
|
);
|
|
136
128
|
}
|
|
137
129
|
},
|
|
138
|
-
[
|
|
130
|
+
[
|
|
131
|
+
currentUserId,
|
|
132
|
+
renderChat,
|
|
133
|
+
messageDataMap,
|
|
134
|
+
handleItemLayout,
|
|
135
|
+
onMediaPress,
|
|
136
|
+
]
|
|
139
137
|
);
|
|
140
138
|
|
|
141
139
|
const maintainScrollConfig = useMemo(
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { memo } from 'react';
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import { KContainer, KImage, KColors } from '@droppii/libs';
|
|
4
|
+
|
|
5
|
+
export interface ChatInputActionsProps {
|
|
6
|
+
onSend: () => void;
|
|
7
|
+
onAttachmentToggle: () => void;
|
|
8
|
+
hasAttachmentActions: boolean;
|
|
9
|
+
isAttachmentOpen: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const ChatInputActions = memo(
|
|
13
|
+
({
|
|
14
|
+
onSend,
|
|
15
|
+
onAttachmentToggle,
|
|
16
|
+
hasAttachmentActions,
|
|
17
|
+
isAttachmentOpen,
|
|
18
|
+
}: ChatInputActionsProps) => {
|
|
19
|
+
return (
|
|
20
|
+
<>
|
|
21
|
+
{hasAttachmentActions && (
|
|
22
|
+
<KContainer.Touchable
|
|
23
|
+
onPress={onAttachmentToggle}
|
|
24
|
+
center
|
|
25
|
+
br="round"
|
|
26
|
+
style={styles.attachmentButton}
|
|
27
|
+
>
|
|
28
|
+
<KImage.VectorIcons
|
|
29
|
+
name={isAttachmentOpen ? 'close-circle-o' : 'plus-circle-o'}
|
|
30
|
+
size={24}
|
|
31
|
+
color={
|
|
32
|
+
isAttachmentOpen
|
|
33
|
+
? KColors.palette.primary.w400
|
|
34
|
+
: KColors.palette.gray.w600
|
|
35
|
+
}
|
|
36
|
+
/>
|
|
37
|
+
</KContainer.Touchable>
|
|
38
|
+
)}
|
|
39
|
+
|
|
40
|
+
<KContainer.Touchable
|
|
41
|
+
onPress={onSend}
|
|
42
|
+
width={40}
|
|
43
|
+
height={40}
|
|
44
|
+
center
|
|
45
|
+
br="round"
|
|
46
|
+
background={KColors.palette.primary.w400}
|
|
47
|
+
marginL="0.75rem"
|
|
48
|
+
style={styles.sendButton}
|
|
49
|
+
>
|
|
50
|
+
<KImage.VectorIcons
|
|
51
|
+
name="send"
|
|
52
|
+
provider="MaterialCommunityIcons"
|
|
53
|
+
size={20}
|
|
54
|
+
color={KColors.white}
|
|
55
|
+
/>
|
|
56
|
+
</KContainer.Touchable>
|
|
57
|
+
</>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
ChatInputActions.displayName = 'ChatInputActions';
|
|
63
|
+
|
|
64
|
+
const styles = StyleSheet.create({
|
|
65
|
+
attachmentButton: {
|
|
66
|
+
// Touchable styling handled by KContainer
|
|
67
|
+
},
|
|
68
|
+
sendButton: {
|
|
69
|
+
// Touchable styling handled by KContainer
|
|
70
|
+
},
|
|
71
|
+
});
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { memo, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleSheet,
|
|
5
|
+
TextInput,
|
|
6
|
+
type NativeSyntheticEvent,
|
|
7
|
+
type TextInputContentSizeChangeEventData,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import { KContainer, KImage, KColors, KSpacingValue } from '@droppii/libs';
|
|
10
|
+
|
|
11
|
+
const INPUT_FONT_SIZE = 16;
|
|
12
|
+
const INPUT_LINE_HEIGHT = 22.4;
|
|
13
|
+
const INPUT_MAX_HEIGHT = INPUT_LINE_HEIGHT * 5;
|
|
14
|
+
const IS_IOS = Platform.OS === 'ios';
|
|
15
|
+
|
|
16
|
+
export interface ChatMessageInputProps {
|
|
17
|
+
value?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
onChangeText: (text?: string) => void;
|
|
20
|
+
onFocus: () => void;
|
|
21
|
+
onBlur: () => void;
|
|
22
|
+
onContentSizeChange: (
|
|
23
|
+
event: NativeSyntheticEvent<TextInputContentSizeChangeEventData>
|
|
24
|
+
) => void;
|
|
25
|
+
isInputFocused: boolean;
|
|
26
|
+
isMultilineInput: boolean;
|
|
27
|
+
onEmojiPress?: () => void;
|
|
28
|
+
inputRef: React.RefObject<TextInput>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const ChatMessageInput = memo(
|
|
32
|
+
({
|
|
33
|
+
value,
|
|
34
|
+
placeholder = 'Nhập tin nhắn...',
|
|
35
|
+
onChangeText,
|
|
36
|
+
onFocus,
|
|
37
|
+
onBlur,
|
|
38
|
+
onContentSizeChange,
|
|
39
|
+
isInputFocused,
|
|
40
|
+
isMultilineInput,
|
|
41
|
+
onEmojiPress,
|
|
42
|
+
inputRef,
|
|
43
|
+
}: ChatMessageInputProps) => {
|
|
44
|
+
const renderEmojiNode = useCallback(
|
|
45
|
+
() => (
|
|
46
|
+
<KContainer.Touchable marginR="0.5rem" onPress={onEmojiPress}>
|
|
47
|
+
<KImage.VectorIcons
|
|
48
|
+
name="sticker-o"
|
|
49
|
+
size={24}
|
|
50
|
+
color={KColors.gray.normal}
|
|
51
|
+
/>
|
|
52
|
+
</KContainer.Touchable>
|
|
53
|
+
),
|
|
54
|
+
[onEmojiPress]
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<KContainer.View flex marginL="0.75rem" style={styles.inputWrapper}>
|
|
59
|
+
<KContainer.View
|
|
60
|
+
row
|
|
61
|
+
alignItems={isMultilineInput ? 'flex-end' : 'center'}
|
|
62
|
+
brW={1}
|
|
63
|
+
brC={
|
|
64
|
+
isInputFocused
|
|
65
|
+
? KColors.palette.primary.w400
|
|
66
|
+
: KColors.palette.gray.w100
|
|
67
|
+
}
|
|
68
|
+
background={KColors.white}
|
|
69
|
+
paddingL="0.75rem"
|
|
70
|
+
style={styles.inputContainer}
|
|
71
|
+
>
|
|
72
|
+
<KContainer.View marginR="0.75rem">
|
|
73
|
+
<KImage.VectorIcons
|
|
74
|
+
name="chat-suggest-o"
|
|
75
|
+
size={24}
|
|
76
|
+
color={KColors.gray.normal}
|
|
77
|
+
/>
|
|
78
|
+
</KContainer.View>
|
|
79
|
+
|
|
80
|
+
<TextInput
|
|
81
|
+
ref={inputRef}
|
|
82
|
+
placeholder={placeholder}
|
|
83
|
+
placeholderTextColor={KColors.palette.gray.w200}
|
|
84
|
+
value={value}
|
|
85
|
+
onChangeText={onChangeText}
|
|
86
|
+
onFocus={onFocus}
|
|
87
|
+
onBlur={onBlur}
|
|
88
|
+
onContentSizeChange={onContentSizeChange}
|
|
89
|
+
multiline
|
|
90
|
+
blurOnSubmit={false}
|
|
91
|
+
scrollEnabled
|
|
92
|
+
allowFontScaling={false}
|
|
93
|
+
underlineColorAndroid={KColors.transparent}
|
|
94
|
+
selectionColor={KColors.selector}
|
|
95
|
+
textAlignVertical={isMultilineInput ? 'top' : 'center'}
|
|
96
|
+
style={[styles.textInput]}
|
|
97
|
+
/>
|
|
98
|
+
|
|
99
|
+
{renderEmojiNode()}
|
|
100
|
+
</KContainer.View>
|
|
101
|
+
</KContainer.View>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
ChatMessageInput.displayName = 'ChatMessageInput';
|
|
107
|
+
|
|
108
|
+
const styles = StyleSheet.create({
|
|
109
|
+
inputWrapper: {
|
|
110
|
+
overflow: 'hidden',
|
|
111
|
+
},
|
|
112
|
+
inputContainer: {
|
|
113
|
+
borderRadius: KSpacingValue['1.25rem'],
|
|
114
|
+
minHeight: 48,
|
|
115
|
+
paddingVertical: KSpacingValue['0.25rem'],
|
|
116
|
+
},
|
|
117
|
+
textInput: {
|
|
118
|
+
flex: 1,
|
|
119
|
+
maxHeight: INPUT_MAX_HEIGHT,
|
|
120
|
+
fontSize: INPUT_FONT_SIZE,
|
|
121
|
+
lineHeight: INPUT_LINE_HEIGHT,
|
|
122
|
+
color: KColors.palette.gray.w900,
|
|
123
|
+
paddingVertical: IS_IOS ? 0 : 4,
|
|
124
|
+
paddingHorizontal: IS_IOS ? 2 : 0,
|
|
125
|
+
includeFontPadding: false,
|
|
126
|
+
},
|
|
127
|
+
});
|