@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.
Files changed (82) hide show
  1. package/android/build.gradle +3 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +4 -1
  3. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +909 -10
  4. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorPackage.kt +24 -0
  5. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +5382 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +452 -0
  7. package/ios/FileManager.m +430 -3
  8. package/ios/RichTextEditorView.swift +5504 -0
  9. package/ios/RichTextEditorViewManager.m +66 -0
  10. package/ios/RichTextEditorViewManager.swift +291 -0
  11. package/ios/ToolbarIcons.swift +736 -0
  12. package/package.json +1 -1
  13. package/react-native-cometchat-ui-kit.podspec +1 -1
  14. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +4557 -0
  15. package/src/CometChatCompactMessageComposer/SingleLineTextComposerConfiguration.tsx +568 -0
  16. package/src/CometChatCompactMessageComposer/heightUtils.ts +204 -0
  17. package/src/CometChatCompactMessageComposer/index.ts +56 -0
  18. package/src/CometChatCompactMessageComposer/resources/index.ts +5 -0
  19. package/src/CometChatCompactMessageComposer/styles.ts +291 -0
  20. package/src/CometChatConversations/CometChatConversations.tsx +139 -10
  21. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +1 -20
  22. package/src/CometChatMessageComposer/styles.tsx +0 -1
  23. package/src/CometChatMessageList/CometChatMessageList.tsx +6 -1
  24. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +105 -0
  25. package/src/CometChatRichTextEditor/index.tsx +385 -0
  26. package/src/CometChatRichTextEditor/types.ts +162 -0
  27. package/src/CometChatSearch/CometChatSearch.tsx +8 -3
  28. package/src/index.ts +48 -1
  29. package/src/shared/constants/UIKitConstants.ts +12 -1
  30. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +5 -5
  31. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +768 -0
  32. package/src/shared/formatters/index.ts +3 -0
  33. package/src/shared/framework/MessageDataSource.tsx +93 -2
  34. package/src/shared/helper/composerHelpers.ts +553 -0
  35. package/src/shared/helper/useKeyboard.tsx +7 -17
  36. package/src/shared/icons/components/code-blocks.tsx +13 -0
  37. package/src/shared/icons/components/code.tsx +11 -0
  38. package/src/shared/icons/components/format-bold.tsx +11 -0
  39. package/src/shared/icons/components/format-italic.tsx +11 -0
  40. package/src/shared/icons/components/format-list-bulleted.tsx +11 -0
  41. package/src/shared/icons/components/format-list-numbered.tsx +11 -0
  42. package/src/shared/icons/components/format-quote.tsx +13 -0
  43. package/src/shared/icons/components/format-strikethrough.tsx +13 -0
  44. package/src/shared/icons/components/format-underlined.tsx +11 -0
  45. package/src/shared/icons/components/smileys-&-people.tsx +1 -1
  46. package/src/shared/icons/icon-mapping.tsx +18 -0
  47. package/src/shared/index.ts +54 -2
  48. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +37 -32
  49. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +5 -0
  50. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +17 -12
  51. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +505 -500
  52. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +18 -13
  53. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +17 -12
  54. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +504 -499
  55. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +504 -499
  56. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +504 -499
  57. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +18 -13
  58. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +17 -12
  59. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +505 -500
  60. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +17 -12
  61. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +17 -12
  62. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +18 -13
  63. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +505 -500
  64. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +17 -12
  65. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +18 -13
  66. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +132 -11
  67. package/src/shared/utils/CometChatMessagePreview/style.ts +1 -3
  68. package/src/shared/utils/MarkdownUtils.ts +143 -0
  69. package/src/shared/utils/MentionUtils.ts +37 -0
  70. package/src/shared/utils/index.ts +5 -0
  71. package/src/shared/views/CometChatInlineAudioRecorder/AudioWaveformVisualizer.tsx +417 -0
  72. package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +537 -0
  73. package/src/shared/views/CometChatInlineAudioRecorder/index.ts +34 -0
  74. package/src/shared/views/CometChatInlineAudioRecorder/style.ts +155 -0
  75. package/src/shared/views/CometChatInlineAudioRecorder/types.ts +303 -0
  76. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +1336 -0
  77. package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +183 -0
  78. package/src/shared/views/CometChatLinkConfirmPopup/index.ts +13 -0
  79. package/src/shared/views/CometChatLinkConfirmPopup/style.ts +128 -0
  80. package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +32 -29
  81. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +64 -16
  82. package/src/shared/views/index.ts +39 -0
@@ -0,0 +1,183 @@
1
+ import React, { useState, useEffect, useMemo } from "react";
2
+ import {
3
+ Modal,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ View,
8
+ } from "react-native";
9
+ import { useTheme } from "../../../theme";
10
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
11
+ import {
12
+ getLinkConfirmPopupStyleLight,
13
+ getLinkConfirmPopupStyleDark,
14
+ } from "./style";
15
+
16
+ export interface CometChatLinkConfirmPopupInterface {
17
+ /** Whether the popup is visible */
18
+ visible: boolean;
19
+ /** The URL of the tapped link */
20
+ url: string;
21
+ /** Initial display text for edit mode */
22
+ initialEditText?: string;
23
+ /** Initial URL for edit mode */
24
+ initialEditUrl?: string;
25
+ /** When true, opens directly in edit mode with "Insert Link" title.
26
+ * The confirm view (Edit/Remove) is skipped entirely. */
27
+ insertMode?: boolean;
28
+ /** Called when the popup is dismissed (backdrop press or cancel) */
29
+ onDismiss: () => void;
30
+ /** Called when the user saves an edited link */
31
+ onEdit: (newUrl: string, newText: string) => void;
32
+ /** Called when the user removes the link */
33
+ onRemove: () => void;
34
+ }
35
+
36
+ export const CometChatLinkConfirmPopup = (props: CometChatLinkConfirmPopupInterface) => {
37
+ const {
38
+ visible,
39
+ url,
40
+ initialEditText = "",
41
+ initialEditUrl = "",
42
+ insertMode = false,
43
+ onDismiss,
44
+ onEdit,
45
+ onRemove,
46
+ } = props;
47
+
48
+ const theme = useTheme();
49
+ const { t } = useCometChatTranslation();
50
+ const styles = useMemo(
51
+ () =>
52
+ theme.mode === "dark"
53
+ ? getLinkConfirmPopupStyleDark(theme.color, theme.spacing, theme.typography)
54
+ : getLinkConfirmPopupStyleLight(theme.color, theme.spacing, theme.typography),
55
+ [theme]
56
+ );
57
+
58
+ const [editMode, setEditMode] = useState(false);
59
+ const [editUrl, setEditUrl] = useState(initialEditUrl || url);
60
+ const [editText, setEditText] = useState(initialEditText);
61
+
62
+ // Sync state when popup opens with new data
63
+ useEffect(() => {
64
+ if (visible) {
65
+ setEditMode(insertMode);
66
+ setEditUrl(initialEditUrl || url);
67
+ setEditText(initialEditText);
68
+ }
69
+ }, [visible, url, initialEditUrl, initialEditText, insertMode]);
70
+
71
+ const handleDismiss = () => {
72
+ setEditMode(false);
73
+ onDismiss();
74
+ };
75
+
76
+ const handleSave = () => {
77
+ if (editUrl.trim()) {
78
+ onEdit(editUrl.trim(), editText.trim() || editUrl.trim());
79
+ }
80
+ };
81
+
82
+ return (
83
+ <Modal
84
+ visible={visible}
85
+ transparent
86
+ animationType="fade"
87
+ onRequestClose={handleDismiss}
88
+ >
89
+ <TouchableOpacity
90
+ style={styles.overlayStyle}
91
+ activeOpacity={1}
92
+ onPress={handleDismiss}
93
+ >
94
+ <TouchableOpacity
95
+ activeOpacity={1}
96
+ style={styles.containerStyle}
97
+ >
98
+ {editMode ? (
99
+ <>
100
+ <Text style={styles.titleTextStyle}>
101
+ {insertMode ? t("INSERT_LINK") : t("EDIT_LINK")}
102
+ </Text>
103
+ <TextInput
104
+ testID="link-tap-edit-text-input"
105
+ accessibilityLabel="link-tap-edit-text-input"
106
+ placeholder={t("LINK_TEXT")}
107
+ placeholderTextColor={theme.color.textTertiary as string}
108
+ value={editText}
109
+ onChangeText={setEditText}
110
+ style={styles.inputStyle}
111
+ autoFocus
112
+ />
113
+ <TextInput
114
+ testID="link-tap-edit-url-input"
115
+ accessibilityLabel="link-tap-edit-url-input"
116
+ placeholder={t("URL")}
117
+ placeholderTextColor={theme.color.textTertiary as string}
118
+ value={editUrl}
119
+ onChangeText={setEditUrl}
120
+ style={styles.inputStyle}
121
+ keyboardType="url"
122
+ autoCapitalize="none"
123
+ />
124
+ <View style={styles.buttonRowStyle}>
125
+ <TouchableOpacity
126
+ testID="link-tap-edit-cancel"
127
+ style={styles.cancelButtonStyle}
128
+ onPress={handleDismiss}
129
+ >
130
+ <Text style={styles.cancelButtonTextStyle}>{ t("CANCEL") }</Text>
131
+ </TouchableOpacity>
132
+ <TouchableOpacity
133
+ testID="link-tap-edit-confirm"
134
+ disabled={!editUrl.trim()}
135
+ style={[
136
+ styles.confirmButtonStyle,
137
+ !editUrl.trim() && { opacity: 0.4 },
138
+ ]}
139
+ onPress={handleSave}
140
+ >
141
+ <Text style={styles.confirmButtonTextStyle}>
142
+ {insertMode ? t("INSERT") : t("SAVE")}
143
+ </Text>
144
+ </TouchableOpacity>
145
+ </View>
146
+ </>
147
+ ) : (
148
+ <>
149
+ <View style={styles.confirmSectionStyle}>
150
+ <Text style={styles.titleTextStyle}>{ t("LINK") }</Text>
151
+ <Text
152
+ testID="link-tap-url-display"
153
+ style={styles.urlTextStyle}
154
+ numberOfLines={2}
155
+ >
156
+ {url}
157
+ </Text>
158
+ </View>
159
+ <View
160
+ style={[styles.buttonRowStyle, styles.confirmSectionDividerStyle]}
161
+ >
162
+ <TouchableOpacity
163
+ testID="link-tap-edit"
164
+ style={styles.cancelButtonStyle}
165
+ onPress={() => setEditMode(true)}
166
+ >
167
+ <Text style={styles.cancelButtonTextStyle}>{ t("EDIT") }</Text>
168
+ </TouchableOpacity>
169
+ <TouchableOpacity
170
+ testID="link-tap-remove"
171
+ style={styles.removeButtonStyle}
172
+ onPress={onRemove}
173
+ >
174
+ <Text style={styles.removeButtonTextStyle}>{ t("REMOVE") }</Text>
175
+ </TouchableOpacity>
176
+ </View>
177
+ </>
178
+ )}
179
+ </TouchableOpacity>
180
+ </TouchableOpacity>
181
+ </Modal>
182
+ );
183
+ };
@@ -0,0 +1,13 @@
1
+ export {
2
+ CometChatLinkConfirmPopup,
3
+ } from "./CometChatLinkConfirmPopup";
4
+
5
+ export type {
6
+ CometChatLinkConfirmPopupInterface,
7
+ } from "./CometChatLinkConfirmPopup";
8
+
9
+ export type { LinkConfirmPopupStyle } from "./style";
10
+ export {
11
+ getLinkConfirmPopupStyleLight,
12
+ getLinkConfirmPopupStyleDark,
13
+ } from "./style";
@@ -0,0 +1,128 @@
1
+ import { StyleSheet, TextStyle, ViewStyle } from "react-native";
2
+ import { CometChatTheme } from "../../../theme/type";
3
+ import { deepMerge } from "../../helper/helperFunctions";
4
+
5
+ export type LinkConfirmPopupStyle = {
6
+ overlayStyle: ViewStyle;
7
+ containerStyle: ViewStyle;
8
+ titleTextStyle: TextStyle;
9
+ urlTextStyle: TextStyle;
10
+ inputStyle: TextStyle;
11
+ buttonRowStyle: ViewStyle;
12
+ cancelButtonStyle: ViewStyle;
13
+ cancelButtonTextStyle: TextStyle;
14
+ confirmButtonStyle: ViewStyle;
15
+ confirmButtonTextStyle: TextStyle;
16
+ removeButtonStyle: ViewStyle;
17
+ removeButtonTextStyle: TextStyle;
18
+ confirmSectionStyle: ViewStyle;
19
+ confirmSectionDividerStyle: ViewStyle;
20
+ };
21
+
22
+ export const getLinkConfirmPopupStyleLight = (
23
+ color: CometChatTheme["color"],
24
+ spacing: CometChatTheme["spacing"],
25
+ typography: CometChatTheme["typography"]
26
+ ): LinkConfirmPopupStyle => {
27
+ return StyleSheet.create({
28
+ overlayStyle: {
29
+ flex: 1,
30
+ backgroundColor: "rgba(0,0,0,0.4)",
31
+ justifyContent: "center",
32
+ alignItems: "center",
33
+ },
34
+ containerStyle: {
35
+ backgroundColor: color.background1,
36
+ borderWidth: 1,
37
+ borderColor: color.borderLight,
38
+ borderRadius: spacing.radius.r4,
39
+ padding: spacing.padding.p6,
40
+ width: "85%",
41
+ maxWidth: 400,
42
+ gap: spacing.padding.p3,
43
+ shadowColor: "#101828",
44
+ shadowOffset: { width: 0, height: 12 },
45
+ shadowOpacity: 0.08,
46
+ shadowRadius: 16,
47
+ elevation: 8,
48
+ },
49
+ titleTextStyle: {
50
+ color: color.textPrimary,
51
+ ...typography.heading2.medium,
52
+ },
53
+ urlTextStyle: {
54
+ color: color.textHighlight,
55
+ ...typography.body.regular,
56
+ },
57
+ inputStyle: {
58
+ borderBottomWidth: 1,
59
+ borderBottomColor: color.borderDefault,
60
+ paddingVertical: spacing.padding.p2,
61
+ color: color.textPrimary,
62
+ ...typography.body.regular,
63
+ },
64
+ buttonRowStyle: {
65
+ flexDirection: "row",
66
+ gap: spacing.padding.p2,
67
+ paddingTop: spacing.padding.p3,
68
+ },
69
+ cancelButtonStyle: {
70
+ flex: 1,
71
+ height: spacing.spacing.s10,
72
+ borderWidth: 1,
73
+ borderColor: color.borderDark,
74
+ borderRadius: spacing.radius.r2,
75
+ justifyContent: "center",
76
+ alignItems: "center",
77
+ },
78
+ cancelButtonTextStyle: {
79
+ color: color.textPrimary,
80
+ ...typography.button.medium,
81
+ },
82
+ confirmButtonStyle: {
83
+ flex: 1,
84
+ height: spacing.spacing.s10,
85
+ backgroundColor: color.primary,
86
+ borderRadius: spacing.radius.r2,
87
+ justifyContent: "center",
88
+ alignItems: "center",
89
+ },
90
+ confirmButtonTextStyle: {
91
+ color: color.primaryButtonIcon,
92
+ ...typography.button.medium,
93
+ },
94
+ removeButtonStyle: {
95
+ flex: 1,
96
+ height: spacing.spacing.s10,
97
+ backgroundColor: color.error,
98
+ borderRadius: spacing.radius.r2,
99
+ justifyContent: "center",
100
+ alignItems: "center",
101
+ },
102
+ removeButtonTextStyle: {
103
+ color: color.primaryButtonIcon,
104
+ ...typography.button.medium,
105
+ },
106
+ confirmSectionStyle: {
107
+ gap: spacing.padding.p2,
108
+ },
109
+ confirmSectionDividerStyle: {
110
+ borderTopWidth: 1,
111
+ borderTopColor: color.borderLight,
112
+ },
113
+ });
114
+ };
115
+
116
+ export const getLinkConfirmPopupStyleDark = (
117
+ color: CometChatTheme["color"],
118
+ spacing: CometChatTheme["spacing"],
119
+ typography: CometChatTheme["typography"]
120
+ ): LinkConfirmPopupStyle => {
121
+ return <LinkConfirmPopupStyle>(
122
+ deepMerge(getLinkConfirmPopupStyleLight(color, spacing, typography), {
123
+ containerStyle: {
124
+ backgroundColor: color.background2,
125
+ },
126
+ })
127
+ );
128
+ };
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { TouchableOpacity } from "react-native";
1
+ import React, { useMemo } from "react";
2
+ import { TouchableOpacity, ViewStyle } from "react-native";
3
3
  import { stopStreamingForRunId } from "../../services/stream-message.service";
4
4
  import { useTheme } from "../../../theme";
5
5
  import { Icon } from "../../../shared/icons/Icon";
@@ -39,48 +39,51 @@ const CometChatSendButtonView = ({
39
39
 
40
40
  const shouldShowStop = isStreaming || showStopButton;
41
41
  const isActive = shouldShowStop || !isButtonDisabled;
42
- const backgroundColor =
43
- theme.mode === "light"
44
- ? isActive
45
- ? theme.color.secondaryButtonBackground
46
- : theme.color.background4
47
- : isActive
48
- ? theme.color.staticWhite
49
- : theme.color.background4;
42
+
43
+ const buttonStyle = useMemo<ViewStyle>(() => {
44
+ const { spacing } = theme;
45
+ const backgroundColor =
46
+ theme.mode === "light"
47
+ ? isActive
48
+ ? theme.color.secondaryButtonBackground
49
+ : theme.color.background4
50
+ : isActive
51
+ ? theme.color.staticWhite
52
+ : theme.color.background4;
53
+
54
+ return {
55
+ display: "flex",
56
+ width: spacing.spacing.s8,
57
+ height: spacing.spacing.s8,
58
+ padding: spacing.padding.p1,
59
+ justifyContent: "center",
60
+ alignItems: "center",
61
+ borderRadius: spacing.spacing.s15,
62
+ backgroundColor,
63
+ } as ViewStyle;
64
+ }, [theme, isActive]);
65
+
50
66
  const iconColor =
51
67
  theme.mode === "light"
52
- ? isActive
53
- ? theme.color.staticWhite
54
- : theme.color.staticWhite
68
+ ? theme.color.staticWhite
55
69
  : isActive
56
70
  ? theme.color.staticBlack
57
- : theme.color.staticBlack
71
+ : theme.color.staticBlack;
58
72
 
59
-
60
73
  return (
61
74
  <TouchableOpacity
62
75
  onPress={handlePress}
63
76
  disabled={isButtonDisabled && shouldShowStop}
64
- style={{
65
- display: "flex",
66
- width: 40,
67
- height: 40,
68
- paddingVertical: theme.spacing.padding.p4,
69
- paddingHorizontal: theme.spacing.padding.p3,
70
- justifyContent: "center",
71
- alignItems: "center",
72
- borderRadius: 9999,
73
- backgroundColor,
74
- }}
77
+ style={buttonStyle}
75
78
  >
76
79
  <Icon
77
80
  name={shouldShowStop ? "stop-fill" : "ai-send-button"}
78
- width={20}
79
- height={20}
81
+ width={theme.spacing.spacing.s5}
82
+ height={theme.spacing.spacing.s5}
80
83
  color={iconColor}
81
84
  />
82
85
  </TouchableOpacity>
83
86
  );
84
87
  };
85
88
 
86
- export { CometChatSendButtonView };
89
+ export { CometChatSendButtonView };
@@ -1,4 +1,4 @@
1
- import React, { useLayoutEffect, useState, useRef, useCallback, useMemo } from "react";
1
+ import React, { useLayoutEffect, useState, useRef, useCallback, useMemo, JSX } from "react";
2
2
  import {
3
3
  StyleProp,
4
4
  Text,
@@ -15,7 +15,9 @@ import {
15
15
  CometChatUrlsFormatter,
16
16
  } from "../../formatters";
17
17
  import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
18
- import { t } from "../../resources/CometChatLocalizeNew/LocalizationManager";
18
+
19
+ // Pre-allocated style for view-based content wrapper (blockquotes, lists).
20
+ const VIEW_BASED_WRAPPER_STYLE = { flexShrink: 1 as const };
19
21
 
20
22
  export interface CometChatTextBubbleInterface {
21
23
  /*** text to be shown */
@@ -44,6 +46,30 @@ export const CometChatTextBubble = (props: CometChatTextBubbleInterface) => {
44
46
  );
45
47
  };
46
48
 
49
+ /**
50
+ * Recursively apply textStyle to all Text elements within a tree.
51
+ * Needed for View-based content (blockquotes, lists) where Text nodes
52
+ * can be nested multiple levels deep inside View wrappers.
53
+ */
54
+ function applyTextStyleDeep(
55
+ el: React.ReactElement<any>,
56
+ textStyle: StyleProp<TextStyle> | undefined
57
+ ): React.ReactElement<any> {
58
+ if (el.type === Text) {
59
+ return React.cloneElement(el, {
60
+ style: [textStyle, el.props?.style],
61
+ });
62
+ }
63
+ if (el.type === View && el.props.children) {
64
+ const newChildren = React.Children.map(el.props.children, (child) => {
65
+ if (!React.isValidElement(child)) return child;
66
+ return applyTextStyleDeep(child as React.ReactElement<any>, textStyle);
67
+ });
68
+ return React.cloneElement(el, {}, newChildren);
69
+ }
70
+ return el;
71
+ }
72
+
47
73
  /**
48
74
  * CometChatTextBubbleText
49
75
  *
@@ -73,14 +99,15 @@ export const CometChatTextBubbleText = (
73
99
  const lastTextRef = useRef<string>(text);
74
100
 
75
101
  // Compute formatted text synchronously - no state update needed
102
+ // Result can be string or JSX.Element (when rich text formatter produces View-based content)
76
103
  const formattedText = useMemo(() => {
77
- let finalText = text;
104
+ let finalText: string | JSX.Element | null = text;
78
105
  if (textFormatters && textFormatters.length) {
79
106
  for (let i = 0; i < textFormatters.length; i++) {
80
107
  finalText = textFormatters[i].getFormattedText(finalText);
81
108
  }
82
109
  }
83
- return finalText as string;
110
+ return finalText as string | JSX.Element;
84
111
  }, [text, textFormatters]);
85
112
 
86
113
  // Reset state only when text actually changes
@@ -102,8 +129,9 @@ export const CometChatTextBubbleText = (
102
129
  }, []);
103
130
 
104
131
  // Called when hidden text is laid out
132
+ // Use original text for the measurement key (formattedText may be JSX)
105
133
  const onMeasuredTextLayout = useCallback((e: TextLayoutEvent) => {
106
- const key = `${formattedText}::${containerWidth ?? 0}`;
134
+ const key = `${text}::${containerWidth ?? 0}`;
107
135
 
108
136
  // Skip if already measured
109
137
  if (measuredCacheRef.current[key]) {
@@ -119,12 +147,20 @@ export const CometChatTextBubbleText = (
119
147
  measuredCacheRef.current[key] = true;
120
148
  setIsTruncatable(isNowTruncatable);
121
149
  setMeasurementComplete(true);
122
- }, [formattedText, containerWidth, collapseLines, measurementComplete]);
150
+ }, [text, containerWidth, collapseLines, measurementComplete]);
123
151
 
124
152
  const toggle = useCallback(() => setIsExpanded(v => !v), []);
125
153
 
126
- const hiddenTextKey = `${formattedText}::${containerWidth ?? 0}`;
127
- const needsMeasurement = containerWidth !== null && !measuredCacheRef.current[hiddenTextKey];
154
+ // Use original text for keys (formattedText may be JSX and can't be stringified)
155
+ const hiddenTextKey = `${text}::${containerWidth ?? 0}`;
156
+
157
+ // Check if formattedText is a View-based element (e.g. blockquote with View wrapper).
158
+ // View elements cannot be nested inside Text, so render them directly.
159
+ const isViewBased = React.isValidElement(formattedText) &&
160
+ (formattedText as React.ReactElement<any>).type === View;
161
+
162
+ // Only measure string content — View-based content can't use onTextLayout
163
+ const needsMeasurement = containerWidth !== null && !isViewBased && !measuredCacheRef.current[hiddenTextKey];
128
164
 
129
165
  return (
130
166
  <View onLayout={onContainerLayout}>
@@ -144,14 +180,26 @@ export const CometChatTextBubbleText = (
144
180
  </Text>
145
181
  )}
146
182
 
147
- {/* Visible text */}
148
- <Text
149
- style={textStyle}
150
- numberOfLines={isExpanded ? undefined : collapseLines}
151
- ellipsizeMode='tail'
152
- >
153
- {formattedText}
154
- </Text>
183
+ {/* Visible text — View-based content (blockquotes, lists) rendered directly */}
184
+ {isViewBased ? (
185
+ <View style={VIEW_BASED_WRAPPER_STYLE}>
186
+ {React.Children.map(
187
+ (formattedText as React.ReactElement<any>).props.children,
188
+ (child) => {
189
+ if (!React.isValidElement(child)) return child;
190
+ return applyTextStyleDeep(child as React.ReactElement<any>, textStyle);
191
+ }
192
+ )}
193
+ </View>
194
+ ) : (
195
+ <Text
196
+ style={textStyle}
197
+ numberOfLines={isExpanded ? undefined : collapseLines}
198
+ ellipsizeMode='tail'
199
+ >
200
+ {formattedText}
201
+ </Text>
202
+ )}
155
203
 
156
204
  {/* Toggle - only show after measurement is complete to prevent flicker */}
157
205
  {measurementComplete && isTruncatable && (
@@ -90,15 +90,40 @@ import {
90
90
  CometChatReportDialogInterface,
91
91
  } from "./CometChatReportDialog";
92
92
 
93
+ import {
94
+ CometChatLinkConfirmPopup,
95
+ CometChatLinkConfirmPopupInterface,
96
+ } from "./CometChatLinkConfirmPopup";
97
+
93
98
  import {
94
99
  CometChatNewMessageIndicator,
95
100
  CometChatNewMessageIndicatorInterface,
96
101
  NewMessageIndicatorStyle,
97
102
  } from "./CometChatNewMessageIndicator";
98
103
 
104
+ import {
105
+ CometChatInlineAudioRecorder,
106
+ formatDuration,
107
+ AudioWaveformVisualizer,
108
+ useAudioRecorder,
109
+ getInlineAudioRecorderStyle,
110
+ getInlineAudioRecorderStyleLight,
111
+ getInlineAudioRecorderStyleDark,
112
+ } from "./CometChatInlineAudioRecorder";
113
+
114
+ import type {
115
+ CometChatInlineAudioRecorderProps,
116
+ CometChatInlineAudioRecorderStyle,
117
+ AudioWaveformVisualizerProps,
118
+ WaveformStyle,
119
+ RecorderState,
120
+ UseAudioRecorderReturn,
121
+ } from "./CometChatInlineAudioRecorder";
122
+
99
123
  export type {
100
124
  CometChatConfirmDialogInterface,
101
125
  CometChatReportDialogInterface,
126
+ CometChatLinkConfirmPopupInterface,
102
127
  CometChatDateInterface,
103
128
  CometChatFileBubbleInterface,
104
129
  CometChatImageBubbleInterface,
@@ -118,6 +143,12 @@ export type {
118
143
  CometChatVideoBubbleInterface,
119
144
  CometChatTextBubbleInterface,
120
145
  CometChatNewMessageIndicatorInterface,
146
+ CometChatInlineAudioRecorderProps,
147
+ CometChatInlineAudioRecorderStyle,
148
+ AudioWaveformVisualizerProps,
149
+ WaveformStyle,
150
+ RecorderState,
151
+ UseAudioRecorderReturn,
121
152
  };
122
153
 
123
154
  export {
@@ -128,6 +159,7 @@ export {
128
159
  CometChatBottomSheet,
129
160
  CometChatConfirmDialog,
130
161
  CometChatReportDialog,
162
+ CometChatLinkConfirmPopup,
131
163
  CometChatDate,
132
164
  CometChatEmojiKeyboard,
133
165
  CometChatFileBubble,
@@ -146,6 +178,13 @@ export {
146
178
  CometChatVideoBubble,
147
179
  SuggestionItem,
148
180
  CometChatNewMessageIndicator,
181
+ CometChatInlineAudioRecorder,
182
+ formatDuration,
183
+ AudioWaveformVisualizer,
184
+ useAudioRecorder,
185
+ getInlineAudioRecorderStyle,
186
+ getInlineAudioRecorderStyleLight,
187
+ getInlineAudioRecorderStyleDark,
149
188
  };
150
189
 
151
190