@cometchat/chat-uikit-react-native 5.5.0 → 5.5.2
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/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/build.gradle +23 -89
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +5 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +52 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +37 -4
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +9 -1
- package/ios/FileManager.m +77 -3
- package/ios/RichTextEditorView.swift +52 -1
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/RichTextEditorViewManager.swift +8 -0
- package/package.json +8 -5
- package/react-native-cometchat-ui-kit.podspec +5 -19
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +69 -36
- package/src/CometChatConversations/CometChatConversations.tsx +12 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +2 -2
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +50 -31
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +10 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +24 -19
- package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +7 -8
- package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +43 -19
- package/src/CometChatRichTextEditor/index.tsx +6 -1
- package/src/CometChatRichTextEditor/types.ts +2 -0
- package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +251 -14
- package/src/CometChatSearch/CometChatSearch.tsx +39 -11
- package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +56 -17
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +12 -9
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +13 -10
- package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +34 -27
- package/src/extensions/Polls/Polls.tsx +7 -7
- package/src/extensions/Polls/PollsBubble.tsx +2 -2
- package/src/globals.d.ts +6 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +2 -1
- package/src/shared/constants/UIKitConstants.ts +3 -17
- package/src/shared/constants/textPatterns.ts +45 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +25 -259
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +22 -11
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +56 -32
- package/src/shared/formatters/CometChatTextFormatter.ts +22 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -0
- package/src/shared/formatters/applyRawFormatters.ts +31 -0
- package/src/shared/formatters/codeElements.ts +21 -0
- package/src/shared/framework/MessageDataSource.tsx +14 -8
- package/src/shared/helper/types/index.ts +5 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +4 -4
- package/src/shared/libs/ImageZoom/types/index.ts +2 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +15 -30
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +138 -19
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +0 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +54 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +54 -1
- package/src/shared/resources/CometChatSoundManager/sound.js +2 -3
- package/src/shared/services/UploadQueueService.ts +7 -0
- package/src/shared/utils/CometChatMessageHelper/index.ts +3 -0
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +11 -0
- package/src/shared/utils/MarkdownUtils.ts +42 -5
- package/src/shared/utils/MessageUtils.tsx +7 -5
- package/src/shared/utils/PinnedMessagesHelper.ts +65 -0
- package/src/shared/utils/SavedMessagesHelper.ts +42 -6
- package/src/shared/utils/__testUtils__/messagesRequestBuilderMock.ts +37 -0
- package/src/shared/utils/cloneRequestBuilder.ts +25 -0
- package/src/shared/utils/groupMemberAddedRows.ts +28 -0
- package/src/shared/utils/linkPreviewSelection.ts +109 -0
- package/src/shared/utils/mentionTokens.ts +77 -0
- package/src/shared/utils/runAfterInteractions.ts +26 -0
- package/src/shared/utils/stripRichText.ts +2 -1
- package/src/shared/utils/tapGesture.ts +23 -0
- package/src/shared/utils/videoThumbnail.ts +74 -0
- package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +15 -4
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +21 -13
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +13 -15
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +5 -0
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -1
- package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +8 -1
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +1 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +2 -1
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +7 -1
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +8 -26
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +4 -2
- package/src/shared/views/CometChatList/Header.tsx +9 -3
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +2 -1
- package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +28 -8
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -4
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +36 -4
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +2 -1
- package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +62 -30
- package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +5 -0
- package/src/CometChatMessageList/MANUAL_TEST_CASES.md +0 -154
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
let __listenerIdCounter = 0;
|
|
2
2
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
3
3
|
import { ClipboardPasteHandler } from "../shared/views/ClipboardPasteHandler/ClipboardPasteHandler";
|
|
4
|
+
import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
|
|
4
5
|
import React, {
|
|
5
6
|
forwardRef,
|
|
6
7
|
JSX,
|
|
@@ -69,7 +70,10 @@ import { ChatConfigurator } from "../shared/framework/ChatConfigurator";
|
|
|
69
70
|
import { deepClone, deepMerge } from "../shared/helper/helperFunctions";
|
|
70
71
|
import { Icon, IconName } from "../shared/icons/Icon";
|
|
71
72
|
import { CometChatMessageTemplate } from "../shared/modals/CometChatMessageTemplate";
|
|
72
|
-
import {
|
|
73
|
+
import { messageStatus } from "../shared/utils/CometChatMessageHelper";
|
|
74
|
+
import { groupMemberAddedRows } from "../shared/utils/groupMemberAddedRows";
|
|
75
|
+
import { selectLinkPreview } from "../shared/utils/linkPreviewSelection";
|
|
76
|
+
import { unescapeTypedMentionTokens } from "../shared/utils/mentionTokens";
|
|
73
77
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
74
78
|
import { CometChatBatchMediaContext, BatchMediaResult } from "../shared/utils/batchMediaContext";
|
|
75
79
|
import { CometChatUIKit } from "../shared/CometChatUiKit/CometChatUIKit";
|
|
@@ -964,9 +968,9 @@ export const CometChatMessageList = memo(
|
|
|
964
968
|
});
|
|
965
969
|
|
|
966
970
|
const fileIncoming = deepMerge(incomingBubbleStyles, incomingBubbleStyles.fileBubbleStyles ?? {});
|
|
967
|
-
if (fileIncoming.containerStyle) fileIncoming.containerStyle
|
|
971
|
+
if (fileIncoming.containerStyle) Object.assign(fileIncoming.containerStyle, { height: undefined });
|
|
968
972
|
const fileOutgoing = deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.fileBubbleStyles ?? {});
|
|
969
|
-
if (fileOutgoing.containerStyle) fileOutgoing.containerStyle
|
|
973
|
+
if (fileOutgoing.containerStyle) Object.assign(fileOutgoing.containerStyle, { height: undefined });
|
|
970
974
|
|
|
971
975
|
styleCache.set(MessageTypeConstants.file, {
|
|
972
976
|
incoming: fileIncoming,
|
|
@@ -974,9 +978,9 @@ export const CometChatMessageList = memo(
|
|
|
974
978
|
});
|
|
975
979
|
|
|
976
980
|
const audioIncoming = deepMerge(incomingBubbleStyles, incomingBubbleStyles.audioBubbleStyles ?? {});
|
|
977
|
-
if (audioIncoming.containerStyle) audioIncoming.containerStyle
|
|
981
|
+
if (audioIncoming.containerStyle) Object.assign(audioIncoming.containerStyle, { height: undefined });
|
|
978
982
|
const audioOutgoing = deepMerge(outgoingBubbleStyles, outgoingBubbleStyles.audioBubbleStyles ?? {});
|
|
979
|
-
if (audioOutgoing.containerStyle) audioOutgoing.containerStyle
|
|
983
|
+
if (audioOutgoing.containerStyle) Object.assign(audioOutgoing.containerStyle, { height: undefined });
|
|
980
984
|
|
|
981
985
|
styleCache.set(MessageTypeConstants.audio, {
|
|
982
986
|
incoming: audioIncoming,
|
|
@@ -3580,15 +3584,10 @@ export const CometChatMessageList = memo(
|
|
|
3580
3584
|
message["action"] = "banned";
|
|
3581
3585
|
newMessage(message, false);
|
|
3582
3586
|
},
|
|
3583
|
-
ccGroupMemberAdded: (
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
message["sentAt"] = getUnixTimestamp();
|
|
3588
|
-
message["actionOn"] = user;
|
|
3589
|
-
message["action"] = "added";
|
|
3590
|
-
newMessage(message, false);
|
|
3591
|
-
});
|
|
3587
|
+
ccGroupMemberAdded: (event: any) => {
|
|
3588
|
+
groupMemberAddedRows(event, loggedInUser.current?.getName()).forEach((row) =>
|
|
3589
|
+
newMessage(row, false)
|
|
3590
|
+
);
|
|
3592
3591
|
},
|
|
3593
3592
|
ccGroupMemberKicked: ({ message }: any) => {
|
|
3594
3593
|
message["action"] = "kicked";
|
|
@@ -3845,7 +3844,8 @@ export const CometChatMessageList = memo(
|
|
|
3845
3844
|
}
|
|
3846
3845
|
if (item.getType() === MessageTypeConstants.text) {
|
|
3847
3846
|
let linkData = getExtensionData(item, ExtensionConstants.linkPreview);
|
|
3848
|
-
|
|
3847
|
+
// Same choice as the bubble: no card (e.g. every address is in code) → text style.
|
|
3848
|
+
if (selectLinkPreview(linkData?.links, (item as CometChat.TextMessage).getText())) {
|
|
3849
3849
|
return ExtensionConstants.linkPreview;
|
|
3850
3850
|
}
|
|
3851
3851
|
}
|
|
@@ -4492,7 +4492,7 @@ export const CometChatMessageList = memo(
|
|
|
4492
4492
|
// getPlainString resolves mention tokens but leaves the rich-text wire format alone.
|
|
4493
4493
|
// copyMessageText puts clean plain text on the clipboard for every other app and keeps
|
|
4494
4494
|
// the colour in a private representation our own composer restores on paste.
|
|
4495
|
-
ClipboardPasteHandler.copyMessageText(getPlainString(item["text"], item));
|
|
4495
|
+
ClipboardPasteHandler.copyMessageText(unescapeTypedMentionTokens(getPlainString(item["text"], item)), textFormatters);
|
|
4496
4496
|
// Defer modal dismiss to next frame to avoid Fabric race condition
|
|
4497
4497
|
// where unmounting the Modal while Clipboard is still accessing views
|
|
4498
4498
|
// causes EXC_BAD_ACCESS (SIGSEGV) at null pointer in mount phase.
|
|
@@ -4554,8 +4554,11 @@ export const CometChatMessageList = memo(
|
|
|
4554
4554
|
// Strip markdown/HTML from raw text BEFORE mention replacement,
|
|
4555
4555
|
// because getPlainString can break HTML tags (e.g., </u> becomes /u>)
|
|
4556
4556
|
let rawText = messageObject?.getData()["text"] || "";
|
|
4557
|
-
|
|
4558
|
-
|
|
4557
|
+
// The app's own token becomes UI Kit markup BEFORE stripping, the same order the pinned
|
|
4558
|
+
// panel uses. Without it a consumer's `(#e11d48)text()` reaches the share sheet verbatim.
|
|
4559
|
+
let strippedText = stripMarkdown(applyRawFormatters(rawText, textFormatters));
|
|
4560
|
+
// Tokens become names; typed token text (stored escaped) reads as typed.
|
|
4561
|
+
let textMessage = unescapeTypedMentionTokens(getPlainString(strippedText, messageObject));
|
|
4559
4562
|
let fileUrl = messageObject.getData()["url"];
|
|
4560
4563
|
|
|
4561
4564
|
const getFileName = () => {
|
|
@@ -5816,7 +5819,9 @@ export const CometChatMessageList = memo(
|
|
|
5816
5819
|
onViewableItemsChanged={handleViewableItemsChanged}
|
|
5817
5820
|
// Performance optimizations
|
|
5818
5821
|
windowSize={10}
|
|
5819
|
-
|
|
5822
|
+
// ENG-40210: keep clipping off. On Android it attaches/detaches rows outside Fabric's
|
|
5823
|
+
// mount queue and crashes (addViewAt IndexOutOfBounds), after a push tap and on plain launch.
|
|
5824
|
+
removeClippedSubviews={false}
|
|
5820
5825
|
maxToRenderPerBatch={5}
|
|
5821
5826
|
updateCellsBatchingPeriod={100}
|
|
5822
5827
|
initialNumToRender={15}
|
|
@@ -10,12 +10,6 @@ import { CometChatTheme } from '../../theme/type';
|
|
|
10
10
|
import { CometChatMessageTemplate } from '../../shared/modals/CometChatMessageTemplate';
|
|
11
11
|
import { getModerationStatus } from '../../shared/utils/MessageUtils';
|
|
12
12
|
|
|
13
|
-
const WINDOW_HEIGHT = Dimensions.get('window').height;
|
|
14
|
-
const SHEET_MAX_HEIGHT_RATIO = 0.52;
|
|
15
|
-
// Quick reactions row height (~56) + sheet paddingTop (25) + safety margin
|
|
16
|
-
const RESERVED_HEIGHT = 100;
|
|
17
|
-
const ACTION_SHEET_MAX_HEIGHT = WINDOW_HEIGHT * SHEET_MAX_HEIGHT_RATIO - RESERVED_HEIGHT;
|
|
18
|
-
|
|
19
13
|
interface MessageOptionsSheetProps {
|
|
20
14
|
bottomSheetRef: React.RefObject<any>;
|
|
21
15
|
isOpen: boolean;
|
|
@@ -112,7 +106,9 @@ export const MessageOptionsSheet: React.FC<MessageOptionsSheetProps> = ({
|
|
|
112
106
|
style={mergedTheme?.messageListStyles?.messageInformationStyles}
|
|
113
107
|
/>
|
|
114
108
|
) : (
|
|
115
|
-
|
|
109
|
+
// flexShrink rather than flex: 1 — in React Native flex: 1 never shrinks below its
|
|
110
|
+
// content, so the column would keep its full height and the list could never scroll.
|
|
111
|
+
<View style={{ flexShrink: 1 }}>
|
|
116
112
|
{/* Show quick reactions for disapproved messages */}
|
|
117
113
|
{!hideReactionOption && getModerationStatus(selectedMessage) !== 'disapproved' && (
|
|
118
114
|
<CometChatQuickReactions
|
|
@@ -141,7 +137,10 @@ export const MessageOptionsSheet: React.FC<MessageOptionsSheetProps> = ({
|
|
|
141
137
|
theme={mergedTheme}
|
|
142
138
|
/>
|
|
143
139
|
|
|
144
|
-
|
|
140
|
+
{/* The list takes whatever height the sheet has left after the rows above it, and
|
|
141
|
+
scrolls within that. A fixed cap has to guess the height of those rows, and a guess
|
|
142
|
+
that misses pushes the last options below the screen where they can't be reached. */}
|
|
143
|
+
<View style={{ flexShrink: 1 }}>
|
|
145
144
|
<CometChatActionSheet
|
|
146
145
|
actions={quickActions.list}
|
|
147
146
|
style={mergedTheme.messageListStyles.messageOptionsStyles}
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* @module CometChatPinnedMessages
|
|
21
21
|
*/
|
|
22
22
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
23
|
-
import
|
|
23
|
+
import { ClipboardPasteHandler } from "../shared/views/ClipboardPasteHandler/ClipboardPasteHandler";
|
|
24
|
+
import { stripRichText } from "../shared/utils/stripRichText";
|
|
24
25
|
import React, { JSX, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
25
26
|
import { FlatList, NativeModules, Pressable, Text, View } from "react-native";
|
|
26
27
|
import { ChatConfigurator } from "../shared";
|
|
@@ -56,6 +57,9 @@ import {
|
|
|
56
57
|
} from "../shared/utils/PinSaveHelper";
|
|
57
58
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
58
59
|
import { MessageEvents } from "../shared/events/messages";
|
|
60
|
+
import { CometChatTextFormatter } from "../shared/formatters/CometChatTextFormatter";
|
|
61
|
+
import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
|
|
62
|
+
import { buildPinnedMessagesRequest } from "../shared/utils/PinnedMessagesHelper";
|
|
59
63
|
|
|
60
64
|
/**
|
|
61
65
|
* The options this panel is willing to show, as an ALLOW-LIST.
|
|
@@ -106,6 +110,19 @@ export interface CometChatPinnedMessagesInterface {
|
|
|
106
110
|
group?: CometChat.Group;
|
|
107
111
|
/** Page size. Defaults to 30; the server caps a conversation at 100. */
|
|
108
112
|
limit?: number;
|
|
113
|
+
/**
|
|
114
|
+
* Your own request builder, for anything `limit` alone cannot express — a search
|
|
115
|
+
* term, a category or type filter, a different page size.
|
|
116
|
+
*
|
|
117
|
+
* `setPinnedOnly(true)` and the `user`/`group` conversation scope are re-asserted
|
|
118
|
+
* on whatever you pass, so a builder that forgets them still returns this
|
|
119
|
+
* conversation's pinned messages rather than ordinary history. Set them anyway to
|
|
120
|
+
* keep the intent readable.
|
|
121
|
+
*
|
|
122
|
+
* The `limit` prop wins: `limit={10}` with a builder that calls `setLimit(50)` pages
|
|
123
|
+
* in tens. Without the prop the builder's own limit is used, and with neither, 30.
|
|
124
|
+
*/
|
|
125
|
+
messagesRequestBuilder?: CometChat.MessagesRequestBuilder;
|
|
109
126
|
/** Closes the panel — rendered as the ✕ in the header. */
|
|
110
127
|
onBack?: () => void;
|
|
111
128
|
/** Tapping a row — the host jumps its message list to this message. */
|
|
@@ -127,6 +144,12 @@ export interface CometChatPinnedMessagesInterface {
|
|
|
127
144
|
/** Hide Unsave in the long-press sheet (§6.7). */
|
|
128
145
|
hideUnsaveMessageOption?: boolean;
|
|
129
146
|
ItemView?: (message: CometChat.BaseMessage) => JSX.Element;
|
|
147
|
+
/**
|
|
148
|
+
* Text formatters, same array the host passes to CometChatMessageList. The panel renders real
|
|
149
|
+
* bubbles, so without this a consumer's own token reaches the template unrecognised and the
|
|
150
|
+
* pinned copy of a message reads differently from the same message in the list.
|
|
151
|
+
*/
|
|
152
|
+
textFormatters?: Array<CometChatTextFormatter>;
|
|
130
153
|
title?: string;
|
|
131
154
|
/** Per-instance style overrides, merged over the theme's pinnedMessagesStyles. */
|
|
132
155
|
style?: DeepPartial<PinnedMessagesStyle>;
|
|
@@ -139,6 +162,7 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
139
162
|
user,
|
|
140
163
|
group,
|
|
141
164
|
limit,
|
|
165
|
+
messagesRequestBuilder,
|
|
142
166
|
onBack,
|
|
143
167
|
onItemPress,
|
|
144
168
|
hideUnpinMessageOption = false,
|
|
@@ -148,6 +172,7 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
148
172
|
hideShareMessageOption = false,
|
|
149
173
|
hideMessageInfoOption = false,
|
|
150
174
|
ItemView,
|
|
175
|
+
textFormatters,
|
|
151
176
|
title,
|
|
152
177
|
style,
|
|
153
178
|
} = props;
|
|
@@ -223,17 +248,10 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
223
248
|
* A factory rather than an inline build: a request is single-use, so retrying after
|
|
224
249
|
* an error needs a fresh one.
|
|
225
250
|
*/
|
|
226
|
-
const buildRequest = useCallback(
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// SDK's own DEFAULT_VALUES.MSGS_LIMIT.
|
|
231
|
-
builder.setLimit(limit ?? 30);
|
|
232
|
-
// Exactly one of these; the SDK rejects neither-set.
|
|
233
|
-
if (group) builder.setGUID(group.getGuid());
|
|
234
|
-
else if (user) builder.setUID(user.getUid());
|
|
235
|
-
return builder.build();
|
|
236
|
-
}, [limit, group, user]);
|
|
251
|
+
const buildRequest = useCallback(
|
|
252
|
+
() => buildPinnedMessagesRequest({ user, group, limit, messagesRequestBuilder }),
|
|
253
|
+
[limit, group, user, messagesRequestBuilder]
|
|
254
|
+
);
|
|
237
255
|
|
|
238
256
|
if (request.current === null) request.current = buildRequest();
|
|
239
257
|
|
|
@@ -483,8 +501,8 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
483
501
|
}, [group, user]);
|
|
484
502
|
|
|
485
503
|
const templates: CometChatMessageTemplate[] = useMemo(
|
|
486
|
-
() => ChatConfigurator.dataSource.getAllMessageTemplates(theme),
|
|
487
|
-
[theme]
|
|
504
|
+
() => ChatConfigurator.dataSource.getAllMessageTemplates(theme, { textFormatters }),
|
|
505
|
+
[theme, textFormatters]
|
|
488
506
|
);
|
|
489
507
|
|
|
490
508
|
const templatesMap = useMemo(() => {
|
|
@@ -583,10 +601,15 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
583
601
|
};
|
|
584
602
|
|
|
585
603
|
const onCopy = (message: CometChat.BaseMessage) => {
|
|
586
|
-
//
|
|
587
|
-
//
|
|
588
|
-
//
|
|
589
|
-
|
|
604
|
+
// Via the shared handler, NOT Clipboard directly: it strips the rich-text wire
|
|
605
|
+
// format for the plain clipboard while keeping the rich version for a paste back
|
|
606
|
+
// into our own composer. Copying raw put `<color=#e11d48>` into Notes and mail.
|
|
607
|
+
//
|
|
608
|
+
// ponytail: still the raw text rather than the mention-resolved string the message
|
|
609
|
+
// list copies via its local getPlainString (not exported). Copying "@uid" instead
|
|
610
|
+
// of "@Name" is the known ceiling; lift it by extracting that helper into
|
|
611
|
+
// shared/utils.
|
|
612
|
+
ClipboardPasteHandler.copyMessageText(textOf(message), textFormatters);
|
|
590
613
|
// Deferred like the message list does: unmounting the Modal while Clipboard is
|
|
591
614
|
// still touching views crashes Fabric on iOS.
|
|
592
615
|
requestAnimationFrame(closeSheet);
|
|
@@ -597,7 +620,8 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
|
|
|
597
620
|
message instanceof CometChat.MediaMessage ? message.getAttachment() : undefined;
|
|
598
621
|
const fileUrl = attachment?.getUrl() ?? "";
|
|
599
622
|
const shareObj = {
|
|
600
|
-
|
|
623
|
+
// Plain text: the share target is another app, which cannot read our wire format.
|
|
624
|
+
message: stripRichText(applyRawFormatters(textOf(message), textFormatters)),
|
|
601
625
|
type: message.getType(),
|
|
602
626
|
mediaName: attachment?.getName() ?? "",
|
|
603
627
|
fileUrl,
|
|
@@ -30,6 +30,7 @@ const COMMANDS = {
|
|
|
30
30
|
setChecklist: 'setChecklist',
|
|
31
31
|
setParagraph: 'setParagraph',
|
|
32
32
|
insertLink: 'insertLink',
|
|
33
|
+
replaceSelection: 'replaceSelection',
|
|
33
34
|
undo: 'undo',
|
|
34
35
|
redo: 'redo',
|
|
35
36
|
clearFormatting: 'clearFormatting',
|
|
@@ -57,7 +58,8 @@ const dispatchCommand = (
|
|
|
57
58
|
) => {
|
|
58
59
|
const viewTag = findNodeHandle(ref.current);
|
|
59
60
|
if (viewTag != null) {
|
|
60
|
-
|
|
61
|
+
// Newer RN typings declare commandID as number only; the native side accepts command names.
|
|
62
|
+
UIManager.dispatchViewManagerCommand(viewTag, command as unknown as number, args);
|
|
61
63
|
}
|
|
62
64
|
};
|
|
63
65
|
|
|
@@ -213,6 +215,9 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorPropsExtended
|
|
|
213
215
|
insertLink: (url: string, text: string) => {
|
|
214
216
|
dispatchCommand(nativeRef, COMMANDS.insertLink, [url, text]);
|
|
215
217
|
},
|
|
218
|
+
replaceSelection: (text: string) => {
|
|
219
|
+
dispatchCommand(nativeRef, COMMANDS.replaceSelection, [text]);
|
|
220
|
+
},
|
|
216
221
|
undo: () => {
|
|
217
222
|
dispatchCommand(nativeRef, COMMANDS.undo);
|
|
218
223
|
},
|
|
@@ -152,6 +152,8 @@ export interface RichTextEditorRef {
|
|
|
152
152
|
setChecklist: () => void;
|
|
153
153
|
setParagraph: () => void;
|
|
154
154
|
insertLink: (url: string, text: string) => void;
|
|
155
|
+
/** Replaces the selection with plain text, or inserts at the caret when nothing is selected. */
|
|
156
|
+
replaceSelection: (text: string) => void;
|
|
155
157
|
undo: () => void;
|
|
156
158
|
redo: () => void;
|
|
157
159
|
clearFormatting: () => void;
|
|
@@ -17,8 +17,23 @@
|
|
|
17
17
|
* @module CometChatSavedMessages
|
|
18
18
|
*/
|
|
19
19
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
20
|
+
import { CometChatRichTextFormatter } from "../shared/formatters/CometChatRichTextFormatter";
|
|
21
|
+
import { preparePreviewText, stripMarkdown } from "../shared/utils/MarkdownUtils";
|
|
22
|
+
import {
|
|
23
|
+
applyMentionsFormatting,
|
|
24
|
+
getMessagePreviewInternal,
|
|
25
|
+
} from "../shared/utils/MessageUtils";
|
|
26
|
+
import { MessageCategoryConstants } from "../shared/constants/UIKitConstants";
|
|
20
27
|
import React, { JSX, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
FlatList,
|
|
30
|
+
GestureResponderEvent,
|
|
31
|
+
Platform,
|
|
32
|
+
Pressable,
|
|
33
|
+
StyleSheet,
|
|
34
|
+
Text,
|
|
35
|
+
View,
|
|
36
|
+
} from "react-native";
|
|
22
37
|
import { useCompTheme, useTheme } from "../theme/hook";
|
|
23
38
|
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
24
39
|
import { DeepPartial } from "../shared/helper/types";
|
|
@@ -50,10 +65,34 @@ import {
|
|
|
50
65
|
} from "../shared/utils/PinSaveHelper";
|
|
51
66
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
52
67
|
import { MessageEvents } from "../shared/events/messages";
|
|
68
|
+
import { CometChatTextFormatter } from "../shared/formatters/CometChatTextFormatter";
|
|
69
|
+
import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Module-level rich text formatter — reused across renders (no GC churn), mirroring
|
|
73
|
+
* CometChatConversations. A saved row shows the same preview a conversation row does,
|
|
74
|
+
* so it renders inline formatting rather than stripping it.
|
|
75
|
+
*/
|
|
76
|
+
const savedRichTextFormatter = new CometChatRichTextFormatter();
|
|
53
77
|
|
|
54
78
|
export interface CometChatSavedMessagesInterface {
|
|
55
79
|
/** Page size. Defaults to 30; the server caps the whole set at 100. */
|
|
56
80
|
limit?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Your own request builder, for anything `limit` alone cannot express — a search
|
|
83
|
+
* term, a category or type filter, a different page size.
|
|
84
|
+
*
|
|
85
|
+
* `setSavedOnly(true)` is re-asserted on whatever you pass, so a builder that
|
|
86
|
+
* forgets it still returns saved messages rather than ordinary history. Set it
|
|
87
|
+
* anyway to keep the intent readable.
|
|
88
|
+
*
|
|
89
|
+
* Do NOT scope it to a conversation: saved is account-wide, and a uid/guid would
|
|
90
|
+
* turn this cross-conversation list into a per-chat one.
|
|
91
|
+
*
|
|
92
|
+
* The `limit` prop wins: `limit={10}` with a builder that calls `setLimit(50)` pages
|
|
93
|
+
* in tens. Without the prop the builder's own limit is used, and with neither, 30.
|
|
94
|
+
*/
|
|
95
|
+
messagesRequestBuilder?: CometChat.MessagesRequestBuilder;
|
|
57
96
|
/** Closes the surface — rendered as the ✕ in the header. */
|
|
58
97
|
onBack?: () => void;
|
|
59
98
|
/**
|
|
@@ -69,6 +108,12 @@ export interface CometChatSavedMessagesInterface {
|
|
|
69
108
|
hideUnsaveMessageOption?: boolean;
|
|
70
109
|
/** Replace the whole row body. */
|
|
71
110
|
ItemView?: (message: CometChat.BaseMessage) => JSX.Element;
|
|
111
|
+
/**
|
|
112
|
+
* Text formatters, same array the host passes to CometChatMessageList. Without them a consumer's
|
|
113
|
+
* own wire token is not UI Kit markup yet, so the formatter below has nothing to recognise and
|
|
114
|
+
* the row prints the token verbatim.
|
|
115
|
+
*/
|
|
116
|
+
textFormatters?: Array<CometChatTextFormatter>;
|
|
72
117
|
title?: string;
|
|
73
118
|
/** Per-instance style overrides, merged over the theme's savedMessagesStyles. */
|
|
74
119
|
style?: DeepPartial<SavedMessagesStyle>;
|
|
@@ -77,9 +122,34 @@ export interface CometChatSavedMessagesInterface {
|
|
|
77
122
|
type ListState = "loading" | "loaded" | "error" | "empty";
|
|
78
123
|
|
|
79
124
|
export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) => {
|
|
80
|
-
const {
|
|
125
|
+
const {
|
|
126
|
+
limit,
|
|
127
|
+
messagesRequestBuilder,
|
|
128
|
+
onBack,
|
|
129
|
+
onItemPress,
|
|
130
|
+
hideUnsaveMessageOption = false,
|
|
131
|
+
ItemView,
|
|
132
|
+
textFormatters,
|
|
133
|
+
title,
|
|
134
|
+
style,
|
|
135
|
+
} = props;
|
|
81
136
|
|
|
82
137
|
const theme = useTheme() as CometChatTheme;
|
|
138
|
+
|
|
139
|
+
// Same inline-code treatment the conversation list gives its subtitle.
|
|
140
|
+
useMemo(() => {
|
|
141
|
+
savedRichTextFormatter.setStyle({
|
|
142
|
+
inlineCodeStyle: { color: theme.color.primary as string },
|
|
143
|
+
inlineCodeContainerStyle: {
|
|
144
|
+
backgroundColor: "rgba(120, 120, 128, 0.22)",
|
|
145
|
+
borderRadius: 4,
|
|
146
|
+
borderWidth: 0.5,
|
|
147
|
+
borderColor: "rgba(120, 120, 128, 0.35)",
|
|
148
|
+
paddingHorizontal: 4,
|
|
149
|
+
paddingVertical: 1,
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}, [theme]);
|
|
83
153
|
const compTheme = useCompTheme();
|
|
84
154
|
const { t } = useCometChatTranslation();
|
|
85
155
|
|
|
@@ -126,8 +196,11 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
126
196
|
/**
|
|
127
197
|
* The request is single-use and accumulates its own paging state, so it lives in
|
|
128
198
|
* a ref for the lifetime of the screen. Refreshing means building a NEW one.
|
|
199
|
+
*
|
|
200
|
+
* Built lazily below: a useRef ARGUMENT runs on every render and all but the first
|
|
201
|
+
* result is discarded, so the inline form built a request per render.
|
|
129
202
|
*/
|
|
130
|
-
const request = useRef(
|
|
203
|
+
const request = useRef<CometChat.MessagesRequest | null>(null);
|
|
131
204
|
const fetching = useRef(false);
|
|
132
205
|
/**
|
|
133
206
|
* The end of a cursor-paged list is an empty page — there is nothing to ask the request
|
|
@@ -136,8 +209,12 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
136
209
|
*/
|
|
137
210
|
const exhausted = useRef(false);
|
|
138
211
|
|
|
212
|
+
if (request.current === null) {
|
|
213
|
+
request.current = buildSavedMessagesRequest(limit, messagesRequestBuilder);
|
|
214
|
+
}
|
|
215
|
+
|
|
139
216
|
const loadNext = useCallback(async () => {
|
|
140
|
-
if (fetching.current || exhausted.current) return;
|
|
217
|
+
if (fetching.current || exhausted.current || !request.current) return;
|
|
141
218
|
fetching.current = true;
|
|
142
219
|
try {
|
|
143
220
|
// fetchPrevious(), not fetchNext() — "previous" is older, which is the direction
|
|
@@ -194,13 +271,15 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
194
271
|
* a retried request must start from the top of the list, not from a half-walked cursor.
|
|
195
272
|
*/
|
|
196
273
|
const reload = useCallback(() => {
|
|
197
|
-
request.current = buildSavedMessagesRequest(limit);
|
|
274
|
+
request.current = buildSavedMessagesRequest(limit, messagesRequestBuilder);
|
|
198
275
|
exhausted.current = false;
|
|
199
276
|
fetching.current = false;
|
|
200
277
|
setMessages([]);
|
|
201
278
|
setState("loading");
|
|
202
279
|
loadNext();
|
|
203
|
-
|
|
280
|
+
// messagesRequestBuilder included: without it a retry after the prop changes rebuilds
|
|
281
|
+
// the request from the builder captured at mount.
|
|
282
|
+
}, [limit, messagesRequestBuilder, loadNext]);
|
|
204
283
|
|
|
205
284
|
useEffect(() => {
|
|
206
285
|
CometChat.getLoggedinUser()
|
|
@@ -412,7 +491,116 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
412
491
|
);
|
|
413
492
|
const prefix = prefixName ? `${prefixName}: ` : "";
|
|
414
493
|
|
|
415
|
-
const
|
|
494
|
+
const rawLabel = preview.text ?? (preview.labelKey ? (t(preview.labelKey) ?? "") : "");
|
|
495
|
+
|
|
496
|
+
// Render inline formatting rather than printing the wire format. preparePreviewText
|
|
497
|
+
// reduces a multi-line or block message to one line — the formatter must not meet
|
|
498
|
+
// block-level markers — and reports which KIND of block it found. The four cases get
|
|
499
|
+
// the same treatment the conversation list gives them, so a saved row reads like the
|
|
500
|
+
// chat it came from.
|
|
501
|
+
//
|
|
502
|
+
// `prepared.text` is EMPTY for a code block: its content arrives in
|
|
503
|
+
// `codeBlockFirstLine`. Reading only `.text` rendered an empty subtitle for any
|
|
504
|
+
// message that was just a code block.
|
|
505
|
+
// The consumer's own token becomes UI Kit markup BEFORE any of the preparation below: run it
|
|
506
|
+
// after preparePreviewText or the rich formatter and the token has already been flattened into
|
|
507
|
+
// plain characters, with nothing left to colour.
|
|
508
|
+
const prepared = preparePreviewText(applyRawFormatters(rawLabel, textFormatters));
|
|
509
|
+
// The conversation list's pipeline, step for step, so the same message reads the
|
|
510
|
+
// same in Chats and in Saved Messages:
|
|
511
|
+
// text message -> rich formatter (colour, bold, italic, inline code)
|
|
512
|
+
// anything else -> stripMarkdown, as markers would render as literal characters
|
|
513
|
+
// then -> mentions resolved from "@uid" to the user's name
|
|
514
|
+
const format = (value: string): string | JSX.Element => {
|
|
515
|
+
const trimmed = value.trim();
|
|
516
|
+
const isPlainTextMessage =
|
|
517
|
+
message instanceof CometChat.TextMessage &&
|
|
518
|
+
message.getCategory() === MessageCategoryConstants.message;
|
|
519
|
+
|
|
520
|
+
let content: string | JSX.Element = isPlainTextMessage
|
|
521
|
+
? (savedRichTextFormatter.getFormattedText(trimmed) ?? trimmed)
|
|
522
|
+
: stripMarkdown(trimmed);
|
|
523
|
+
|
|
524
|
+
content = applyMentionsFormatting(message, content, trimmed, undefined);
|
|
525
|
+
return content;
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
// A message that leads with a URL previews as a link chip rather than the raw
|
|
529
|
+
// address, matching the conversation list. Checked on the first 50 characters, as
|
|
530
|
+
// the list does, so a link mentioned late in a long message is not treated as one.
|
|
531
|
+
const leadsWithLink =
|
|
532
|
+
message instanceof CometChat.TextMessage &&
|
|
533
|
+
message.getCategory() === MessageCategoryConstants.message &&
|
|
534
|
+
(() => {
|
|
535
|
+
const raw = typeof message.getText === "function" ? message.getText() : undefined;
|
|
536
|
+
return typeof raw === "string" && !!raw.slice(0, 50).match(/https?:\/\//);
|
|
537
|
+
})();
|
|
538
|
+
|
|
539
|
+
// Whether `label` already brings its own wrapper element. The block branches below return a
|
|
540
|
+
// <View>, and a <View> nested inside a <Text> lays out on iOS but COLLAPSES on Android — the
|
|
541
|
+
// saved row showed a bare "…" for every code block and blockquote. CometChatConversations
|
|
542
|
+
// renders its equivalent bare for exactly this reason.
|
|
543
|
+
let labelIsSelfWrapped = false;
|
|
544
|
+
let label: string | JSX.Element;
|
|
545
|
+
if (leadsWithLink) {
|
|
546
|
+
label = getMessagePreviewInternal("link-fill", t("LINK") ?? "Link", { theme });
|
|
547
|
+
labelIsSelfWrapped = true;
|
|
548
|
+
} else if (prepared.codeBlockFirstLine !== null) {
|
|
549
|
+
label = (
|
|
550
|
+
<View style={localStyles.codeBlockRow}>
|
|
551
|
+
<View
|
|
552
|
+
style={[
|
|
553
|
+
localStyles.codeBlockBadge,
|
|
554
|
+
{
|
|
555
|
+
backgroundColor: (theme?.color?.background2 as string) || "#FAFAFA",
|
|
556
|
+
borderColor: (theme?.color?.borderDefault as string) || "#E8E8E8",
|
|
557
|
+
},
|
|
558
|
+
]}
|
|
559
|
+
>
|
|
560
|
+
<Text
|
|
561
|
+
numberOfLines={1}
|
|
562
|
+
ellipsizeMode='tail'
|
|
563
|
+
style={[
|
|
564
|
+
localStyles.codeBlockText,
|
|
565
|
+
{ color: (theme?.color?.textPrimary as string) || "#141414" },
|
|
566
|
+
]}
|
|
567
|
+
>
|
|
568
|
+
{prepared.codeBlockFirstLine + ".."}
|
|
569
|
+
</Text>
|
|
570
|
+
</View>
|
|
571
|
+
</View>
|
|
572
|
+
);
|
|
573
|
+
labelIsSelfWrapped = true;
|
|
574
|
+
} else if (prepared.isBlockquote) {
|
|
575
|
+
label = (
|
|
576
|
+
<View style={localStyles.blockquoteRow}>
|
|
577
|
+
<View
|
|
578
|
+
style={[
|
|
579
|
+
localStyles.blockquoteBar,
|
|
580
|
+
{ backgroundColor: theme?.color?.primary as string },
|
|
581
|
+
]}
|
|
582
|
+
/>
|
|
583
|
+
<Text
|
|
584
|
+
numberOfLines={1}
|
|
585
|
+
ellipsizeMode='tail'
|
|
586
|
+
style={[itemStyle?.subtitleStyle, localStyles.blockquoteText]}
|
|
587
|
+
>
|
|
588
|
+
{format(prepared.text)}
|
|
589
|
+
</Text>
|
|
590
|
+
</View>
|
|
591
|
+
);
|
|
592
|
+
labelIsSelfWrapped = true;
|
|
593
|
+
} else if (prepared.listPrefix) {
|
|
594
|
+
label = (
|
|
595
|
+
<Text numberOfLines={1} ellipsizeMode='tail' style={itemStyle?.subtitleStyle}>
|
|
596
|
+
{prepared.listPrefix}
|
|
597
|
+
{format(prepared.text)}
|
|
598
|
+
</Text>
|
|
599
|
+
);
|
|
600
|
+
labelIsSelfWrapped = true;
|
|
601
|
+
} else {
|
|
602
|
+
label = format(prepared.text);
|
|
603
|
+
}
|
|
416
604
|
|
|
417
605
|
return (
|
|
418
606
|
<View style={localStyles.subtitleRow}>
|
|
@@ -433,13 +621,17 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
433
621
|
containerStyle={styles.previewIconContainerStyle}
|
|
434
622
|
/>
|
|
435
623
|
) : null}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
624
|
+
{labelIsSelfWrapped ? (
|
|
625
|
+
label
|
|
626
|
+
) : (
|
|
627
|
+
<Text
|
|
628
|
+
numberOfLines={1}
|
|
629
|
+
ellipsizeMode='tail'
|
|
630
|
+
style={[itemStyle?.subtitleStyle, localStyles.subtitleText]}
|
|
631
|
+
>
|
|
632
|
+
{label}
|
|
633
|
+
</Text>
|
|
634
|
+
)}
|
|
443
635
|
</View>
|
|
444
636
|
);
|
|
445
637
|
};
|
|
@@ -620,10 +812,55 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
|
|
|
620
812
|
* lives in ./style.ts (or conversationStyles, for the row chrome) and is merged in.
|
|
621
813
|
*/
|
|
622
814
|
const localStyles = StyleSheet.create({
|
|
815
|
+
// Block-preview styling, matching CometChatConversations so a saved row and a
|
|
816
|
+
// conversation row render the same message identically.
|
|
817
|
+
codeBlockRow: {
|
|
818
|
+
flexDirection: "row",
|
|
819
|
+
alignItems: "center",
|
|
820
|
+
flexShrink: 2,
|
|
821
|
+
},
|
|
822
|
+
codeBlockBadge: {
|
|
823
|
+
borderRadius: 4,
|
|
824
|
+
borderWidth: 1,
|
|
825
|
+
paddingHorizontal: 6,
|
|
826
|
+
paddingVertical: 2,
|
|
827
|
+
flexShrink: 1,
|
|
828
|
+
},
|
|
829
|
+
codeBlockText: {
|
|
830
|
+
fontFamily: Platform.OS === "ios" ? "Menlo" : "monospace",
|
|
831
|
+
fontSize: 11,
|
|
832
|
+
},
|
|
833
|
+
blockquoteRow: {
|
|
834
|
+
flexDirection: "row",
|
|
835
|
+
alignItems: "stretch",
|
|
836
|
+
backgroundColor: "rgba(104, 81, 214, 0.08)",
|
|
837
|
+
borderRadius: 6,
|
|
838
|
+
flexShrink: 2,
|
|
839
|
+
minHeight: 22,
|
|
840
|
+
paddingVertical: 1,
|
|
841
|
+
},
|
|
842
|
+
blockquoteBar: {
|
|
843
|
+
width: 3,
|
|
844
|
+
borderRadius: 1.5,
|
|
845
|
+
marginVertical: 3,
|
|
846
|
+
marginLeft: 4,
|
|
847
|
+
},
|
|
848
|
+
blockquoteText: {
|
|
849
|
+
flex: 1,
|
|
850
|
+
paddingHorizontal: 5,
|
|
851
|
+
lineHeight: 18,
|
|
852
|
+
},
|
|
623
853
|
subtitleRow: {
|
|
624
854
|
flexDirection: "row",
|
|
625
855
|
alignItems: "center",
|
|
626
856
|
flexShrink: 1,
|
|
857
|
+
// flex:1 so the row actually FILLS the list item's subtitle slot. Without it the row is
|
|
858
|
+
// content-sized, and the block children inside (the code-block badge, the blockquote bar +
|
|
859
|
+
// text) size from a Text whose `flex: 1` gives it a flex-basis of 0 — contributing nothing to
|
|
860
|
+
// the content width. On Android that collapses to zero and the row renders a bare "…".
|
|
861
|
+
// CometChatConversations avoids this by returning a FRAGMENT, so its children sit directly in
|
|
862
|
+
// the list item's subtitle container rather than inside an extra content-sized View.
|
|
863
|
+
flex: 1,
|
|
627
864
|
},
|
|
628
865
|
subtitleText: {
|
|
629
866
|
flexShrink: 1,
|