@cometchat/chat-uikit-react-native 5.3.2 → 5.3.4

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 (40) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/CometChatWebView.java +9 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +16 -10
  3. package/ios/RichTextEditorView.swift +49 -2
  4. package/ios/WebViewManager.m +13 -2
  5. package/package.json +1 -1
  6. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +50 -30
  7. package/src/CometChatConversations/CometChatConversations.tsx +23 -42
  8. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +3 -3
  9. package/src/CometChatMessageList/CometChatMessageList.tsx +53 -11
  10. package/src/shared/constants/UIKitConstants.ts +1 -1
  11. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +6 -4
  12. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +93 -27
  13. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -2
  14. package/src/shared/framework/MessageDataSource.tsx +10 -0
  15. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +2 -1
  16. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +2 -1
  17. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +2 -1
  18. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +2 -1
  19. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +2 -1
  20. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +2 -1
  21. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +2 -1
  22. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +2 -1
  23. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +2 -1
  24. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +2 -1
  25. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +2 -1
  26. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +2 -1
  27. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +2 -1
  28. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +2 -1
  29. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +2 -1
  30. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +2 -1
  31. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +2 -1
  32. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +2 -1
  33. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +26 -23
  34. package/src/shared/utils/MarkdownUtils.ts +6 -1
  35. package/src/shared/utils/MessageUtils.tsx +66 -1
  36. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +1 -0
  37. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +26 -10
  38. package/src/theme/CometChatThemeHelper.ts +9 -0
  39. package/src/theme/default/color/dark.ts +13 -0
  40. package/src/theme/default/color/light.ts +13 -1
@@ -1,5 +1,6 @@
1
1
  package com.reactnativecometchatuikit;
2
2
 
3
+ import android.os.Build;
3
4
  import android.os.Bundle;
4
5
  import android.util.Log;
5
6
  import android.view.ViewGroup;
@@ -15,8 +16,16 @@ public class CometChatWebView extends AppCompatActivity {
15
16
  protected void onCreate(@Nullable Bundle savedInstanceState) {
16
17
  super.onCreate(savedInstanceState);
17
18
  getSupportActionBar().hide();
19
+
20
+ // On API 30+ the default changed to edge-to-edge; restore classic behavior
21
+ // so the layout respects system bar insets (status bar, navigation bar).
22
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
23
+ getWindow().setDecorFitsSystemWindows(true);
24
+ }
25
+
18
26
  String urlToLoad = getIntent().getStringExtra("load_url");
19
27
  RelativeLayout layout = new RelativeLayout(this);
28
+ layout.setFitsSystemWindows(true);
20
29
  layout.setLayoutParams(new RelativeLayout.LayoutParams(
21
30
  ViewGroup.LayoutParams.MATCH_PARENT,
22
31
  ViewGroup.LayoutParams.MATCH_PARENT
@@ -3590,23 +3590,29 @@ class RichTextEditorView(context: Context) : androidx.appcompat.widget.AppCompat
3590
3590
 
3591
3591
  // ==================== Helper Methods ====================
3592
3592
 
3593
- /// Returns sub-ranges of `start..<end` that do NOT overlap any MentionSpan.
3594
- /// Used to skip mentions when applying inline formatting (Req 6.1).
3593
+ /// Returns sub-ranges of `start..<end` that do NOT overlap any MentionSpan or URLSpan.
3594
+ /// Used to skip mentions and links when applying inline formatting (Req 6.1).
3595
3595
  private fun nonMentionRanges(start: Int, end: Int, spannable: Spanned): List<IntRange> {
3596
3596
  val mentionSpans = spannable.getSpans(start, end, MentionSpan::class.java)
3597
- if (mentionSpans.isEmpty()) return listOf(start until end)
3597
+ val urlSpans = spannable.getSpans(start, end, URLSpan::class.java)
3598
3598
 
3599
- val mentionRanges = mentionSpans.map {
3600
- spannable.getSpanStart(it) until spannable.getSpanEnd(it)
3601
- }.sortedBy { it.first }
3599
+ val protectedRanges = mutableListOf<IntRange>()
3600
+ mentionSpans.forEach {
3601
+ protectedRanges.add(spannable.getSpanStart(it) until spannable.getSpanEnd(it))
3602
+ }
3603
+ urlSpans.forEach {
3604
+ protectedRanges.add(spannable.getSpanStart(it) until spannable.getSpanEnd(it))
3605
+ }
3606
+ if (protectedRanges.isEmpty()) return listOf(start until end)
3607
+ protectedRanges.sortBy { it.first }
3602
3608
 
3603
3609
  val result = mutableListOf<IntRange>()
3604
3610
  var cursor = start
3605
- for (mr in mentionRanges) {
3606
- if (cursor < mr.first) {
3607
- result.add(cursor until mr.first)
3611
+ for (pr in protectedRanges) {
3612
+ if (cursor < pr.first) {
3613
+ result.add(cursor until pr.first)
3608
3614
  }
3609
- cursor = mr.last + 1 // IntRange.last is inclusive; advance past the mention
3615
+ cursor = pr.last + 1 // IntRange.last is inclusive; advance past the protected range
3610
3616
  }
3611
3617
  if (cursor < end) {
3612
3618
  result.add(cursor until end)
@@ -1329,6 +1329,7 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
1329
1329
 
1330
1330
  updateToolbarPosition()
1331
1331
  updateToolbarButtonStates()
1332
+ emitActiveStyles()
1332
1333
 
1333
1334
  // Strip mention-specific attributes from typingAttributes when cursor
1334
1335
  // lands adjacent to (or inherits from) a deleted mention.
@@ -3060,8 +3061,49 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
3060
3061
  let regularFont = UIFont.systemFont(ofSize: 16)
3061
3062
 
3062
3063
  mutableAttrString.enumerateAttribute(.font, in: range, options: []) { value, attrRange, _ in
3063
- let newFont = hasMonospace ? regularFont : monoFont
3064
- mutableAttrString.addAttribute(.font, value: newFont, range: attrRange)
3064
+ if hasMonospace {
3065
+ // Removing code: restore to system font but preserve bold/italic traits
3066
+ if let existingFont = value as? UIFont {
3067
+ let traits = existingFont.fontDescriptor.symbolicTraits
3068
+ var newFont = regularFont
3069
+ if traits.contains(.traitBold) && traits.contains(.traitItalic) {
3070
+ if let desc = regularFont.fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic]) {
3071
+ newFont = UIFont(descriptor: desc, size: 16)
3072
+ }
3073
+ } else if traits.contains(.traitBold) {
3074
+ newFont = UIFont.boldSystemFont(ofSize: 16)
3075
+ } else if traits.contains(.traitItalic) {
3076
+ newFont = UIFont.italicSystemFont(ofSize: 16)
3077
+ }
3078
+ mutableAttrString.addAttribute(.font, value: newFont, range: attrRange)
3079
+ } else {
3080
+ mutableAttrString.addAttribute(.font, value: regularFont, range: attrRange)
3081
+ }
3082
+ } else {
3083
+ // Adding code: switch to monospace but preserve bold/italic traits
3084
+ if let existingFont = value as? UIFont {
3085
+ let traits = existingFont.fontDescriptor.symbolicTraits
3086
+ var newFont = monoFont
3087
+ if traits.contains(.traitBold) && traits.contains(.traitItalic) {
3088
+ // Monospace bold italic
3089
+ if let desc = monoFont.fontDescriptor.withSymbolicTraits([.traitBold, .traitItalic, .traitMonoSpace]) {
3090
+ newFont = UIFont(descriptor: desc, size: 15)
3091
+ } else {
3092
+ // Fallback: at least try bold monospace
3093
+ newFont = UIFont.monospacedSystemFont(ofSize: 15, weight: .bold)
3094
+ }
3095
+ } else if traits.contains(.traitBold) {
3096
+ newFont = UIFont.monospacedSystemFont(ofSize: 15, weight: .bold)
3097
+ } else if traits.contains(.traitItalic) {
3098
+ if let desc = monoFont.fontDescriptor.withSymbolicTraits([.traitItalic, .traitMonoSpace]) {
3099
+ newFont = UIFont(descriptor: desc, size: 15)
3100
+ }
3101
+ }
3102
+ mutableAttrString.addAttribute(.font, value: newFont, range: attrRange)
3103
+ } else {
3104
+ mutableAttrString.addAttribute(.font, value: monoFont, range: attrRange)
3105
+ }
3106
+ }
3065
3107
  }
3066
3108
 
3067
3109
  if !hasMonospace {
@@ -3079,6 +3121,7 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
3079
3121
  saveToUndoStack()
3080
3122
  sendContentChange()
3081
3123
  emitActiveStyles()
3124
+ updateToolbarButtonStates()
3082
3125
  }
3083
3126
 
3084
3127
  func toggleHighlight(color: String?) {
@@ -3626,6 +3669,8 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
3626
3669
  isInternalChange = false
3627
3670
  saveToUndoStack()
3628
3671
  sendContentChange()
3672
+ emitActiveStyles()
3673
+ updateToolbarButtonStates()
3629
3674
  }
3630
3675
 
3631
3676
  private func toggleAttribute(key: NSAttributedString.Key, value: Int) {
@@ -3701,6 +3746,8 @@ class RichTextEditorView: UIView, UITextViewDelegate, UIGestureRecognizerDelegat
3701
3746
  isInternalChange = false
3702
3747
  saveToUndoStack()
3703
3748
  sendContentChange()
3749
+ emitActiveStyles()
3750
+ updateToolbarButtonStates()
3704
3751
  }
3705
3752
 
3706
3753
  /// Applies pending style toggles to typingAttributes so newly typed text inherits them.
@@ -13,14 +13,25 @@ RCT_EXPORT_METHOD(openUrl: (NSString *) url) {
13
13
 
14
14
  // Create a web view controller
15
15
  UIViewController *webViewController = [[UIViewController alloc] init];
16
+ webViewController.view.backgroundColor = [UIColor whiteColor];
16
17
 
17
- // Create a web view
18
- WKWebView *webView = [[WKWebView alloc] initWithFrame:webViewController.view.bounds];
18
+ // Create a web view with CGRectZero — Auto Layout will size it
19
+ WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero];
20
+ webView.translatesAutoresizingMaskIntoConstraints = NO;
19
21
  [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]];
20
22
 
21
23
  // Add the web view to the view controller's view
22
24
  [webViewController.view addSubview:webView];
23
25
 
26
+ // Constrain to safe area layout guide so content respects notch and home indicator
27
+ UILayoutGuide *safeArea = webViewController.view.safeAreaLayoutGuide;
28
+ [NSLayoutConstraint activateConstraints:@[
29
+ [webView.topAnchor constraintEqualToAnchor:safeArea.topAnchor],
30
+ [webView.bottomAnchor constraintEqualToAnchor:safeArea.bottomAnchor],
31
+ [webView.leadingAnchor constraintEqualToAnchor:safeArea.leadingAnchor],
32
+ [webView.trailingAnchor constraintEqualToAnchor:safeArea.trailingAnchor]
33
+ ]];
34
+
24
35
  // Present the web view controller
25
36
  UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController;
26
37
  [rootViewController presentViewController:webViewController animated:YES completion:^{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "5.3.2",
3
+ "version": "5.3.4",
4
4
  "description": "Ready-to-use Chat UI Components for React Native",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -202,6 +202,7 @@ const ActionSheetBoard = (props: any) => {
202
202
  ref={sheetRef}
203
203
  onClose={onClose}
204
204
  isOpen={shouldShow}
205
+ doNotOccupyEntireHeight={true}
205
206
  >
206
207
  <CometChatActionSheet actions={options} style={style} />
207
208
  </CometChatBottomSheet>
@@ -248,12 +249,12 @@ const RecordAudio = (props: any) => {
248
249
  * MessagePreviewTray component for displaying edit/reply message preview (v5 pattern)
249
250
  */
250
251
  const MessagePreviewTray = (props: any) => {
251
- const { shouldShow = false, text = '', onClose = () => {}, title = '' } = props;
252
+ const { shouldShow = false, message = null, onClose = () => {}, title = '' } = props;
252
253
  if (!shouldShow) return null;
253
254
  return (
254
255
  <CometChatMessagePreview
255
256
  messagePreviewTitle={title}
256
- messagePreviewSubtitle={stripMarkdown(text)}
257
+ message={message}
257
258
  onCloseClick={onClose}
258
259
  />
259
260
  );
@@ -1200,6 +1201,8 @@ export const CometChatCompactMessageComposer = React.forwardRef(
1200
1201
  // Mic/sticker animation: single Animated.Value drives mic slide + fade
1201
1202
  // 0 = idle (mic visible), 1 = typing (mic hidden)
1202
1203
  const micAnimValue = React.useRef(new Animated.Value(0)).current;
1204
+ // Separate Animated.Value for mic layout width collapse (JS driver, supports layout props)
1205
+ const micWidthAnim = React.useRef(new Animated.Value(1)).current;
1203
1206
  const [messagePreview, setMessagePreview] = React.useState<{ message: any; mode: string } | null>(null);
1204
1207
  const [showMentionList, setShowMentionList] = React.useState(false);
1205
1208
  const [mentionsSearchData, setMentionsSearchData] = React.useState<Array<SuggestionItem>>([]);
@@ -2965,9 +2968,10 @@ export const CometChatCompactMessageComposer = React.forwardRef(
2965
2968
 
2966
2969
  mentionMap.current = newMentionMap;
2967
2970
 
2968
- // Set the message preview state with resolved text (display names, not tokens)
2971
+ // Set the message preview state with original message object
2972
+ // (preserves SDK prototype chain for CometChatMessagePreview formatting)
2969
2973
  setMessagePreview({
2970
- message: { ...message, text: resolvedText },
2974
+ message: message,
2971
2975
  mode: ConversationOptionConstants.edit,
2972
2976
  });
2973
2977
 
@@ -3923,11 +3927,21 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3923
3927
  useEffect(() => {
3924
3928
  if (hideVoiceRecordingButton) return;
3925
3929
 
3926
- Animated.timing(micAnimValue, {
3927
- toValue: hasContent ? 1 : 0,
3928
- duration: MIC_ANIM_DURATION,
3929
- useNativeDriver: true,
3930
- }).start();
3930
+ // Run visual animation (native driver) and layout collapse (JS driver) in parallel
3931
+ Animated.parallel([
3932
+ // Visual: slide + fade (native driver for 60fps)
3933
+ Animated.timing(micAnimValue, {
3934
+ toValue: hasContent ? 1 : 0,
3935
+ duration: MIC_ANIM_DURATION,
3936
+ useNativeDriver: true,
3937
+ }),
3938
+ // Layout: width collapse (JS driver, needed for layout props)
3939
+ Animated.timing(micWidthAnim, {
3940
+ toValue: hasContent ? 0 : 1,
3941
+ duration: MIC_ANIM_DURATION,
3942
+ useNativeDriver: false,
3943
+ }),
3944
+ ]).start();
3931
3945
  }, [hasContent, hideVoiceRecordingButton]);
3932
3946
 
3933
3947
  /**
@@ -4167,26 +4181,36 @@ export const CometChatCompactMessageComposer = React.forwardRef(
4167
4181
  if (showInlineRecorder) {
4168
4182
  return null;
4169
4183
  }
4170
- // Animated wrapper: translateX slides right, opacity fades out
4184
+ // Two nested Animated.Views to avoid native/JS driver conflict:
4185
+ // Outer: JS driver — animates width + margin for layout collapse (eats the gap)
4186
+ // Inner: native driver — animates opacity + translateX for smooth visuals
4171
4187
  return (
4172
4188
  <Animated.View
4173
- pointerEvents={hasContent ? 'none' : 'auto'}
4174
4189
  style={{
4175
- opacity: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
4176
- transform: [{ translateX: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [0, MIC_SLIDE_DISTANCE] }) }],
4190
+ width: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [0, 24] }),
4191
+ marginLeft: micWidthAnim.interpolate({ inputRange: [0, 1], outputRange: [-16, 0] }),
4192
+ overflow: 'hidden' as const,
4177
4193
  }}
4178
4194
  >
4179
- <IconButton
4180
- name={voiceRecordingIconURL ? undefined : 'mic'}
4181
- icon={voiceRecordingIconURL}
4182
- onClick={() => {
4183
- // Show inline recorder
4184
- setTimeout(() => setShowInlineRecorder(true), 50);
4195
+ <Animated.View
4196
+ pointerEvents={hasContent ? 'none' : 'auto'}
4197
+ style={{
4198
+ opacity: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }),
4199
+ transform: [{ translateX: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [0, MIC_SLIDE_DISTANCE] }) }],
4185
4200
  }}
4186
- buttonStyle={Style.iconButton}
4187
- iconStyle={Style.icon}
4188
- tintColor={getAttachmentIconTint()}
4189
- />
4201
+ >
4202
+ <IconButton
4203
+ name={voiceRecordingIconURL ? undefined : 'mic'}
4204
+ icon={voiceRecordingIconURL}
4205
+ onClick={() => {
4206
+ // Show inline recorder
4207
+ setTimeout(() => setShowInlineRecorder(true), 50);
4208
+ }}
4209
+ buttonStyle={Style.iconButton}
4210
+ iconStyle={Style.icon}
4211
+ tintColor={getAttachmentIconTint()}
4212
+ />
4213
+ </Animated.View>
4190
4214
  </Animated.View>
4191
4215
  );
4192
4216
  };
@@ -4296,7 +4320,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
4296
4320
  {/* Message Preview Tray for Edit Mode */}
4297
4321
  <MessagePreviewTray
4298
4322
  shouldShow={messagePreview !== null}
4299
- text={typeof messagePreview?.message?.text === 'string' ? messagePreview.message.text : ''}
4323
+ message={messagePreview?.message}
4300
4324
  title={t('EDIT_MESSAGE')}
4301
4325
  onClose={() => {
4302
4326
  setMessagePreview(null);
@@ -4449,13 +4473,9 @@ export const CometChatCompactMessageComposer = React.forwardRef(
4449
4473
  Style.rightIconsContainer,
4450
4474
  isExpanded && { alignItems: 'flex-end' as const }
4451
4475
  ]}>
4452
- {/* Auxiliary button (stickers/emoji) on right — slides right with mic */}
4476
+ {/* Auxiliary button (stickers/emoji) on right — slides with mic width collapse */}
4453
4477
  {resolvedAlignment === 'right' && !hideVoiceRecordingButton && (
4454
- <Animated.View style={{
4455
- transform: [{ translateX: micAnimValue.interpolate({ inputRange: [0, 1], outputRange: [0, MIC_SLIDE_DISTANCE] }) }],
4456
- }}>
4457
- {renderAuxiliaryButton()}
4458
- </Animated.View>
4478
+ renderAuxiliaryButton()
4459
4479
  )}
4460
4480
  {resolvedAlignment === 'right' && hideVoiceRecordingButton && renderAuxiliaryButton()}
4461
4481
 
@@ -32,7 +32,6 @@ import { SelectionMode } from "../shared/base/Types";
32
32
  import {
33
33
  ConversationTypeConstants,
34
34
  GroupTypeConstants,
35
- MentionsTargetElement,
36
35
  MessageCategoryConstants,
37
36
  MessageReceipt,
38
37
  MessageStatusConstants,
@@ -43,7 +42,7 @@ import { Icon } from "../shared/icons/Icon";
43
42
  import { CommonUtils } from "../shared/utils/CommonUtils";
44
43
  import { stripMarkdown, preparePreviewText } from "../shared/utils/MarkdownUtils";
45
44
  import { CometChatRichTextFormatter } from "../shared/formatters/CometChatRichTextFormatter";
46
- import { getMessagePreviewInternal } from "../shared/utils/MessageUtils";
45
+ import { getMessagePreviewInternal, applyMentionsFormatting } from "../shared/utils/MessageUtils";
47
46
  import { CometChatBadge } from "../shared/views/CometChatBadge";
48
47
  import { CometChatConfirmDialog } from "../shared/views/CometChatConfirmDialog";
49
48
  import { CometChatDate } from "../shared/views/CometChatDate";
@@ -61,7 +60,6 @@ import { CometChatTheme } from "../theme/type";
61
60
  import { MenuItemInterface } from "../shared/views/CometChatTooltipMenu/CometChatTooltipMenu";
62
61
  import { JSX } from "react";
63
62
  import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
64
- import { SuggestionItem } from "../shared/views/CometChatSuggestionList/SuggestionItem";
65
63
 
66
64
  // Unique listener IDs for conversation, user, group, message and call events.
67
65
  const conversationListenerId = "chatlist_" + new Date().getTime();
@@ -335,10 +333,12 @@ export const CometChatConversations = (props: ConversationInterface) => {
335
333
  color: theme.color.primary as string,
336
334
  },
337
335
  inlineCodeContainerStyle: {
338
- backgroundColor: theme.color.background3 as string,
339
- borderRadius: 2,
340
- paddingHorizontal: 2,
341
- paddingVertical: 0,
336
+ backgroundColor: "rgba(120, 120, 128, 0.22)",
337
+ borderRadius: 4,
338
+ borderWidth: 0.5,
339
+ borderColor: "rgba(120, 120, 128, 0.35)",
340
+ paddingHorizontal: 4,
341
+ paddingVertical: 1,
342
342
  },
343
343
  });
344
344
  }, [theme]);
@@ -834,7 +834,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
834
834
  if (!lastMessage) return null;
835
835
  let messageText: string | JSX.Element = "";
836
836
  messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
837
-
837
+
838
838
  // Detect block-level elements in text messages before stripMarkdown flattens them
839
839
  let blockType: 'blockquote' | 'codeBlock' | 'list' | null = null;
840
840
  let codeBlockLine = '';
@@ -912,6 +912,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
912
912
  {messageText}
913
913
  </Text>
914
914
  );
915
+ } else if (messageText && typeof messageText !== 'string') {
916
+ // JSX element from rich text formatter — wrap with truncation
917
+ messageText = (
918
+ <Text
919
+ style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 2 }]}
920
+ numberOfLines={1}
921
+ ellipsizeMode='tail'
922
+ >
923
+ {messageText}
924
+ </Text>
925
+ );
915
926
  }
916
927
 
917
928
  let groupText = "";
@@ -929,9 +940,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
929
940
  <>
930
941
  {groupText && (
931
942
  <Text
932
- style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 1 }]}
943
+ style={[mergedStyles.itemStyle.subtitleStyle, { flexShrink: 0, maxWidth: '40%' }]}
933
944
  numberOfLines={1}
934
- ellipsizeMode='middle'
945
+ ellipsizeMode='tail'
935
946
  >
936
947
  {groupText}
937
948
  </Text>
@@ -964,39 +975,9 @@ export const CometChatConversations = (props: ConversationInterface) => {
964
975
  messageTextTmp = stripMarkdown(subtitle);
965
976
  }
966
977
  let allFormatters = [...(textFormatters || [])];
967
- // Detect presence of @all alias token in raw subtitle string (before formatting)
968
- const containsAllAlias = /<@all:(.*?)>/.test(subtitle);
969
-
970
- if (message.getMentionedUsers().length || containsAllAlias) {
971
- let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
972
- mentionsFormatter.setContext("conversation");
973
- mentionsFormatter.setLoggedInUser(CometChatUIKit.loggedInUser!);
974
- mentionsFormatter.setMentionsStyle(mergedStyles.mentionsStyles);
975
- mentionsFormatter.setTargetElement(MentionsTargetElement.conversation);
976
- mentionsFormatter.setMessage(message);
977
-
978
- // Inject alias suggestion item if needed so formatter can render styled @All
979
- if (containsAllAlias) {
980
- const match = subtitle.match(/<@all:(.*?)>/);
981
- const aliasLabel = match && match[1] ? match[1] : "all";
982
- let existing = mentionsFormatter.getSuggestionItems();
983
- const underlyingText = `<@all:${aliasLabel}>`;
984
- const already = existing.find((it: any) => it.underlyingText === underlyingText);
985
- if (!already) {
986
- const aliasItem = new SuggestionItem({
987
- id: aliasLabel,
988
- name: aliasLabel,
989
- promptText: aliasLabel,
990
- trackingCharacter: "@",
991
- underlyingText,
992
- hideLeadingIcon: true,
993
- });
994
- mentionsFormatter.setSuggestionItems([...existing, aliasItem]);
995
- }
996
- }
997
978
 
998
- allFormatters.push(mentionsFormatter);
999
- }
979
+ // Apply mentions formatting using shared helper (DRY — same as CometChatMessagePreview)
980
+ messageTextTmp = applyMentionsFormatting(message, messageTextTmp, subtitle, mergedStyles.mentionsStyles);
1000
981
 
1001
982
  if (
1002
983
  message instanceof CometChat.TextMessage &&
@@ -761,7 +761,7 @@ export const CometChatMessageComposer = React.forwardRef(
761
761
 
762
762
  mentionMap.current = hashMap;
763
763
  setMessagePreview({
764
- message: { ...message, text: textComponents },
764
+ message: message,
765
765
  mode: ConversationOptionConstants.edit,
766
766
  });
767
767
 
@@ -1274,7 +1274,7 @@ export const CometChatMessageComposer = React.forwardRef(
1274
1274
  iconStyle={mergedComposerStyle.attachmentIconStyle as ImageStyle}
1275
1275
  />
1276
1276
  );
1277
- }, [mergedComposerStyle]);
1277
+ }, [mergedComposerStyle, actionSheetItems, hideAttachmentButton]);
1278
1278
 
1279
1279
  const RecordAudioButtonView = ({
1280
1280
  icon,
@@ -2306,7 +2306,7 @@ export const CometChatMessageComposer = React.forwardRef(
2306
2306
  {messagePreview && (
2307
2307
  <CometChatMessagePreview
2308
2308
  messagePreviewTitle={t("EDIT_MESSAGE")}
2309
- messagePreviewSubtitle={messagePreview?.message?.text || "Message"}
2309
+ message={messagePreview?.message}
2310
2310
  showCloseIcon={true}
2311
2311
  closeIconURL={ICONS.CLOSE}
2312
2312
  onCloseClick={() => {
@@ -76,6 +76,7 @@ import { CometChatBadge } from "../shared/views/CometChatBadge";
76
76
  import { CometChatDate } from "../shared/views/CometChatDate";
77
77
  import { CometChatMessageBubble } from "../shared/views/CometChatMessageBubble";
78
78
  import { getModerationStatus, ModerationBottomView, MimeErrorBottomView } from "../shared/utils/MessageUtils";
79
+ import { stripMarkdown } from "../shared/utils/MarkdownUtils";
79
80
  import { CometChatReactions } from "../shared/views/CometChatReactions";
80
81
  import { useTheme, useThemeInternal } from "../theme";
81
82
  import { MessageSkeleton } from "./Skeleton";
@@ -126,6 +127,24 @@ const safeGetMuid = (item: any): string | undefined => {
126
127
 
127
128
 
128
129
 
130
+ /**
131
+ * Fetches a conversation if it exists, returning null for new users
132
+ * who haven't exchanged any messages yet (ERR_CONVERSATION_NOT_ACCESSIBLE).
133
+ */
134
+ async function getConversationIfExists(
135
+ convId: string,
136
+ conversationType: string
137
+ ): Promise<CometChat.Conversation | null> {
138
+ try {
139
+ return await CometChat.getConversation(convId, conversationType);
140
+ } catch (e: any) {
141
+ if (e?.code === "ERR_CONVERSATION_NOT_ACCESSIBLE") {
142
+ return null;
143
+ }
144
+ throw e;
145
+ }
146
+ }
147
+
129
148
  /**
130
149
  * Batch state updates using requestAnimationFrame
131
150
  * It delays the callback until the next animation frame,
@@ -1319,7 +1338,8 @@ export const CometChatMessageList = memo(
1319
1338
 
1320
1339
  if (!convId) return;
1321
1340
 
1322
- const conversation = await CometChat.getConversation(convId, conversationType);
1341
+ const conversation = await getConversationIfExists(convId, conversationType);
1342
+ if (!conversation) return;
1323
1343
  const unreadCount = conversation.getUnreadMessageCount();
1324
1344
  setUnreadCount(unreadCount);
1325
1345
 
@@ -1741,7 +1761,8 @@ export const CometChatMessageList = memo(
1741
1761
  conversationType = CometChat.RECEIVER_TYPE.GROUP;
1742
1762
  }
1743
1763
  //getting convesation using conversationId=Uid and conversationType
1744
- CometChat.getConversation(convId, conversationType).then((conversation) => {
1764
+ getConversationIfExists(convId, conversationType).then((conversation) => {
1765
+ if (!conversation) return;
1745
1766
  // Emitting conversation update event
1746
1767
  CometChatUIEventHandler.emitConversationEvent(
1747
1768
  CometChatConversationEvents.ccUpdateConversation,
@@ -2011,8 +2032,13 @@ export const CometChatMessageList = memo(
2011
2032
  * minimizing unnecessary network calls during active scrolling or bottom-positioned interactions.
2012
2033
  * A fallback mechanism reverts to local state comparison if the network request fails, ensuring robustness.
2013
2034
  */
2014
- CometChat.getConversation(conversationWith, conversationType)
2035
+ getConversationIfExists(conversationWith, conversationType)
2015
2036
  .then((conversation) => {
2037
+ if (!conversation) {
2038
+ // No conversation yet (fresh user) — treat as sequence correct
2039
+ processMessage(true);
2040
+ return;
2041
+ }
2016
2042
  const convLastMsg = conversation?.getLastMessage();
2017
2043
  // Check if the last message in our list matches the conversation's last message
2018
2044
  // This ensures we don't have a gap
@@ -2301,11 +2327,11 @@ export const CometChatMessageList = memo(
2301
2327
 
2302
2328
  if (convId && conversationType) {
2303
2329
 
2304
- const conversation = await CometChat.getConversation(
2330
+ const conversation = await getConversationIfExists(
2305
2331
  convId,
2306
2332
  conversationType
2307
2333
  );
2308
- if (conversation.getUnreadMessageCount() > 0) {
2334
+ if (conversation && conversation.getUnreadMessageCount() > 0) {
2309
2335
  setUnreadCount(conversation.getUnreadMessageCount());
2310
2336
  const lastReadMessageId = conversation.getLastReadMessageId();
2311
2337
  //if lastReadMessageId is 0, it means no messages have been read yet
@@ -3405,9 +3431,11 @@ export const CometChatMessageList = memo(
3405
3431
  };
3406
3432
 
3407
3433
  const shareMedia = async (messageObject: CometChat.MediaMessage | any) => {
3408
- let _plainString = getPlainString(messageObject?.getData()["text"] || "", messageObject);
3409
-
3410
- let textMessage = _plainString;
3434
+ // Strip markdown/HTML from raw text BEFORE mention replacement,
3435
+ // because getPlainString can break HTML tags (e.g., </u> becomes /u>)
3436
+ let rawText = messageObject?.getData()["text"] || "";
3437
+ let strippedText = stripMarkdown(rawText);
3438
+ let textMessage = getPlainString(strippedText, messageObject);
3411
3439
  let fileUrl = messageObject.getData()["url"];
3412
3440
 
3413
3441
  const getFileName = () => {
@@ -3426,8 +3454,14 @@ export const CometChatMessageList = memo(
3426
3454
  : (messageObject as CometChat.MediaMessage)?.getAttachment()?.getMimeType(), // get Mime Type
3427
3455
  };
3428
3456
 
3429
- NativeModules.FileManager.shareMessage(shareObj, (callback: any) => {
3430
- });
3457
+ // Dismiss message options modal before presenting native share sheet
3458
+ // to prevent screen freeze when share sheet is dismissed on iOS (Fabric).
3459
+ // Use setTimeout with enough delay for the modal dismiss animation to complete.
3460
+ setShowMessageOptions([]);
3461
+ setTimeout(() => {
3462
+ NativeModules.FileManager.shareMessage(shareObj, (callback: any) => {
3463
+ });
3464
+ }, 600);
3431
3465
  };
3432
3466
 
3433
3467
  const openOptionsForMessage = useCallback(
@@ -3658,9 +3692,17 @@ export const CometChatMessageList = memo(
3658
3692
  : getStatusInfoView(message, bubbleAlignment, currentIndex);
3659
3693
  }, [hasTemplate, message, bubbleAlignment, currentIndex, getStatusInfoView]);
3660
3694
 
3695
+
3661
3696
  const ReplyView = useMemo(() => {
3697
+ if (templates && templates.length > 0) {
3698
+ return ChatConfigurator.dataSource.getReplyView?.(message, mergedTheme, {
3699
+ onReplyClick: (messageId: string) => {
3700
+ scrollToMessage(messageId);
3701
+ },
3702
+ }) || null;
3703
+ }
3662
3704
  return hasTemplate?.ReplyView?.(message, bubbleAlignment) || null;
3663
- }, [hasTemplate, message, bubbleAlignment]);
3705
+ }, [hasTemplate, message, bubbleAlignment, mergedTheme, templates]);
3664
3706
 
3665
3707
  if (hasTemplate) {
3666
3708
  if (hasTemplate?.BubbleView) return hasTemplate?.BubbleView(message);
@@ -62,7 +62,7 @@ export const emailPattern =
62
62
 
63
63
  export const urlPattern =
64
64
  `((https?://|ftp://|www\\.|pic\\.)[-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]+[\\w/#](\\(\\))?` +
65
- `|[a-zA-Z0-9][-a-zA-Z0-9]*(?:\\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\\.[a-zA-Z]{2,}(?:[:/][-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]*[\\w/#](\\(\\))?)?)` +
65
+ `|[a-zA-Z][a-zA-Z0-9]*[-a-zA-Z0-9]*(?:\\.[a-zA-Z0-9][-a-zA-Z0-9]*)*\\.[a-zA-Z]{2,}(?:[:/][-\\w;/?:@&=+$\\|\\_.!~*\\|'()\\[\\]%#,☺]*[\\w/#](\\(\\))?)?)` +
66
66
  wordBoundary.end;
67
67
 
68
68
  export const phoneNumPattern =
@@ -399,10 +399,12 @@ export class CometChatMentionsFormatter extends CometChatTextFormatter {
399
399
  ?.fetchNext()
400
400
  .then((users: CometChat.User[]) => {
401
401
  let structuredData = this.convertCCUsersToSuggestionsItem(users);
402
- // Preserve any pre-added items (like @all alias) in searchData when freshCall
403
- this.searchData = freshCall
404
- ? [...this.searchData, ...structuredData]
405
- : [...this.searchData, ...structuredData];
402
+ // Deduplicate: only add items whose id is not already present
403
+ const existingIds = new Set(this.searchData.map((item) => item.id));
404
+ const uniqueNewItems = structuredData.filter(
405
+ (item) => !existingIds.has(item.id)
406
+ );
407
+ this.searchData = [...this.searchData, ...uniqueNewItems];
406
408
  this.setSearchData(this.searchData);
407
409
  })
408
410
  .catch((err) => {