@cometchat/chat-uikit-react-native 5.2.11 → 5.3.0
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/build.gradle +3 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +4 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +909 -10
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorPackage.kt +24 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +5382 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +452 -0
- package/ios/FileManager.m +430 -3
- package/ios/RichTextEditorView.swift +5504 -0
- package/ios/RichTextEditorViewManager.m +66 -0
- package/ios/RichTextEditorViewManager.swift +291 -0
- package/ios/ToolbarIcons.swift +736 -0
- package/package.json +1 -1
- package/react-native-cometchat-ui-kit.podspec +1 -1
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +4557 -0
- package/src/CometChatCompactMessageComposer/SingleLineTextComposerConfiguration.tsx +568 -0
- package/src/CometChatCompactMessageComposer/heightUtils.ts +204 -0
- package/src/CometChatCompactMessageComposer/index.ts +56 -0
- package/src/CometChatCompactMessageComposer/resources/index.ts +5 -0
- package/src/CometChatCompactMessageComposer/styles.ts +291 -0
- package/src/CometChatConversations/CometChatConversations.tsx +139 -10
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +1 -20
- package/src/CometChatMessageComposer/styles.tsx +0 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +6 -1
- package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +105 -0
- package/src/CometChatRichTextEditor/index.tsx +385 -0
- package/src/CometChatRichTextEditor/types.ts +162 -0
- package/src/CometChatSearch/CometChatSearch.tsx +8 -3
- package/src/index.ts +48 -1
- package/src/shared/constants/UIKitConstants.ts +12 -1
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +5 -5
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +768 -0
- package/src/shared/formatters/index.ts +3 -0
- package/src/shared/framework/MessageDataSource.tsx +93 -2
- package/src/shared/helper/composerHelpers.ts +553 -0
- package/src/shared/helper/useKeyboard.tsx +7 -17
- package/src/shared/icons/components/code-blocks.tsx +13 -0
- package/src/shared/icons/components/code.tsx +11 -0
- package/src/shared/icons/components/format-bold.tsx +11 -0
- package/src/shared/icons/components/format-italic.tsx +11 -0
- package/src/shared/icons/components/format-list-bulleted.tsx +11 -0
- package/src/shared/icons/components/format-list-numbered.tsx +11 -0
- package/src/shared/icons/components/format-quote.tsx +13 -0
- package/src/shared/icons/components/format-strikethrough.tsx +13 -0
- package/src/shared/icons/components/format-underlined.tsx +11 -0
- package/src/shared/icons/components/smileys-&-people.tsx +1 -1
- package/src/shared/icons/icon-mapping.tsx +18 -0
- package/src/shared/index.ts +54 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +37 -32
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +5 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +504 -499
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +18 -13
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +505 -500
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +17 -12
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +18 -13
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +132 -11
- package/src/shared/utils/CometChatMessagePreview/style.ts +1 -3
- package/src/shared/utils/MarkdownUtils.ts +143 -0
- package/src/shared/utils/MentionUtils.ts +37 -0
- package/src/shared/utils/index.ts +5 -0
- package/src/shared/views/CometChatInlineAudioRecorder/AudioWaveformVisualizer.tsx +417 -0
- package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +537 -0
- package/src/shared/views/CometChatInlineAudioRecorder/index.ts +34 -0
- package/src/shared/views/CometChatInlineAudioRecorder/style.ts +155 -0
- package/src/shared/views/CometChatInlineAudioRecorder/types.ts +303 -0
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +1336 -0
- package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +183 -0
- package/src/shared/views/CometChatLinkConfirmPopup/index.ts +13 -0
- package/src/shared/views/CometChatLinkConfirmPopup/style.ts +128 -0
- package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +32 -29
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +64 -16
- package/src/shared/views/index.ts +39 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
13
13
|
import React, { useCallback, useMemo } from "react";
|
|
14
|
-
import { Text, View, GestureResponderEvent } from "react-native";
|
|
14
|
+
import { Text, View, GestureResponderEvent, Platform, StyleSheet } from "react-native";
|
|
15
15
|
import {
|
|
16
16
|
ChatConfigurator,
|
|
17
17
|
CometChatAvatar,
|
|
@@ -41,6 +41,8 @@ import {
|
|
|
41
41
|
import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
|
|
42
42
|
import { Icon } from "../shared/icons/Icon";
|
|
43
43
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
44
|
+
import { stripMarkdown, preparePreviewText } from "../shared/utils/MarkdownUtils";
|
|
45
|
+
import { CometChatRichTextFormatter } from "../shared/formatters/CometChatRichTextFormatter";
|
|
44
46
|
import { getMessagePreviewInternal } from "../shared/utils/MessageUtils";
|
|
45
47
|
import { CometChatBadge } from "../shared/views/CometChatBadge";
|
|
46
48
|
import { CometChatConfirmDialog } from "../shared/views/CometChatConfirmDialog";
|
|
@@ -68,6 +70,9 @@ const groupListenerId = "chatlist_group_" + new Date().getTime();
|
|
|
68
70
|
const messageListenerId = "chatlist_message_" + new Date().getTime();
|
|
69
71
|
const callListenerId = "call_" + new Date().getTime();
|
|
70
72
|
|
|
73
|
+
/** Module-level rich text formatter — reused across renders (no GC churn) */
|
|
74
|
+
const conversationRichTextFormatter = new CometChatRichTextFormatter();
|
|
75
|
+
|
|
71
76
|
/**
|
|
72
77
|
* Interface defining props for the CometChatConversations component.
|
|
73
78
|
*/
|
|
@@ -322,6 +327,22 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
322
327
|
// Merge theme styles with provided style overrides.
|
|
323
328
|
const theme = useTheme();
|
|
324
329
|
const { t } = useCometChatTranslation()
|
|
330
|
+
|
|
331
|
+
// Configure conversation subtitle formatter with theme-aware inline code colors
|
|
332
|
+
useMemo(() => {
|
|
333
|
+
conversationRichTextFormatter.setStyle({
|
|
334
|
+
inlineCodeStyle: {
|
|
335
|
+
color: theme.color.primary as string,
|
|
336
|
+
},
|
|
337
|
+
inlineCodeContainerStyle: {
|
|
338
|
+
backgroundColor: theme.color.background3 as string,
|
|
339
|
+
borderRadius: 2,
|
|
340
|
+
paddingHorizontal: 2,
|
|
341
|
+
paddingVertical: 0,
|
|
342
|
+
},
|
|
343
|
+
});
|
|
344
|
+
}, [theme]);
|
|
345
|
+
|
|
325
346
|
const mergedStyles = useMemo(() => {
|
|
326
347
|
const baseStyles = deepMerge(theme.conversationStyles, style ?? {});
|
|
327
348
|
// Add search styling for CometChatList component
|
|
@@ -815,19 +836,73 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
815
836
|
let messageText: string | JSX.Element = "";
|
|
816
837
|
messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
|
|
817
838
|
|
|
818
|
-
|
|
839
|
+
// Detect block-level elements in text messages before stripMarkdown flattens them
|
|
840
|
+
let blockType: 'blockquote' | 'codeBlock' | 'list' | null = null;
|
|
841
|
+
let codeBlockLine = '';
|
|
842
|
+
let listPrefix = '';
|
|
843
|
+
if (
|
|
844
|
+
lastMessage instanceof CometChat.TextMessage &&
|
|
845
|
+
lastMessage.getCategory() === MessageCategoryConstants.message &&
|
|
846
|
+
typeof messageText === "string"
|
|
847
|
+
) {
|
|
848
|
+
const rawText = messageText;
|
|
849
|
+
const preview = preparePreviewText(rawText);
|
|
850
|
+
if (preview.isBlockquote) {
|
|
851
|
+
blockType = 'blockquote';
|
|
852
|
+
// Run formatter on content only (no `> ` prefix) so it won't re-parse as block
|
|
853
|
+
messageText = getFormattedText(lastMessage, preview.text.trim());
|
|
854
|
+
} else if (preview.codeBlockFirstLine !== null) {
|
|
855
|
+
blockType = 'codeBlock';
|
|
856
|
+
codeBlockLine = preview.codeBlockFirstLine;
|
|
857
|
+
} else if (preview.listPrefix) {
|
|
858
|
+
blockType = 'list';
|
|
859
|
+
listPrefix = preview.listPrefix;
|
|
860
|
+
messageText = getFormattedText(lastMessage, preview.text.trim());
|
|
861
|
+
} else {
|
|
862
|
+
messageText = getFormattedText(lastMessage, preview.text.trim());
|
|
863
|
+
}
|
|
864
|
+
} else if (lastMessage && typeof messageText === "string") {
|
|
819
865
|
messageText = getFormattedText(lastMessage, messageText?.trim());
|
|
820
866
|
}
|
|
867
|
+
|
|
821
868
|
if (
|
|
822
869
|
lastMessage instanceof CometChat.TextMessage &&
|
|
823
|
-
lastMessage.getCategory() ===
|
|
870
|
+
lastMessage.getCategory() === MessageCategoryConstants.message &&
|
|
824
871
|
(() => {
|
|
825
|
-
// Guard against undefined text or non-string values.
|
|
826
872
|
const text = typeof lastMessage.getText === "function" ? lastMessage.getText() : undefined;
|
|
827
873
|
return typeof text === "string" && text.slice(0, 50).match(/https?:\/\//);
|
|
828
874
|
})()
|
|
829
875
|
) {
|
|
830
876
|
messageText = getMessagePreviewInternal("link-fill", t("LINK"), { theme });
|
|
877
|
+
} else if (blockType === 'codeBlock') {
|
|
878
|
+
messageText = (
|
|
879
|
+
<View style={conversationPreviewStyles.codeBlockRow}>
|
|
880
|
+
<View style={[conversationPreviewStyles.codeBlockBadge, { backgroundColor: theme?.color?.background2 as string || '#FAFAFA', borderColor: theme?.color?.borderDefault as string || '#E8E8E8' }]}>
|
|
881
|
+
<Text numberOfLines={1} ellipsizeMode='tail' style={[conversationPreviewStyles.codeBlockText, { color: theme?.color?.textPrimary as string || '#141414' }]}>
|
|
882
|
+
{codeBlockLine + '..'}
|
|
883
|
+
</Text>
|
|
884
|
+
</View>
|
|
885
|
+
</View>
|
|
886
|
+
);
|
|
887
|
+
} else if (blockType === 'blockquote') {
|
|
888
|
+
messageText = (
|
|
889
|
+
<View style={conversationPreviewStyles.blockquoteRow}>
|
|
890
|
+
<View style={[conversationPreviewStyles.blockquoteBar, { backgroundColor: theme?.color?.primary as string }]} />
|
|
891
|
+
<Text numberOfLines={1} ellipsizeMode='tail' style={[mergedStyles.itemStyle.subtitleStyle, conversationPreviewStyles.blockquoteText]}>
|
|
892
|
+
{messageText}
|
|
893
|
+
</Text>
|
|
894
|
+
</View>
|
|
895
|
+
);
|
|
896
|
+
} else if (blockType === 'list') {
|
|
897
|
+
messageText = (
|
|
898
|
+
<Text
|
|
899
|
+
style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 2 }]}
|
|
900
|
+
numberOfLines={1}
|
|
901
|
+
ellipsizeMode='tail'
|
|
902
|
+
>
|
|
903
|
+
{listPrefix}{messageText}{'...'}
|
|
904
|
+
</Text>
|
|
905
|
+
);
|
|
831
906
|
} else if (messageText) {
|
|
832
907
|
messageText = (
|
|
833
908
|
<Text
|
|
@@ -874,11 +949,24 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
874
949
|
* @returns The formatted text.
|
|
875
950
|
*/
|
|
876
951
|
function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
|
|
877
|
-
|
|
952
|
+
// For text messages, use the rich text formatter to preserve inline styles
|
|
953
|
+
// (bold, italic, underline, strikethrough, inline code). The subtitle has
|
|
954
|
+
// already been processed by preparePreviewText which strips block-level
|
|
955
|
+
// markers, so the formatter will only encounter inline formatting.
|
|
956
|
+
let messageTextTmp: string | JSX.Element;
|
|
957
|
+
if (
|
|
958
|
+
message instanceof CometChat.TextMessage &&
|
|
959
|
+
message.getCategory() === MessageCategoryConstants.message
|
|
960
|
+
) {
|
|
961
|
+
const formatted = conversationRichTextFormatter.getFormattedText(subtitle);
|
|
962
|
+
messageTextTmp = formatted ?? subtitle;
|
|
963
|
+
} else {
|
|
964
|
+
// Non-text messages: strip markdown as before
|
|
965
|
+
messageTextTmp = stripMarkdown(subtitle);
|
|
966
|
+
}
|
|
878
967
|
let allFormatters = [...(textFormatters || [])];
|
|
879
|
-
// Detect presence of @all alias token in raw string
|
|
880
|
-
const containsAllAlias =
|
|
881
|
-
typeof messageTextTmp === "string" && /<@all:(.*?)>/.test(messageTextTmp);
|
|
968
|
+
// Detect presence of @all alias token in raw subtitle string (before formatting)
|
|
969
|
+
const containsAllAlias = /<@all:(.*?)>/.test(subtitle);
|
|
882
970
|
|
|
883
971
|
if (message.getMentionedUsers().length || containsAllAlias) {
|
|
884
972
|
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
@@ -890,7 +978,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
890
978
|
|
|
891
979
|
// Inject alias suggestion item if needed so formatter can render styled @All
|
|
892
980
|
if (containsAllAlias) {
|
|
893
|
-
const match =
|
|
981
|
+
const match = subtitle.match(/<@all:(.*?)>/);
|
|
894
982
|
const aliasLabel = match && match[1] ? match[1] : "all";
|
|
895
983
|
let existing = mentionsFormatter.getSuggestionItems();
|
|
896
984
|
const underlyingText = `<@all:${aliasLabel}>`;
|
|
@@ -913,7 +1001,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
913
1001
|
|
|
914
1002
|
if (
|
|
915
1003
|
message instanceof CometChat.TextMessage &&
|
|
916
|
-
message.getCategory() ===
|
|
1004
|
+
message.getCategory() === MessageCategoryConstants.message &&
|
|
917
1005
|
(() => {
|
|
918
1006
|
const text = typeof message.getText === "function" ? message.getText() : undefined;
|
|
919
1007
|
return typeof text === "string" && text.slice(0, 50).match(/https?:\/\//);
|
|
@@ -1765,3 +1853,44 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1765
1853
|
</View>
|
|
1766
1854
|
);
|
|
1767
1855
|
};
|
|
1856
|
+
|
|
1857
|
+
// Static styles for conversation preview block-level elements (code block, blockquote, list).
|
|
1858
|
+
// Theme-dependent values (colors) are applied inline via style array merging.
|
|
1859
|
+
const conversationPreviewStyles = StyleSheet.create({
|
|
1860
|
+
codeBlockRow: {
|
|
1861
|
+
flexDirection: 'row',
|
|
1862
|
+
alignItems: 'center',
|
|
1863
|
+
flexShrink: 2,
|
|
1864
|
+
},
|
|
1865
|
+
codeBlockBadge: {
|
|
1866
|
+
borderRadius: 4,
|
|
1867
|
+
borderWidth: 1,
|
|
1868
|
+
paddingHorizontal: 6,
|
|
1869
|
+
paddingVertical: 2,
|
|
1870
|
+
flexShrink: 1,
|
|
1871
|
+
},
|
|
1872
|
+
codeBlockText: {
|
|
1873
|
+
fontFamily: Platform.OS === 'ios' ? 'Menlo' : 'monospace',
|
|
1874
|
+
fontSize: 11,
|
|
1875
|
+
},
|
|
1876
|
+
blockquoteRow: {
|
|
1877
|
+
flexDirection: 'row',
|
|
1878
|
+
alignItems: 'stretch',
|
|
1879
|
+
backgroundColor: 'rgba(104, 81, 214, 0.08)',
|
|
1880
|
+
borderRadius: 6,
|
|
1881
|
+
flexShrink: 2,
|
|
1882
|
+
minHeight: 22,
|
|
1883
|
+
paddingVertical: 1,
|
|
1884
|
+
},
|
|
1885
|
+
blockquoteBar: {
|
|
1886
|
+
width: 3,
|
|
1887
|
+
borderRadius: 1.5,
|
|
1888
|
+
marginVertical: 3,
|
|
1889
|
+
marginLeft: 4,
|
|
1890
|
+
},
|
|
1891
|
+
blockquoteText: {
|
|
1892
|
+
flex: 1,
|
|
1893
|
+
paddingHorizontal: 5,
|
|
1894
|
+
lineHeight: 18,
|
|
1895
|
+
},
|
|
1896
|
+
});
|
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
messageStatus,
|
|
56
56
|
} from "../shared/utils/CometChatMessageHelper";
|
|
57
57
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
58
|
+
import { isCursorWithinMentionRange, getMentionRangeAtCursor } from "../shared/utils/MentionUtils";
|
|
58
59
|
import { permissionUtil } from "../shared/utils/PermissionUtil";
|
|
59
60
|
import { CometChatMediaRecorder } from "../shared/views/CometChatMediaRecorder";
|
|
60
61
|
import { useTheme } from "../theme";
|
|
@@ -1673,26 +1674,6 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1673
1674
|
// console.log("Send Audio"); // Removed debug log
|
|
1674
1675
|
};
|
|
1675
1676
|
|
|
1676
|
-
function isCursorWithinMentionRange(mentionRanges: any, cursorPosition: number) {
|
|
1677
|
-
for (let [range, mention] of mentionRanges) {
|
|
1678
|
-
const [start, end] = range.split("_").map(Number);
|
|
1679
|
-
if (cursorPosition >= start && cursorPosition <= end) {
|
|
1680
|
-
return true; // Cursor is within the range of a mention
|
|
1681
|
-
}
|
|
1682
|
-
}
|
|
1683
|
-
return false; // No mention found at the cursor position
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
|
-
function getMentionRangeAtCursor(mentionRanges: any, cursorPosition: number): { start: number; end: number } | null {
|
|
1687
|
-
for (let [range] of mentionRanges) {
|
|
1688
|
-
const [start, end] = range.split("_").map(Number);
|
|
1689
|
-
if (cursorPosition >= start && cursorPosition <= end) {
|
|
1690
|
-
return { start, end }; // Return the boundary positions
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
return null; // No mention found at the cursor position
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
1677
|
function shouldOpenList(
|
|
1697
1678
|
selection: {
|
|
1698
1679
|
start: number;
|
|
@@ -3329,7 +3329,12 @@ export const CometChatMessageList = memo(
|
|
|
3329
3329
|
const copyMessage = (item: any) => {
|
|
3330
3330
|
let copyMessage = getPlainString(item["text"], item);
|
|
3331
3331
|
Clipboard.setString(copyMessage);
|
|
3332
|
-
|
|
3332
|
+
// Defer modal dismiss to next frame to avoid Fabric race condition
|
|
3333
|
+
// where unmounting the Modal while Clipboard is still accessing views
|
|
3334
|
+
// causes EXC_BAD_ACCESS (SIGSEGV) at null pointer in mount phase.
|
|
3335
|
+
requestAnimationFrame(() => {
|
|
3336
|
+
setShowMessageOptions([]);
|
|
3337
|
+
});
|
|
3333
3338
|
};
|
|
3334
3339
|
|
|
3335
3340
|
const getThreadView = useCallback(
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { ViewProps, HostComponent } from 'react-native';
|
|
2
|
+
import { requireNativeComponent } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type Double = number;
|
|
5
|
+
type Int32 = number;
|
|
6
|
+
type DirectEventHandler<T> = (event: { nativeEvent: T }) => void;
|
|
7
|
+
|
|
8
|
+
// New prop types for CometChat integration
|
|
9
|
+
type SelectionProp = Readonly<{
|
|
10
|
+
start: Int32;
|
|
11
|
+
end: Int32;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
type TextStyleProp = Readonly<{
|
|
15
|
+
fontSize?: Double;
|
|
16
|
+
color?: string;
|
|
17
|
+
fontFamily?: string;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export type StyleRange = Readonly<{
|
|
21
|
+
style: string;
|
|
22
|
+
start: Int32;
|
|
23
|
+
end: Int32;
|
|
24
|
+
url?: string;
|
|
25
|
+
highlightColor?: string;
|
|
26
|
+
}>;
|
|
27
|
+
|
|
28
|
+
export type Block = Readonly<{
|
|
29
|
+
type: string;
|
|
30
|
+
text: string;
|
|
31
|
+
styles: ReadonlyArray<StyleRange>;
|
|
32
|
+
alignment?: string;
|
|
33
|
+
checked?: boolean;
|
|
34
|
+
indentLevel?: Int32;
|
|
35
|
+
}>;
|
|
36
|
+
|
|
37
|
+
type ContentChangeEventData = Readonly<{
|
|
38
|
+
text: string;
|
|
39
|
+
blocksJson: string;
|
|
40
|
+
}>;
|
|
41
|
+
|
|
42
|
+
type SelectionChangeEventData = Readonly<{
|
|
43
|
+
start: Int32;
|
|
44
|
+
end: Int32;
|
|
45
|
+
}>;
|
|
46
|
+
|
|
47
|
+
type SizeChangeEventData = Readonly<{
|
|
48
|
+
height: Double;
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
type ActiveStylesEventData = Readonly<{
|
|
52
|
+
bold: boolean;
|
|
53
|
+
italic: boolean;
|
|
54
|
+
underline: boolean;
|
|
55
|
+
strikethrough: boolean;
|
|
56
|
+
code: boolean;
|
|
57
|
+
codeBlock: boolean;
|
|
58
|
+
highlight: boolean;
|
|
59
|
+
blockType: string;
|
|
60
|
+
alignment: string;
|
|
61
|
+
}>;
|
|
62
|
+
|
|
63
|
+
type LinkTapEventData = Readonly<{
|
|
64
|
+
url: string;
|
|
65
|
+
text: string;
|
|
66
|
+
location: Int32;
|
|
67
|
+
length: Int32;
|
|
68
|
+
}>;
|
|
69
|
+
|
|
70
|
+
export interface NativeProps extends ViewProps {
|
|
71
|
+
placeholder?: string;
|
|
72
|
+
editable?: boolean;
|
|
73
|
+
maxHeight?: Double;
|
|
74
|
+
numberOfLines?: Int32;
|
|
75
|
+
showToolbar?: boolean;
|
|
76
|
+
toolbarOptions?: ReadonlyArray<string>;
|
|
77
|
+
variant?: string;
|
|
78
|
+
initialContentJson?: string;
|
|
79
|
+
toolbarMode?: string;
|
|
80
|
+
enterKeyBehavior?: string;
|
|
81
|
+
|
|
82
|
+
// New props for CometChat integration
|
|
83
|
+
selection?: SelectionProp;
|
|
84
|
+
textStyle?: TextStyleProp;
|
|
85
|
+
placeholderTextColor?: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
showTextSelectionMenuItems?: boolean;
|
|
88
|
+
codeBackgroundColor?: string;
|
|
89
|
+
codeBorderColor?: string;
|
|
90
|
+
codeTextColor?: string;
|
|
91
|
+
codeFontSize?: Double;
|
|
92
|
+
|
|
93
|
+
onContentChange?: DirectEventHandler<ContentChangeEventData>;
|
|
94
|
+
onSelectionChange?: DirectEventHandler<SelectionChangeEventData>;
|
|
95
|
+
onEditorFocus?: DirectEventHandler<Readonly<{}>>;
|
|
96
|
+
onEditorBlur?: DirectEventHandler<Readonly<{}>>;
|
|
97
|
+
onSizeChange?: DirectEventHandler<SizeChangeEventData>;
|
|
98
|
+
onActiveStylesChange?: DirectEventHandler<ActiveStylesEventData>;
|
|
99
|
+
onLinkTap?: DirectEventHandler<LinkTapEventData>;
|
|
100
|
+
onSendRequest?: DirectEventHandler<Readonly<{}>>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export default requireNativeComponent<NativeProps>(
|
|
104
|
+
'RichTextEditorView',
|
|
105
|
+
) as HostComponent<NativeProps>;
|