@cometchat/chat-uikit-react-native 5.1.1 → 5.2.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 (227) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  3. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.d.ts +40 -0
  4. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js +467 -0
  5. package/lib/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.js.map +1 -0
  6. package/lib/CometChatAIAssistantChatHistory/Skeleton.d.ts +24 -0
  7. package/lib/CometChatAIAssistantChatHistory/Skeleton.js +130 -0
  8. package/lib/CometChatAIAssistantChatHistory/Skeleton.js.map +1 -0
  9. package/lib/CometChatAIAssistantChatHistory/index.d.ts +1 -0
  10. package/lib/CometChatAIAssistantChatHistory/index.js +2 -0
  11. package/lib/CometChatAIAssistantChatHistory/index.js.map +1 -0
  12. package/lib/CometChatAIAssistantChatHistory/style.d.ts +30 -0
  13. package/lib/CometChatAIAssistantChatHistory/style.js +122 -0
  14. package/lib/CometChatAIAssistantChatHistory/style.js.map +1 -0
  15. package/lib/CometChatConversations/CometChatConversations.js +26 -5
  16. package/lib/CometChatConversations/CometChatConversations.js.map +1 -1
  17. package/lib/CometChatMessageComposer/CometChatMessageComposer.d.ts +7 -0
  18. package/lib/CometChatMessageComposer/CometChatMessageComposer.js +101 -13
  19. package/lib/CometChatMessageComposer/CometChatMessageComposer.js.map +1 -1
  20. package/lib/CometChatMessageHeader/CometChatMessageHeader.d.ts +16 -0
  21. package/lib/CometChatMessageHeader/CometChatMessageHeader.js +63 -13
  22. package/lib/CometChatMessageHeader/CometChatMessageHeader.js.map +1 -1
  23. package/lib/CometChatMessageList/CometChatMessageList.d.ts +33 -0
  24. package/lib/CometChatMessageList/CometChatMessageList.js +535 -76
  25. package/lib/CometChatMessageList/CometChatMessageList.js.map +1 -1
  26. package/lib/CometChatMessageList/style.js +74 -2
  27. package/lib/CometChatMessageList/style.js.map +1 -1
  28. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js +6 -12
  29. package/lib/calls/CometChatIncomingCall/CometChatIncomingCall.js.map +1 -1
  30. package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js +4 -3
  31. package/lib/calls/CometChatOutgoingCall/CometChatOutgoingCall.js.map +1 -1
  32. package/lib/extensions/Polls/Polls.js +38 -17
  33. package/lib/extensions/Polls/Polls.js.map +1 -1
  34. package/lib/index.d.ts +5 -1
  35. package/lib/index.js +6 -2
  36. package/lib/index.js.map +1 -1
  37. package/lib/shared/constants/UIKitConstants.d.ts +16 -0
  38. package/lib/shared/constants/UIKitConstants.js +16 -0
  39. package/lib/shared/constants/UIKitConstants.js.map +1 -1
  40. package/lib/shared/events/CometChatMessageEvents/index.d.ts +3 -0
  41. package/lib/shared/events/CometChatMessageEvents/index.js +3 -0
  42. package/lib/shared/events/CometChatMessageEvents/index.js.map +1 -1
  43. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js +3 -0
  44. package/lib/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.js.map +1 -1
  45. package/lib/shared/events/CometChatUIEventHandler/Listener.d.ts +3 -1
  46. package/lib/shared/events/CometChatUIEventHandler/Listener.js +4 -1
  47. package/lib/shared/events/CometChatUIEventHandler/Listener.js.map +1 -1
  48. package/lib/shared/events/ListenerInitializer.d.ts +3 -1
  49. package/lib/shared/events/ListenerInitializer.js +5 -1
  50. package/lib/shared/events/ListenerInitializer.js.map +1 -1
  51. package/lib/shared/events/messages.d.ts +2 -1
  52. package/lib/shared/events/messages.js +1 -0
  53. package/lib/shared/events/messages.js.map +1 -1
  54. package/lib/shared/framework/DataSource.d.ts +3 -1
  55. package/lib/shared/framework/DataSourceDecorator.d.ts +3 -1
  56. package/lib/shared/framework/DataSourceDecorator.js +8 -2
  57. package/lib/shared/framework/DataSourceDecorator.js.map +1 -1
  58. package/lib/shared/framework/MessageDataSource.d.ts +6 -0
  59. package/lib/shared/framework/MessageDataSource.js +64 -1
  60. package/lib/shared/framework/MessageDataSource.js.map +1 -1
  61. package/lib/shared/icons/components/ai-chat-history.d.ts +8 -0
  62. package/lib/shared/icons/components/ai-chat-history.js +9 -0
  63. package/lib/shared/icons/components/ai-chat-history.js.map +1 -0
  64. package/lib/shared/icons/components/ai-copy-option.d.ts +8 -0
  65. package/lib/shared/icons/components/ai-copy-option.js +9 -0
  66. package/lib/shared/icons/components/ai-copy-option.js.map +1 -0
  67. package/lib/shared/icons/components/ai-new-chat.d.ts +8 -0
  68. package/lib/shared/icons/components/ai-new-chat.js +9 -0
  69. package/lib/shared/icons/components/ai-new-chat.js.map +1 -0
  70. package/lib/shared/icons/components/ai-send-button.d.ts +8 -0
  71. package/lib/shared/icons/components/ai-send-button.js +9 -0
  72. package/lib/shared/icons/components/ai-send-button.js.map +1 -0
  73. package/lib/shared/icons/components/right-arrow.d.ts +3 -0
  74. package/lib/shared/icons/components/right-arrow.js +6 -0
  75. package/lib/shared/icons/components/right-arrow.js.map +1 -0
  76. package/lib/shared/icons/components/stop-fill.js +8 -7
  77. package/lib/shared/icons/components/stop-fill.js.map +1 -1
  78. package/lib/shared/icons/icon-mapping.d.ts +11 -0
  79. package/lib/shared/icons/icon-mapping.js +11 -0
  80. package/lib/shared/icons/icon-mapping.js.map +1 -1
  81. package/lib/shared/modals/CometChatAIAssistantTools.d.ts +47 -0
  82. package/lib/shared/modals/CometChatAIAssistantTools.js +44 -0
  83. package/lib/shared/modals/CometChatAIAssistantTools.js.map +1 -0
  84. package/lib/shared/modals/StreamMessage.d.ts +4 -0
  85. package/lib/shared/modals/StreamMessage.js +11 -0
  86. package/lib/shared/modals/StreamMessage.js.map +1 -0
  87. package/lib/shared/modals/index.d.ts +3 -1
  88. package/lib/shared/modals/index.js +3 -1
  89. package/lib/shared/modals/index.js.map +1 -1
  90. package/lib/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.d.ts +126 -0
  91. package/lib/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
  92. package/lib/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
  93. package/lib/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
  94. package/lib/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
  95. package/lib/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -1
  96. package/lib/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
  97. package/lib/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
  98. package/lib/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
  99. package/lib/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
  100. package/lib/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
  101. package/lib/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
  102. package/lib/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
  103. package/lib/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
  104. package/lib/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
  105. package/lib/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
  106. package/lib/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
  107. package/lib/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
  108. package/lib/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
  109. package/lib/shared/services/stream-message.service.d.ts +84 -0
  110. package/lib/shared/services/stream-message.service.js +406 -0
  111. package/lib/shared/services/stream-message.service.js.map +1 -0
  112. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.d.ts +9 -0
  113. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js +248 -0
  114. package/lib/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.js.map +1 -0
  115. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.d.ts +3 -0
  116. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js +4 -0
  117. package/lib/shared/views/CometChatAIAssistantMessageBubble/index.js.map +1 -0
  118. package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js +5 -2
  119. package/lib/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.js.map +1 -1
  120. package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js +1 -1
  121. package/lib/shared/views/CometChatImageBubble/CometChatImageLoader.js.map +1 -1
  122. package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js +52 -32
  123. package/lib/shared/views/CometChatImageViewerModal/ImageViewerModal.js.map +1 -1
  124. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.d.ts +10 -0
  125. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js +54 -0
  126. package/lib/shared/views/CometChatSendButtonView/CometChatSendButtonView.js.map +1 -0
  127. package/lib/shared/views/CometChatSendButtonView/index.d.ts +1 -0
  128. package/lib/shared/views/CometChatSendButtonView/index.js +2 -0
  129. package/lib/shared/views/CometChatSendButtonView/index.js.map +1 -0
  130. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.d.ts +8 -0
  131. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js +436 -0
  132. package/lib/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.js.map +1 -0
  133. package/lib/shared/views/CometChatStreamMessageBubble/index.d.ts +3 -0
  134. package/lib/shared/views/CometChatStreamMessageBubble/index.js +3 -0
  135. package/lib/shared/views/CometChatStreamMessageBubble/index.js.map +1 -0
  136. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.d.ts +14 -6
  137. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js +82 -57
  138. package/lib/shared/views/CometChatTextBubble/CometChatTextBubble.js.map +1 -1
  139. package/lib/theme/context.d.ts +96 -15
  140. package/lib/theme/type.d.ts +14 -1
  141. package/package.json +6 -3
  142. package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +627 -0
  143. package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +228 -0
  144. package/src/CometChatAIAssistantChatHistory/index.ts +2 -0
  145. package/src/CometChatAIAssistantChatHistory/style.ts +160 -0
  146. package/src/CometChatConversations/CometChatConversations.tsx +36 -10
  147. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +137 -19
  148. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +106 -18
  149. package/src/CometChatMessageList/CometChatMessageList.tsx +721 -116
  150. package/src/CometChatMessageList/style.ts +74 -2
  151. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +13 -29
  152. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +8 -5
  153. package/src/extensions/Polls/Polls.tsx +50 -22
  154. package/src/index.ts +31 -1
  155. package/src/shared/constants/UIKitConstants.ts +17 -0
  156. package/src/shared/events/CometChatMessageEvents/index.ts +3 -1
  157. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +3 -0
  158. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
  159. package/src/shared/events/ListenerInitializer.ts +6 -1
  160. package/src/shared/events/messages.ts +1 -0
  161. package/src/shared/framework/DataSource.ts +4 -2
  162. package/src/shared/framework/DataSourceDecorator.tsx +10 -2
  163. package/src/shared/framework/MessageDataSource.tsx +75 -2
  164. package/src/shared/icons/Icon.tsx +1 -1
  165. package/src/shared/icons/components/ai-chat-history.tsx +21 -0
  166. package/src/shared/icons/components/ai-copy-option.tsx +21 -0
  167. package/src/shared/icons/components/ai-new-chat.tsx +21 -0
  168. package/src/shared/icons/components/ai-send-button.tsx +24 -0
  169. package/src/shared/icons/components/right-arrow.tsx +13 -0
  170. package/src/shared/icons/components/stop-fill.tsx +14 -12
  171. package/src/shared/icons/icon-mapping.tsx +14 -0
  172. package/src/shared/modals/CometChatAIAssistantTools.ts +65 -0
  173. package/src/shared/modals/StreamMessage.ts +12 -0
  174. package/src/shared/modals/index.ts +5 -1
  175. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +7 -1
  176. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +7 -1
  177. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +7 -1
  178. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +7 -1
  179. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +7 -2
  180. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +7 -1
  181. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +7 -1
  182. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +7 -1
  183. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +7 -1
  184. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +7 -1
  185. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +7 -1
  186. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +7 -1
  187. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +7 -1
  188. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +7 -1
  189. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +7 -1
  190. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +7 -1
  191. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +7 -1
  192. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +7 -1
  193. package/src/shared/services/stream-message.service.ts +470 -0
  194. package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +262 -0
  195. package/src/shared/views/CometChatAIAssistantMessageBubble/index.ts +4 -0
  196. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -1
  197. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
  198. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +57 -45
  199. package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +86 -0
  200. package/src/shared/views/CometChatSendButtonView/index.ts +1 -0
  201. package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +493 -0
  202. package/src/shared/views/CometChatStreamMessageBubble/index.ts +9 -0
  203. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +121 -74
  204. package/src/theme/type.ts +14 -1
  205. package/lib/shared/resources/CometChatLocalize/CometChatLocalize.d.ts +0 -79
  206. package/lib/shared/resources/CometChatLocalize/CometChatLocalize.js +0 -152
  207. package/lib/shared/resources/CometChatLocalize/CometChatLocalize.js.map +0 -1
  208. package/lib/shared/resources/CometChatLocalize/index.d.ts +0 -2
  209. package/lib/shared/resources/CometChatLocalize/index.js +0 -3
  210. package/lib/shared/resources/CometChatLocalize/index.js.map +0 -1
  211. package/lib/shared/resources/CometChatLocalize/resources/ar/translation.json +0 -447
  212. package/lib/shared/resources/CometChatLocalize/resources/de/translation.json +0 -447
  213. package/lib/shared/resources/CometChatLocalize/resources/en/translation.json +0 -447
  214. package/lib/shared/resources/CometChatLocalize/resources/es/translation.json +0 -447
  215. package/lib/shared/resources/CometChatLocalize/resources/fr/translation.json +0 -446
  216. package/lib/shared/resources/CometChatLocalize/resources/hi/translation.json +0 -447
  217. package/lib/shared/resources/CometChatLocalize/resources/hu/translation.json +0 -447
  218. package/lib/shared/resources/CometChatLocalize/resources/lt/translation.json +0 -447
  219. package/lib/shared/resources/CometChatLocalize/resources/ms/translation.json +0 -447
  220. package/lib/shared/resources/CometChatLocalize/resources/pt/translation.json +0 -447
  221. package/lib/shared/resources/CometChatLocalize/resources/ru/translation.json +0 -447
  222. package/lib/shared/resources/CometChatLocalize/resources/sv/translation.json +0 -447
  223. package/lib/shared/resources/CometChatLocalize/resources/zh/translation.json +0 -447
  224. package/lib/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +0 -446
  225. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.d.ts +0 -29
  226. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js +0 -29
  227. package/lib/shared/utils/CometChatMessagePreview/MessagePreviewStyle.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import React, { useLayoutEffect, useState, useEffect } from "react";
2
- import { Platform, Text, View, TouchableOpacity, } from "react-native";
1
+ import React, { useLayoutEffect, useState, useRef, useCallback } from "react";
2
+ import { Text, View, TouchableOpacity, } from "react-native";
3
3
  import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
4
4
  export const CometChatTextBubble = (props) => {
5
5
  const { textContainerStyle } = props;
@@ -7,17 +7,26 @@ export const CometChatTextBubble = (props) => {
7
7
  <CometChatTextBubbleText {...props}/>
8
8
  </View>);
9
9
  };
10
+ /**
11
+ * CometChatTextBubbleText
12
+ *
13
+ * - measure by actual container width (onLayout) so both iOS and Android measure correctly
14
+ * - robust measurement cache keyed by text+width so we don't re-measure unnecessarily
15
+ */
10
16
  export const CometChatTextBubbleText = (props) => {
11
17
  const { t } = useCometChatTranslation();
12
- const { text = "", textFormatters, textStyle } = props;
13
- const [formattedText, setFormattedText] = useState("");
14
- // This flag will be set if the text exceeds 4 lines in collapsed mode.
15
- const [isTruncated, setIsTruncated] = useState(false);
16
- const [expanded, setExpanded] = useState(false);
17
- // States to store measured heights for iOS fallback.
18
- const [fullHeight, setFullHeight] = useState(0);
19
- const [collapsedHeight, setCollapsedHeight] = useState(0);
20
- // Format text if any formatters are provided.
18
+ const { text = "", textFormatters, textStyle, collapseLines = 4, toggleContainerStyle, toggleTextStyle, } = props;
19
+ const [formattedText, setFormattedText] = useState(text);
20
+ const [isExpanded, setIsExpanded] = useState(false);
21
+ const [isTruncatable, setIsTruncatable] = useState(false);
22
+ // store container width for accurate measurement
23
+ const [containerWidth, setContainerWidth] = useState(null);
24
+ /**
25
+ * measuredCache helps avoid re-measuring if the same text+width was already measured.
26
+ * Structure: { key: string } where key = `${text}::${width}`
27
+ */
28
+ const measuredCacheRef = useRef({});
29
+ // Only recompute formattedText when the text or textFormatters actually change.
21
30
  useLayoutEffect(() => {
22
31
  let finalText = text;
23
32
  if (textFormatters && textFormatters.length) {
@@ -25,59 +34,75 @@ export const CometChatTextBubbleText = (props) => {
25
34
  finalText = textFormatters[i].getFormattedText(finalText);
26
35
  }
27
36
  }
28
- setFormattedText(finalText);
29
- // Don't reset the truncated flag when text is the same, only when text actually changes
30
- // This preserves the expanded state when messages are updated for reactions, etc.
31
- }, [text, textFormatters]);
32
- // For Android, onTextLayout reliably provides the number of lines.
33
- const handleTextLayout = (event) => {
34
- const { lines } = event.nativeEvent;
35
- if (lines.length > 4) {
36
- // Only set to true, never reset to false when a message is updated
37
- // This preserves the truncated state when the message is updated (e.g., reactions added)
38
- setIsTruncated(true);
37
+ // If text content actually changed, update formattedText and reset expansion.
38
+ // Do NOT reset on other prop changes (so adding reaction won't collapse/lose toggle).
39
+ if (finalText !== formattedText) {
40
+ setFormattedText(finalText);
41
+ setIsExpanded(false);
42
+ // measurement cache can stay, but remove entries for previous text (optional)
43
+ // measuredCacheRef.current = {}; // not required, we'll rely on keying by text+width
39
44
  }
40
- // We no longer set isTruncated to false here to preserve state during updates
41
- };
42
- // onLayout callback for the collapsed text (iOS)
43
- const handleCollapsedLayout = (event) => {
44
- setCollapsedHeight(event.nativeEvent.layout.height);
45
- };
46
- // onLayout callback for the hidden full text (iOS)
47
- const handleFullTextLayout = (event) => {
48
- setFullHeight(event.nativeEvent.layout.height);
49
- };
50
- // For iOS, when not expanded, compare the hidden full height with the collapsed text height.
51
- useEffect(() => {
52
- if (Platform.OS === "ios" && !expanded && fullHeight && collapsedHeight) {
53
- setIsTruncated(fullHeight > collapsedHeight);
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ }, [
47
+ text /* only textFormatters intentionally omitted from deps if stable; if not stable include it */,
48
+ ]);
49
+ // handler to capture container width whenever layout changes
50
+ const onContainerLayout = useCallback((e) => {
51
+ const w = Math.round(e.nativeEvent.layout.width);
52
+ if (w && w !== containerWidth) {
53
+ setContainerWidth(w);
54
+ // Do NOT clear isExpanded here — measurement may change truncation but we want to
55
+ // preserve user's expanded/collapsed state unless the text itself changed.
54
56
  }
55
- // Do not update isTruncated when expanded is true so that the toggle remains.
56
- }, [fullHeight, collapsedHeight, expanded]);
57
- return (<View>
58
- <Text
59
- // Use text content in the key to ensure it only re-renders when text changes
60
- key={`${expanded ? "expanded" : "collapsed"}-${text}`} style={textStyle}
61
- // Android uses onTextLayout for measuring lines.
62
- onTextLayout={Platform.OS !== "ios" ? handleTextLayout : undefined}
63
- // iOS: only measure collapsed height when not expanded.
64
- onLayout={Platform.OS === "ios" && !expanded ? handleCollapsedLayout : undefined} numberOfLines={expanded ? undefined : 4} ellipsizeMode="tail">
57
+ }, [containerWidth]);
58
+ // Called when hidden text is laid out; use it to determine lines count
59
+ const onMeasuredTextLayout = (e) => {
60
+ // We rely on containerWidth + formattedText as the measurement key
61
+ const key = `${formattedText}::${containerWidth ?? 0}`;
62
+ // If we've already measured this text at this width, skip
63
+ if (measuredCacheRef.current[key])
64
+ return;
65
+ const lines = e.nativeEvent.lines;
66
+ const isNowTruncatable = !!(lines && lines.length > collapseLines);
67
+ setIsTruncatable(isNowTruncatable);
68
+ measuredCacheRef.current[key] = isNowTruncatable;
69
+ };
70
+ const toggle = () => setIsExpanded((v) => !v);
71
+ /**
72
+ * Hidden measurement `Text`:
73
+ * - we render it only when we have containerWidth (so it can measure correctly)
74
+ * - style uses same font metrics as visible text because it inherits textStyle
75
+ * - opacity: 0 and position absolute so it does not affect layout
76
+ *
77
+ * Important: We key the hidden Text by formattedText + containerWidth so React remounts
78
+ * it and triggers onTextLayout when either changes.
79
+ */
80
+ const hiddenTextKey = `${formattedText}::${containerWidth ?? 0}`;
81
+ return (<View onLayout={onContainerLayout}>
82
+ {/* Hidden measurement text: only meaningful after we know container width */}
83
+ {containerWidth ? (<Text key={hiddenTextKey}
84
+ // make sure the hidden text has same width as container
85
+ style={[
86
+ // width must be exact to get consistent wrapping on both platforms
87
+ { position: "absolute", left: 0, top: -10000, width: containerWidth, opacity: 0 },
88
+ textStyle,
89
+ ]} onTextLayout={onMeasuredTextLayout} accessible={false} importantForAccessibility='no-hide-descendants'>
90
+ {formattedText}
91
+ </Text>) : null}
92
+
93
+ {/* Visible text */}
94
+ <Text style={textStyle} numberOfLines={isExpanded ? undefined : collapseLines} ellipsizeMode='tail'>
65
95
  {formattedText}
66
96
  </Text>
67
97
 
68
- {/* Hidden full text for iOS measurement */}
69
- {Platform.OS === "ios" && (<Text style={[textStyle, { position: "absolute", opacity: 0, zIndex: -1 }]} onLayout={handleFullTextLayout}>
70
- {formattedText}
71
- </Text>)}
72
-
73
- {/* Only show the toggle if the text was truncated in collapsed mode */}
74
- {isTruncated && (<View style={{ alignItems: "flex-end", marginTop: 8 }}>
75
- <TouchableOpacity onPress={() => setExpanded(!expanded)}>
76
- <Text style={textStyle}>
77
- {expanded ? t("SHOW_LESS") : t("READ_MORE")}
98
+ {/* Toggle (only when truncation is needed) */}
99
+ {isTruncatable ? (<View style={[{ alignItems: "flex-end", marginTop: 6 }, toggleContainerStyle]}>
100
+ <TouchableOpacity onPress={toggle} accessibilityRole='button'>
101
+ <Text style={[{ alignSelf: "flex-end" }, textStyle, toggleTextStyle]}>
102
+ {isExpanded ? t("SHOW_LESS") : t("READ_MORE")}
78
103
  </Text>
79
104
  </TouchableOpacity>
80
- </View>)}
105
+ </View>) : null}
81
106
  </View>);
82
107
  };
83
108
  export default CometChatTextBubble;
@@ -1 +1 @@
1
- {"version":3,"file":"CometChatTextBubble.js","sourceRoot":"","sources":["../../../../src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACp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YAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,CACrB;cAAA,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAC7C;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,gBAAgB,CACpB;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"CometChatTextBubble.js","sourceRoot":"","sources":["../../../../src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAEL,IAAI,EAEJ,IAAI,EAEJ,gBAAgB,GAGjB,MAAM,cAAc,CAAC;AAMtB,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAoB/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAmC,EAAE,EAAE;IACzE,MAAM,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAErC,OAAO,CACL,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAC9B;MAAA,CAAC,uBAAuB,CAAC,IAAI,KAAK,CAAC,EACrC;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,KAA+D,EAC/D,EAAE;IACF,MAAM,EAAE,CAAC,EAAE,GAAG,uBAAuB,EAAE,CAAC;IACxC,MAAM,EACJ,IAAI,GAAG,EAAE,EACT,cAAc,EACd,SAAS,EACT,aAAa,GAAG,CAAC,EACjB,oBAAoB,EACpB,eAAe,GAChB,GAAG,KAAK,CAAC;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import("react").Context<{
919
919
  containerBackgroundColor?: import("react-native").ColorValue;
920
920
  } | undefined;
921
921
  } | undefined;
922
+ chatHistoryStyles?: {
923
+ containerStyle?: import("react-native").ViewStyle | undefined;
924
+ headerStyle?: import("react-native").ViewStyle | undefined;
925
+ headerContentStyle?: import("react-native").ViewStyle | undefined;
926
+ headerTitleStyle?: import("react-native").TextStyle | undefined;
927
+ closeButtonStyle?: import("react-native").ViewStyle | undefined;
928
+ closeButtonTextStyle?: import("react-native").TextStyle | undefined;
929
+ newChatButtonStyle?: import("react-native").ViewStyle | undefined;
930
+ newChatTextStyle?: import("react-native").TextStyle | undefined;
931
+ listContainerStyle?: import("react-native").ViewStyle | undefined;
932
+ sectionHeaderStyle?: import("react-native").ViewStyle | undefined;
933
+ sectionHeaderTextStyle?: import("react-native").TextStyle | undefined;
934
+ messageItemStyle?: import("react-native").ViewStyle | undefined;
935
+ messageTextStyle?: import("react-native").TextStyle | undefined;
936
+ centerContainerStyle?: import("react-native").ViewStyle | undefined;
937
+ stateTitleStyle?: import("react-native").TextStyle | undefined;
938
+ stateTextStyle?: import("react-native").TextStyle | undefined;
939
+ footerLoaderStyle?: import("react-native").ViewStyle | undefined;
940
+ skeletonStyle?: {
941
+ linearGradientColors?: [(string | undefined)?, (string | undefined)?] | undefined;
942
+ shimmerBackgroundColor?: import("react-native").ColorValue | undefined;
943
+ shimmerOpacity?: number | undefined;
944
+ speed?: number | undefined;
945
+ } | undefined;
946
+ } | undefined;
922
947
  groupStyles?: {
923
948
  containerStyle?: import("react-native").ViewStyle | undefined;
924
949
  onlineStatusColor?: import("react-native").ColorValue | undefined;
@@ -2594,6 +2619,20 @@ export declare const CompThemeContext: import("react").Context<{
2594
2619
  translatedTextContainerStyle?: import("react-native").ViewStyle | undefined;
2595
2620
  translatedTextDividerStyle?: import("react-native").ViewStyle | undefined;
2596
2621
  } | undefined;
2622
+ assistantBubbleStyles?: {
2623
+ containerStyle?: import("react-native").ViewStyle | undefined;
2624
+ avatarStyle?: {
2625
+ containerStyle?: import("react-native").ViewStyle | undefined;
2626
+ textStyle?: import("react-native").TextStyle | undefined;
2627
+ imageStyle?: import("react-native").ImageStyle | undefined;
2628
+ } | undefined;
2629
+ textStyle?: import("react-native").TextStyle | undefined;
2630
+ textContainerStyle?: import("react-native").ViewStyle | undefined;
2631
+ placeholderTextStyle?: import("react-native").TextStyle | undefined;
2632
+ copyButtonStyle?: import("react-native").ViewStyle | undefined;
2633
+ errorContainerStyle?: import("react-native").ViewStyle | undefined;
2634
+ errorTextStyle?: import("react-native").TextStyle | undefined;
2635
+ } | undefined;
2597
2636
  imageBubbleStyles?: {
2598
2637
  containerStyle?: import("react-native").ViewStyle | undefined;
2599
2638
  threadedMessageStyle?: {
@@ -3224,6 +3263,20 @@ export declare const CompThemeContext: import("react").Context<{
3224
3263
  translatedTextContainerStyle?: import("react-native").ViewStyle | undefined;
3225
3264
  translatedTextDividerStyle?: import("react-native").ViewStyle | undefined;
3226
3265
  } | undefined;
3266
+ assistantBubbleStyles?: {
3267
+ containerStyle?: import("react-native").ViewStyle | undefined;
3268
+ avatarStyle?: {
3269
+ containerStyle?: import("react-native").ViewStyle | undefined;
3270
+ textStyle?: import("react-native").TextStyle | undefined;
3271
+ imageStyle?: import("react-native").ImageStyle | undefined;
3272
+ } | undefined;
3273
+ textStyle?: import("react-native").TextStyle | undefined;
3274
+ textContainerStyle?: import("react-native").ViewStyle | undefined;
3275
+ placeholderTextStyle?: import("react-native").TextStyle | undefined;
3276
+ copyButtonStyle?: import("react-native").ViewStyle | undefined;
3277
+ errorContainerStyle?: import("react-native").ViewStyle | undefined;
3278
+ errorTextStyle?: import("react-native").TextStyle | undefined;
3279
+ } | undefined;
3227
3280
  imageBubbleStyles?: {
3228
3281
  containerStyle?: import("react-native").ViewStyle | undefined;
3229
3282
  threadedMessageStyle?: {
@@ -4059,6 +4112,20 @@ export declare const CompThemeContext: import("react").Context<{
4059
4112
  translatedTextContainerStyle?: import("react-native").ViewStyle | undefined;
4060
4113
  translatedTextDividerStyle?: import("react-native").ViewStyle | undefined;
4061
4114
  } | undefined;
4115
+ assistantBubbleStyles?: {
4116
+ containerStyle?: import("react-native").ViewStyle | undefined;
4117
+ avatarStyle?: {
4118
+ containerStyle?: import("react-native").ViewStyle | undefined;
4119
+ textStyle?: import("react-native").TextStyle | undefined;
4120
+ imageStyle?: import("react-native").ImageStyle | undefined;
4121
+ } | undefined;
4122
+ textStyle?: import("react-native").TextStyle | undefined;
4123
+ textContainerStyle?: import("react-native").ViewStyle | undefined;
4124
+ placeholderTextStyle?: import("react-native").TextStyle | undefined;
4125
+ copyButtonStyle?: import("react-native").ViewStyle | undefined;
4126
+ errorContainerStyle?: import("react-native").ViewStyle | undefined;
4127
+ errorTextStyle?: import("react-native").TextStyle | undefined;
4128
+ } | undefined;
4062
4129
  stickerBubbleStyles?: {
4063
4130
  containerStyle?: import("react-native").ViewStyle | undefined;
4064
4131
  threadedMessageStyle?: {
@@ -4399,6 +4466,20 @@ export declare const CompThemeContext: import("react").Context<{
4399
4466
  translatedTextContainerStyle?: import("react-native").ViewStyle | undefined;
4400
4467
  translatedTextDividerStyle?: import("react-native").ViewStyle | undefined;
4401
4468
  } | undefined;
4469
+ assistantBubbleStyles?: {
4470
+ containerStyle?: import("react-native").ViewStyle | undefined;
4471
+ avatarStyle?: {
4472
+ containerStyle?: import("react-native").ViewStyle | undefined;
4473
+ textStyle?: import("react-native").TextStyle | undefined;
4474
+ imageStyle?: import("react-native").ImageStyle | undefined;
4475
+ } | undefined;
4476
+ textStyle?: import("react-native").TextStyle | undefined;
4477
+ textContainerStyle?: import("react-native").ViewStyle | undefined;
4478
+ placeholderTextStyle?: import("react-native").TextStyle | undefined;
4479
+ copyButtonStyle?: import("react-native").ViewStyle | undefined;
4480
+ errorContainerStyle?: import("react-native").ViewStyle | undefined;
4481
+ errorTextStyle?: import("react-native").TextStyle | undefined;
4482
+ } | undefined;
4402
4483
  imageBubbleStyles?: {
4403
4484
  containerStyle?: import("react-native").ViewStyle | undefined;
4404
4485
  threadedMessageStyle?: {
@@ -4912,7 +4993,22 @@ export declare const CompThemeContext: import("react").Context<{
4912
4993
  } | undefined;
4913
4994
  } | undefined;
4914
4995
  outgoingMessageBubbleStyles?: {
4996
+ avatarStyle?: {
4997
+ containerStyle?: import("react-native").ViewStyle | undefined;
4998
+ textStyle?: import("react-native").TextStyle | undefined;
4999
+ imageStyle?: import("react-native").ImageStyle | undefined;
5000
+ } | undefined;
4915
5001
  containerStyle?: import("react-native").ViewStyle | undefined;
5002
+ meetCallBubbleStyles?: {
5003
+ titleStyle?: import("react-native").TextStyle | undefined;
5004
+ subtitleStyle?: import("react-native").TextStyle | undefined;
5005
+ containerStyle?: import("react-native").ViewStyle | undefined;
5006
+ iconStyle?: import("react-native").ImageStyle | undefined;
5007
+ iconContainerStyle?: import("react-native").ViewStyle | undefined;
5008
+ buttonStyle?: import("react-native").ViewStyle | undefined;
5009
+ buttonTextStyle?: import("react-native").TextStyle | undefined;
5010
+ dividerStyle?: import("react-native").ViewStyle | undefined;
5011
+ } | undefined;
4916
5012
  threadedMessageStyles?: {
4917
5013
  containerStyle?: import("react-native").ViewStyle | undefined;
4918
5014
  indicatorTextStyle?: import("react-native").TextStyle | undefined;
@@ -4923,11 +5019,6 @@ export declare const CompThemeContext: import("react").Context<{
4923
5019
  textStyle?: import("react-native").TextStyle | undefined;
4924
5020
  } | undefined;
4925
5021
  } | undefined;
4926
- avatarStyle?: {
4927
- containerStyle?: import("react-native").ViewStyle | undefined;
4928
- textStyle?: import("react-native").TextStyle | undefined;
4929
- imageStyle?: import("react-native").ImageStyle | undefined;
4930
- } | undefined;
4931
5022
  receiptStyles?: {
4932
5023
  waitIcon?: (import("react-native").ImageSourcePropType | import("react").JSX.Element) | undefined;
4933
5024
  sentIcon?: (import("react-native").ImageSourcePropType | import("react").JSX.Element) | undefined;
@@ -5341,16 +5432,6 @@ export declare const CompThemeContext: import("react").Context<{
5341
5432
  iconContainerStyle?: import("react-native").ViewStyle | undefined;
5342
5433
  dividerStyle?: import("react-native").ViewStyle | undefined;
5343
5434
  } | undefined;
5344
- meetCallBubbleStyles?: {
5345
- titleStyle?: import("react-native").TextStyle | undefined;
5346
- subtitleStyle?: import("react-native").TextStyle | undefined;
5347
- containerStyle?: import("react-native").ViewStyle | undefined;
5348
- iconStyle?: import("react-native").ImageStyle | undefined;
5349
- iconContainerStyle?: import("react-native").ViewStyle | undefined;
5350
- buttonStyle?: import("react-native").ViewStyle | undefined;
5351
- buttonTextStyle?: import("react-native").TextStyle | undefined;
5352
- dividerStyle?: import("react-native").ViewStyle | undefined;
5353
- } | undefined;
5354
5435
  stickerBubbleStyles?: {
5355
5436
  containerStyle?: import("react-native").ViewStyle | undefined;
5356
5437
  threadedMessageStyle?: {
@@ -22,6 +22,7 @@ import { CallLogsItemStyle, CallLogsStyle } from "../calls/CometChatCallLogs/sty
22
22
  import { DeepPartial } from "../shared/helper/types";
23
23
  import { DateSeparatorStyle } from "../shared/views/CometChatDateSeperator/styles";
24
24
  import { JSX } from "react";
25
+ import { ChatHistoryStyle } from "../CometChatAIAssistantChatHistory/style";
25
26
  export type BubbleStyles = {
26
27
  containerStyle: ViewStyle;
27
28
  threadedMessageStyles: DeepPartial<CometChatTheme["threadedMessageStyles"]>;
@@ -32,6 +33,7 @@ export type BubbleStyles = {
32
33
  dateReceiptContainerStyle: ViewStyle;
33
34
  senderNameTextStyles: TextStyle;
34
35
  textBubbleStyles?: DeepPartial<CometChatTheme["textBubbleStyles"]>;
36
+ assistantBubbleStyles?: DeepPartial<CometChatTheme["assistantBubbleStyles"]>;
35
37
  imageBubbleStyles?: DeepPartial<CometChatTheme["imageBubbleStyles"]>;
36
38
  videoBubbleStyles?: DeepPartial<CometChatTheme["videoBubbleStyles"]>;
37
39
  audioBubbleStyles?: DeepPartial<CometChatTheme["audioBubbleStyles"]>;
@@ -75,6 +77,7 @@ export interface CometChatTheme {
75
77
  deletedBubbleStyles?: DeletedBubbleStyle;
76
78
  messageComposerStyles: DeepPartial<MessageComposerStyle>;
77
79
  userStyles: UserStyle;
80
+ chatHistoryStyles: ChatHistoryStyle;
78
81
  groupStyles: GroupStyle;
79
82
  groupMemberStyle: GroupMemberStyle;
80
83
  actionSheetStyle: ActionSheetStyle;
@@ -326,6 +329,16 @@ export interface CometChatTheme {
326
329
  translatedTextContainerStyle: ViewStyle;
327
330
  translatedTextDividerStyle: ViewStyle;
328
331
  };
332
+ assistantBubbleStyles?: {
333
+ containerStyle: ViewStyle;
334
+ avatarStyle: CometChatTheme["avatarStyle"];
335
+ textStyle: TextStyle;
336
+ textContainerStyle?: ViewStyle;
337
+ placeholderTextStyle: TextStyle;
338
+ copyButtonStyle: ViewStyle;
339
+ errorContainerStyle: ViewStyle;
340
+ errorTextStyle: TextStyle;
341
+ };
329
342
  stickerBubbleStyles?: {
330
343
  containerStyle?: ViewStyle;
331
344
  threadedMessageStyle?: CometChatTheme["threadedMessageStyles"];
@@ -404,7 +417,7 @@ export interface CometChatTheme {
404
417
  };
405
418
  dateSeparatorStyle?: DateSeparatorStyle;
406
419
  incomingMessageBubbleStyles: DeepPartial<BubbleStyles>;
407
- outgoingMessageBubbleStyles: DeepPartial<BubbleStyles>;
420
+ outgoingMessageBubbleStyles: DeepPartial<Omit<BubbleStyles, 'assistantBubbleStyles'>>;
408
421
  groupActionBubbleStyles: DeepPartial<CometChatTheme["groupActionBubbleStyles"]>;
409
422
  callActionBubbleStyles: DeepPartial<CallActionBubbleStyles>;
410
423
  messageInformationStyles: DeepPartial<CometChatTheme["messageInformationStyles"]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "5.1.1",
3
+ "version": "5.2.0",
4
4
  "description": "Ready-to-use Chat UI Components for React Native",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -66,8 +66,10 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "@types/prop-types": "^15.7.14",
69
- "dayjs": "^1.11.18",
70
69
  "prop-types": "^15.8.1",
70
+ "react-native-markdown-display": "^7.0.2",
71
+ "rxjs": "^7.8.2",
72
+ "dayjs": "^1.11.18",
71
73
  "react-native-localize": "^3.5.2"
72
74
  },
73
75
  "peerDependencies": {
@@ -77,7 +79,8 @@
77
79
  "react-native": "*",
78
80
  "react-native-gesture-handler": "*",
79
81
  "react-native-svg": "*",
80
- "react-native-video": "*"
82
+ "react-native-video": "*",
83
+ "react-native-localize": "*"
81
84
  },
82
85
  "jest": {
83
86
  "preset": "react-native",