@cometchat/chat-uikit-react-native 5.5.0 → 5.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) 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/android/build.gradle +23 -89
  4. package/android/gradle.properties +5 -5
  5. package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +5 -1
  6. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +52 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +37 -4
  8. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +9 -1
  9. package/ios/FileManager.m +77 -3
  10. package/ios/RichTextEditorView.swift +52 -1
  11. package/ios/RichTextEditorViewManager.m +1 -0
  12. package/ios/RichTextEditorViewManager.swift +8 -0
  13. package/package.json +8 -5
  14. package/react-native-cometchat-ui-kit.podspec +5 -19
  15. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +69 -36
  16. package/src/CometChatConversations/CometChatConversations.tsx +12 -1
  17. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +2 -2
  18. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +50 -31
  19. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +10 -1
  20. package/src/CometChatMessageList/CometChatMessageList.tsx +24 -19
  21. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +7 -8
  22. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +43 -19
  23. package/src/CometChatRichTextEditor/index.tsx +6 -1
  24. package/src/CometChatRichTextEditor/types.ts +2 -0
  25. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +251 -14
  26. package/src/CometChatSearch/CometChatSearch.tsx +39 -11
  27. package/src/calls/CometChatOngoingCall/CometChatOngoingCall.tsx +56 -17
  28. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +12 -9
  29. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +13 -10
  30. package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +34 -27
  31. package/src/extensions/Polls/Polls.tsx +7 -7
  32. package/src/extensions/Polls/PollsBubble.tsx +2 -2
  33. package/src/globals.d.ts +6 -0
  34. package/src/shared/CometChatUiKit/CometChatUIKit.ts +2 -1
  35. package/src/shared/constants/UIKitConstants.ts +3 -17
  36. package/src/shared/constants/textPatterns.ts +45 -0
  37. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +25 -259
  38. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +22 -11
  39. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +56 -32
  40. package/src/shared/formatters/CometChatTextFormatter.ts +22 -0
  41. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +8 -0
  42. package/src/shared/formatters/applyRawFormatters.ts +31 -0
  43. package/src/shared/formatters/codeElements.ts +21 -0
  44. package/src/shared/framework/MessageDataSource.tsx +14 -8
  45. package/src/shared/helper/types/index.ts +5 -0
  46. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +4 -4
  47. package/src/shared/libs/ImageZoom/types/index.ts +2 -0
  48. package/src/shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx +15 -30
  49. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +138 -19
  50. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -1
  51. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +0 -1
  52. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +54 -1
  53. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +54 -1
  54. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +54 -1
  55. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +54 -1
  56. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +54 -1
  57. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +54 -1
  58. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +54 -1
  59. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +54 -1
  60. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +54 -1
  61. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +54 -1
  62. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +54 -1
  63. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +54 -1
  64. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +54 -1
  65. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +54 -1
  66. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +54 -1
  67. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +54 -1
  68. package/src/shared/resources/CometChatSoundManager/sound.js +2 -3
  69. package/src/shared/services/UploadQueueService.ts +7 -0
  70. package/src/shared/utils/CometChatMessageHelper/index.ts +3 -0
  71. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +11 -0
  72. package/src/shared/utils/MarkdownUtils.ts +42 -5
  73. package/src/shared/utils/MessageUtils.tsx +7 -5
  74. package/src/shared/utils/PinnedMessagesHelper.ts +65 -0
  75. package/src/shared/utils/SavedMessagesHelper.ts +42 -6
  76. package/src/shared/utils/__testUtils__/messagesRequestBuilderMock.ts +37 -0
  77. package/src/shared/utils/cloneRequestBuilder.ts +25 -0
  78. package/src/shared/utils/groupMemberAddedRows.ts +28 -0
  79. package/src/shared/utils/linkPreviewSelection.ts +109 -0
  80. package/src/shared/utils/mentionTokens.ts +77 -0
  81. package/src/shared/utils/runAfterInteractions.ts +26 -0
  82. package/src/shared/utils/stripRichText.ts +2 -1
  83. package/src/shared/utils/tapGesture.ts +23 -0
  84. package/src/shared/utils/videoThumbnail.ts +74 -0
  85. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +15 -4
  86. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +21 -13
  87. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +13 -15
  88. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +5 -0
  89. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +4 -1
  90. package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +8 -1
  91. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +1 -1
  92. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +2 -1
  93. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +7 -1
  94. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +8 -26
  95. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +4 -2
  96. package/src/shared/views/CometChatList/Header.tsx +9 -3
  97. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPreview/CometChatAudioPreview.tsx +2 -1
  98. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +28 -8
  99. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -4
  100. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +36 -4
  101. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +2 -1
  102. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +62 -30
  103. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +5 -0
  104. package/src/CometChatMessageList/MANUAL_TEST_CASES.md +0 -154
@@ -2,8 +2,6 @@ require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
4
 
5
- folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
6
-
7
5
  Pod::Spec.new do |s|
8
6
  s.name = "react-native-cometchat-ui-kit"
9
7
  s.version = package["version"]
@@ -12,14 +10,13 @@ Pod::Spec.new do |s|
12
10
  s.license = package["license"]
13
11
  s.authors = package["author"].is_a?(Hash) ? [package["author"]] : package["author"]
14
12
 
15
- s.platforms = { :ios => "11.0" }
13
+ s.platforms = { :ios => min_ios_version_supported }
16
14
  s.source = { :git => "https://github.com/cometchat/cometchat-uikit-react-native.git", :tag => "#{s.version}" }
17
15
 
18
16
  s.source_files = "ios/**/*.{h,m,mm,swift}"
19
17
 
20
18
  s.static_framework = true # Set static_framework for the main spec if needed
21
19
  s.frameworks = ["PhotosUI"]
22
- s.dependency "React-Core"
23
20
 
24
21
  s.subspec "Video" do |ss|
25
22
  ss.source_files = "ios/Video/*.{h,m}"
@@ -33,19 +30,8 @@ Pod::Spec.new do |s|
33
30
  ss.source_files = "ios/VideoCaching/**/*.{h,m}"
34
31
  end
35
32
 
36
- # Conditional compiler flags and dependencies for the new architecture
37
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
38
- s.compiler_flags = "#{folly_compiler_flags} -DRCT_NEW_ARCH_ENABLED=1"
39
- s.pod_target_xcconfig = {
40
- "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Header/Public/**\"",
41
- "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
42
- }
43
-
44
- # s.dependency "React-Codegen"
45
- # s.dependency "RCT-Folly"
46
- # s.dependency "RCTRequired"
47
- # s.dependency "RCTTypeSafety"
48
- # s.dependency "ReactCommon/turbomodule/core"
49
- # s.dependency "RCTSlider"
50
- end
33
+ # React Native's own helper wires up React-Core and the New Architecture
34
+ # dependencies and flags (RN 0.71+). It replaces the hand-rolled
35
+ # RCT_NEW_ARCH_ENABLED block, which stopped meaning anything in RN 0.82.
36
+ install_modules_dependencies(s)
51
37
  end
@@ -18,12 +18,12 @@ import {
18
18
  Dimensions,
19
19
  ImageSourcePropType,
20
20
  ImageStyle,
21
- InteractionManager,
22
21
  Keyboard,
23
22
  ColorValue,
24
23
  TouchableWithoutFeedbackProps,
25
24
  ScrollView,
26
25
  StyleSheet,
26
+ StatusBar,
27
27
  } from 'react-native';
28
28
  import { JSX } from 'react';
29
29
  import RichTextEditor, {
@@ -40,6 +40,7 @@ import {
40
40
  matchColorTagAt,
41
41
  stripColorTags,
42
42
  } from '../shared/formatters/richTextWireFormat';
43
+ import { applyRawFormatters } from '../shared/formatters/applyRawFormatters';
43
44
 
44
45
  /**
45
46
  * Stack-key prefix for the value-carrying text-colour style during send serialization.
@@ -110,6 +111,7 @@ import {
110
111
  getUnixTimestampInMilliseconds,
111
112
  messageStatus,
112
113
  } from '../shared/utils/CometChatMessageHelper';
114
+ import { runAfterInteractions } from '../shared/utils/runAfterInteractions';
113
115
  import { MessageTypeConstants, ReceiverTypeConstants, ConversationOptionConstants, MentionsVisibility, MentionsTargetElement, ViewAlignment, EnterKeyBehavior, DISABLED_BUTTON_OPACITY } from '../shared/constants/UIKitConstants';
114
116
  import { MessageEvents } from '../shared/events';
115
117
  import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
@@ -117,6 +119,7 @@ import { CometChatMessageEvents } from '../shared/events/CometChatMessageEvents'
117
119
  import { ICONS } from './resources';
118
120
  import { CommonUtils } from '../shared/utils/CommonUtils';
119
121
  import { isCursorWithinMentionRange, getMentionRangeAtCursor } from '../shared/utils/MentionUtils';
122
+ import { escapeTypedMentionTokens, insertMentionTokens } from '../shared/utils/mentionTokens';
120
123
  import { stripMarkdown } from '../shared/utils/MarkdownUtils';
121
124
  import { commonVars } from '../shared/base/vars';
122
125
  import { permissionUtil } from '../shared/utils/PermissionUtil';
@@ -282,7 +285,7 @@ const RecordAudio = (props: any) => {
282
285
  * MessagePreviewTray component for displaying edit/reply message preview (v5 pattern)
283
286
  */
284
287
  const MessagePreviewTray = (props: any) => {
285
- const { shouldShow = false, message = null, onClose = () => {}, title = '' } = props;
288
+ const { shouldShow = false, message = null, onClose = () => {}, title = '', textFormatters } = props;
286
289
  const { t } = useCometChatTranslation();
287
290
  if (!shouldShow) return null;
288
291
  // Editing a media caption: caption text is the editable subtitle; a muted overline (media-type icon +
@@ -292,9 +295,12 @@ const MessagePreviewTray = (props: any) => {
292
295
  <CometChatMessagePreview
293
296
  messagePreviewTitle={title}
294
297
  message={message}
298
+ textFormatters={textFormatters}
295
299
  {...(isMediaCaptionEdit
296
300
  ? {
297
- messagePreviewSubtitle: message.getCaption() ?? '',
301
+ // The caption goes in as a plain string, so a consumer's token is rewritten here —
302
+ // `textFormatters` above only reaches the message-text path.
303
+ messagePreviewSubtitle: applyRawFormatters(message.getCaption() ?? '', textFormatters),
298
304
  hideSubtitleIcon: true,
299
305
  overlineText: attachmentCountLabel(message.getType?.(), message.getAttachments?.()?.length ?? 1),
300
306
  }
@@ -552,6 +558,14 @@ export interface ComposerInputHandle {
552
558
  setSelection: (start: number, end?: number) => void;
553
559
  /** Inserts a hyperlink, wrapping the current selection when there is one. */
554
560
  insertLink: (url: string, text: string) => void;
561
+ /**
562
+ * Replaces the selected text, or inserts at the caret when nothing is selected — how a trailing
563
+ * button writes its own wire token into the composer.
564
+ *
565
+ * Prefer this over `getText` + `setText`: rewriting the whole input re-seeds the editor, while
566
+ * this touches only the selected run and leaves the formatting around it alone.
567
+ */
568
+ replaceSelection: (text: string) => void;
555
569
  toggleBold: () => void;
556
570
  toggleItalic: () => void;
557
571
  toggleUnderline: () => void;
@@ -2022,13 +2036,15 @@ export const CometChatCompactMessageComposer = React.forwardRef(
2022
2036
 
2023
2037
  // Clone and store formatter using tracking character as key (matching MessageComposer pattern)
2024
2038
  const newFormatter = CommonUtils.clone(formatter);
2025
- if (trackingChar) {
2026
- allFormatters.current.set(trackingChar, newFormatter);
2027
-
2028
- // Set up tracking characters for mention detection
2029
- if (!trackingCharacters.current.includes(trackingChar)) {
2030
- trackingCharacters.current.push(trackingChar);
2031
- }
2039
+ // A formatter with no tracking character has no suggestion list, but it still takes part in
2040
+ // the send and edit-preview lifecycle — so key it by id instead of dropping it. The prefix
2041
+ // keeps it out of reach of the single-character lookup that opens the suggestion list.
2042
+ const formatterKey = trackingChar || `formatter:${formatter.getId?.() ?? allFormatters.current.size}`;
2043
+ allFormatters.current.set(formatterKey, newFormatter);
2044
+
2045
+ // Set up tracking characters for mention detection
2046
+ if (trackingChar && !trackingCharacters.current.includes(trackingChar)) {
2047
+ trackingCharacters.current.push(trackingChar);
2032
2048
  }
2033
2049
  });
2034
2050
  }, []);
@@ -3028,7 +3044,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3028
3044
  // Update cursor position to the start of the first deleted mention
3029
3045
  const firstStart = overlaps[0].start;
3030
3046
  ignoreSelectionUntil.current = Date.now() + 500;
3031
- InteractionManager.runAfterInteractions(() => {
3047
+ runAfterInteractions(() => {
3032
3048
  inputRef.current?.setSelection?.(firstStart);
3033
3049
  setSelectionPosition({ start: firstStart, end: firstStart });
3034
3050
  syncMentionRanges();
@@ -3184,7 +3200,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3184
3200
  targetPosition = mentionRange.end;
3185
3201
  }
3186
3202
  if (targetPosition !== cursorPos) {
3187
- InteractionManager.runAfterInteractions(() => {
3203
+ runAfterInteractions(() => {
3188
3204
  inputRef.current?.setSelection?.(targetPosition);
3189
3205
  setSelectionPosition({ start: targetPosition, end: targetPosition });
3190
3206
  });
@@ -3423,24 +3439,9 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3423
3439
  * Convert mentions to underlying text format for sending
3424
3440
  * Iterates through mentionMap and replaces prompt text with underlying text
3425
3441
  */
3426
- const getRegexString = (str: string): string => {
3427
- // Get an array of the entries in the map using the spread operator
3428
- const entries = [...mentionMap.current.entries()].reverse();
3429
-
3430
- let uidInput = str;
3431
-
3432
- // Iterate over the array in reverse order
3433
- entries.forEach(([key, value]) => {
3434
- const [start, end] = key.split('_').map(Number);
3435
-
3436
- const pre = uidInput.substring(0, start);
3437
- const post = uidInput.substring(end);
3438
-
3439
- uidInput = pre + value.underlyingText + post;
3440
- });
3441
-
3442
- return uidInput;
3443
- };
3442
+ const getRegexString = (str: string): string =>
3443
+ // Token-looking text the user typed is escaped so it is stored as text, not a live mention.
3444
+ insertMentionTokens(str, mentionMap.current.entries());
3444
3445
 
3445
3446
  /**
3446
3447
  * Replace mention display names with underlying tokens in the given text.
@@ -3450,11 +3451,14 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3450
3451
  * when the same display name appears multiple times.
3451
3452
  */
3452
3453
  const replaceMentionsWithTokens = (text: string): string => {
3453
- if (mentionMap.current.size === 0) return text;
3454
+ // Escape token-looking text the user typed first; the picked mentions inserted below are
3455
+ // the only real tokens.
3456
+ const typed = escapeTypedMentionTokens(text);
3457
+ if (mentionMap.current.size === 0) return typed;
3454
3458
  const entries = [...mentionMap.current.entries()].sort((a, b) => {
3455
3459
  return parseInt(a[0].split('_')[0]) - parseInt(b[0].split('_')[0]);
3456
3460
  });
3457
- let result = text;
3461
+ let result = typed;
3458
3462
  let offset = 0;
3459
3463
  for (const [, value] of entries) {
3460
3464
  const displayName = value.promptText || '';
@@ -3500,8 +3504,10 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3500
3504
  itemLookup.set(item.id, item);
3501
3505
  }
3502
3506
 
3503
- // Single-pass: collect matches, build resolved text via array join
3504
- const mentionRegex = /<@(?:uid|all):(.*?)>/g;
3507
+ // Single-pass: collect matches, build resolved text via array join. The second
3508
+ // alternative is token text the user TYPED, stored escaped (`&lt;@all:…`); it goes back
3509
+ // into the editor as the literal `<@all:…` they typed, never as a mention.
3510
+ const mentionRegex = /<@(?:uid|all):(.*?)>|&lt;(@(?:uid|all):)/g;
3505
3511
  let match: RegExpExecArray | null;
3506
3512
  const segments: string[] = [];
3507
3513
  let lastIndex = 0;
@@ -3514,6 +3520,13 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3514
3520
  segments.push(before);
3515
3521
  resolvedLength += before.length;
3516
3522
 
3523
+ if (match[2] !== undefined) {
3524
+ segments.push("<" + match[2]);
3525
+ resolvedLength += match[2].length + 1;
3526
+ lastIndex = match.index + match[0].length;
3527
+ continue;
3528
+ }
3529
+
3517
3530
  const item = itemLookup.get(match[1]);
3518
3531
  const displayText = item?.promptText ?? `@${match[1]}`;
3519
3532
  segments.push(displayText);
@@ -3547,6 +3560,11 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3547
3560
  mode: ConversationOptionConstants.edit,
3548
3561
  });
3549
3562
 
3563
+ // A consumer's own wire token becomes UI Kit markup before the editor parses it, so an edit
3564
+ // opens showing the styling rather than the raw token. `handlePreMessageSend` below turns it
3565
+ // back into the consumer's format when the edit is saved.
3566
+ resolvedText = applyRawFormatters(resolvedText, textFormatters);
3567
+
3550
3568
  // Parse markdown into structured blocks and load into the native editor
3551
3569
  const blocks = markdownToBlocks(resolvedText);
3552
3570
  inputTextRef.current = resolvedText;
@@ -3630,6 +3648,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
3630
3648
  setText: (text: string) => setInputTextProgrammatic(text),
3631
3649
  setSelection: (start: number, end?: number) => inputRef.current?.setSelection(start, end),
3632
3650
  insertLink: (url: string, text: string) => inputRef.current?.insertLink(url, text),
3651
+ replaceSelection: (text: string) => inputRef.current?.replaceSelection(text),
3633
3652
  toggleBold: () => inputRef.current?.toggleBold(),
3634
3653
  toggleItalic: () => inputRef.current?.toggleItalic(),
3635
3654
  toggleUnderline: () => inputRef.current?.toggleUnderline(),
@@ -4523,6 +4542,13 @@ export const CometChatCompactMessageComposer = React.forwardRef(
4523
4542
  textMessage.setParentMessageId(parentMessageId as number);
4524
4543
  }
4525
4544
  outgoing = textMessage;
4545
+
4546
+ // An edit IS a send: without this a consumer's formatter never converts the text back to
4547
+ // its own wire format, and the mentions formatter never re-attaches the mentioned users.
4548
+ // Captions are left alone — the media send path does not run this hook either.
4549
+ allFormatters.current.forEach((formatter) => {
4550
+ outgoing = formatter.handlePreMessageSend(outgoing);
4551
+ });
4526
4552
  }
4527
4553
 
4528
4554
  // Clear input and preview
@@ -4964,8 +4990,13 @@ export const CometChatCompactMessageComposer = React.forwardRef(
4964
4990
  {/* KeyboardAvoidingView wrapper */}
4965
4991
  <KeyboardAvoidingView
4966
4992
  key={id}
4967
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
4968
- keyboardVerticalOffset={Platform.select({ ios: kbOffset })}
4993
+ // "padding" on Android too: with edge-to-edge (always on from RN 0.87 / targetSdk 36) the window no
4994
+ // longer resizes for the keyboard, and "height" squashes this composer instead of lifting it.
4995
+ // When the window does resize (adjustResize), the keyboard overlap is 0 and padding adds nothing.
4996
+ behavior='padding'
4997
+ // The view is measured from its parent, the keyboard from the top of the screen: offset by
4998
+ // what sits above the parent — the top safe area on iOS, the status bar on Android.
4999
+ keyboardVerticalOffset={Platform.select({ ios: kbOffset, android: StatusBar.currentHeight ?? 0 })}
4969
5000
  {...keyboardAvoidingViewProps}
4970
5001
  >
4971
5002
  {/* Outer wrapper with padding (matches Figma: Message Composer) */}
@@ -5048,6 +5079,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
5048
5079
  <MessagePreviewTray
5049
5080
  shouldShow={messagePreview !== null}
5050
5081
  message={messagePreview?.message}
5082
+ textFormatters={textFormatters}
5051
5083
  title={t('EDIT_MESSAGE')}
5052
5084
  onClose={() => {
5053
5085
  setMessagePreview(null);
@@ -5058,6 +5090,7 @@ export const CometChatCompactMessageComposer = React.forwardRef(
5058
5090
  {replyMessage && replyMessage.message && (
5059
5091
  <CometChatMessagePreview
5060
5092
  message={replyMessage.message}
5093
+ textFormatters={textFormatters}
5061
5094
  showCloseIcon={true}
5062
5095
  closeIconURL={ICONS.CLOSE}
5063
5096
  onCloseClick={closeReplyPreview}
@@ -42,6 +42,7 @@ import { Icon } from "../shared/icons/Icon";
42
42
  import { CommonUtils } from "../shared/utils/CommonUtils";
43
43
  import { stripMarkdown, preparePreviewText } from "../shared/utils/MarkdownUtils";
44
44
  import { CometChatRichTextFormatter } from "../shared/formatters/CometChatRichTextFormatter";
45
+ import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
45
46
  import { getMessagePreviewInternal, applyMentionsFormatting } from "../shared/utils/MessageUtils";
46
47
  import { CometChatBadge } from "../shared/views/CometChatBadge";
47
48
  import { useToast } from "../shared/helper/useToast";
@@ -1104,7 +1105,13 @@ export const CometChatConversations = (props: ConversationInterface) => {
1104
1105
  if (!lastMessage) return null;
1105
1106
  let messageText: string | JSX.Element = "";
1106
1107
  messageText = ChatConfigurator.getDataSource().getLastConversationMessage(conversations, theme);
1107
-
1108
+
1109
+ // Rewrite a consumer's own wire token first: block detection and markdown stripping below
1110
+ // would otherwise flatten it away before the formatter ever sees the message.
1111
+ if (typeof messageText === "string") {
1112
+ messageText = applyRawFormatters(messageText, textFormatters);
1113
+ }
1114
+
1108
1115
  // Detect block-level elements in text messages before stripMarkdown flattens them
1109
1116
  let blockType: 'blockquote' | 'codeBlock' | 'list' | null = null;
1110
1117
  let codeBlockLine = '';
@@ -1951,6 +1958,10 @@ export const CometChatConversations = (props: ConversationInterface) => {
1951
1958
  });
1952
1959
  },
1953
1960
  ccCallEnded: ({ call }: any) => {
1961
+ // CometChatIncomingCall emits ccCallEnded with no call when the session ends. The SDK
1962
+ // throws inside getConversationFromMessage(undefined) without rejecting the promise it
1963
+ // returns, so the .catch below never runs and the error surfaces as an unhandled rejection.
1964
+ if (!call) return;
1954
1965
  CometChat.CometChatHelper.getConversationFromMessage(call)
1955
1966
  .then((conversation) => {
1956
1967
  if (!CometChatUIKit.getConversationUpdateSettings().shouldUpdateOnCallActivities()) {
@@ -185,9 +185,9 @@ export interface CometChatGroupMembersInterface
185
185
  */
186
186
  hideHeader?: boolean;
187
187
  /**
188
- * Hide the Submit Button.
188
+ * Callback when an error occurs.
189
189
  */
190
- onError?: () => void;
190
+ onError?: (e: CometChat.CometChatException) => void;
191
191
  /**
192
192
  * search Keyword
193
193
  */
@@ -1,12 +1,13 @@
1
1
  let __listenerIdCounter = 0;
2
2
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
3
- import { Keyboard } from "react-native";
3
+ import { Keyboard,
4
+ StatusBar,
5
+ } from "react-native";
4
6
  import {
5
7
  ColorValue,
6
8
  Dimensions,
7
9
  ImageSourcePropType,
8
10
  ImageStyle,
9
- InteractionManager,
10
11
  KeyboardAvoidingView,
11
12
  KeyboardAvoidingViewProps,
12
13
  Modal,
@@ -57,7 +58,10 @@ import {
57
58
  messageStatus,
58
59
  } from "../shared/utils/CometChatMessageHelper";
59
60
  import { CommonUtils } from "../shared/utils/CommonUtils";
61
+ import { runAfterInteractions } from "../shared/utils/runAfterInteractions";
62
+ import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
60
63
  import { isCursorWithinMentionRange, getMentionRangeAtCursor } from "../shared/utils/MentionUtils";
64
+ import { insertMentionTokens } from "../shared/utils/mentionTokens";
61
65
  import { permissionUtil } from "../shared/utils/PermissionUtil";
62
66
  import { CometChatMediaRecorder } from "../shared/views/CometChatMediaRecorder";
63
67
  import { useTheme } from "../theme";
@@ -948,6 +952,19 @@ export const CometChatMessageComposer = React.forwardRef(
948
952
  }
949
953
  });
950
954
 
955
+ // Token text the user TYPED is stored escaped (`&lt;@all:…`); it goes back into the
956
+ // input as the literal `<@all:…` they typed. No `user`, so it never enters mentionMap.
957
+ const typedToken = /&lt;(@(?:uid|all):)/g;
958
+ let typedMatch: RegExpExecArray | null;
959
+ while ((typedMatch = typedToken.exec(rawText)) !== null) {
960
+ edits.push({
961
+ startIndex: typedMatch.index,
962
+ endIndex: typedToken.lastIndex,
963
+ replacement: "<" + typedMatch[1],
964
+ user: null,
965
+ });
966
+ }
967
+
951
968
  // Sort edits by startIndex to apply them in order
952
969
  edits.sort((a: any, b: any) => a.startIndex - b.startIndex);
953
970
 
@@ -965,6 +982,7 @@ export const CometChatMessageComposer = React.forwardRef(
965
982
  edit.replacement +
966
983
  rawText.substring(edit.endIndex);
967
984
  offset += edit.replacement.length - (edit.endIndex - edit.startIndex);
985
+ if (!edit.user) return; // un-escaped typed text, not a mention
968
986
  const rangeKey = `${adjustedStartIndex}_${adjustedStartIndex + edit.replacement.length}`;
969
987
  hashMap.set(rangeKey, edit.user);
970
988
  });
@@ -1267,7 +1285,7 @@ export const CometChatMessageComposer = React.forwardRef(
1267
1285
  }
1268
1286
 
1269
1287
  if (Platform.OS === "ios" && messageInputRef.current) {
1270
- InteractionManager.runAfterInteractions(() => {
1288
+ runAfterInteractions(() => {
1271
1289
  let textToProcess = plainTextInput.current;
1272
1290
  if (typeof inputMessage === 'string' && inputMessage.trim().length > 0) {
1273
1291
  textToProcess = inputMessage;
@@ -1342,7 +1360,7 @@ export const CometChatMessageComposer = React.forwardRef(
1342
1360
 
1343
1361
  // Clear the TextInput on iOS to remove auto-corrected text
1344
1362
  if (Platform.OS === "ios" && messageInputRef.current) {
1345
- InteractionManager.runAfterInteractions(() => {
1363
+ runAfterInteractions(() => {
1346
1364
  try {
1347
1365
  messageInputRef.current?.setNativeProps?.({ text: "" });
1348
1366
  messageInputRef.current?.clear?.();
@@ -1921,10 +1939,15 @@ export const CometChatMessageComposer = React.forwardRef(
1921
1939
  if (user) formatter.setUser(user);
1922
1940
  if (group) formatter.setGroup(group);
1923
1941
  let trackingCharacter = formatter.getTrackingCharacter();
1924
- trackingCharacters.current.push(trackingCharacter);
1942
+ if (trackingCharacter) trackingCharacters.current.push(trackingCharacter);
1925
1943
 
1926
1944
  let newFormatter = CommonUtils.clone(formatter);
1927
- allFormatters.current.set(trackingCharacter, newFormatter);
1945
+ // A formatter with no tracking character has no suggestion list, but it still takes part in
1946
+ // the send and edit-preview lifecycle — so key it by id instead of letting an empty key
1947
+ // collapse them all into one entry. The prefix keeps it clear of tracking-character lookups.
1948
+ const formatterKey =
1949
+ trackingCharacter || `formatter:${formatter.getId?.() ?? allFormatters.current.size}`;
1950
+ allFormatters.current.set(formatterKey, newFormatter);
1928
1951
  });
1929
1952
  }, []);
1930
1953
 
@@ -2247,24 +2270,9 @@ export const CometChatMessageComposer = React.forwardRef(
2247
2270
  }, 100);
2248
2271
  };
2249
2272
 
2250
- const getRegexString = (str: string) => {
2251
- // Get an array of the entries in the map using the spread operator
2252
- const entries = [...mentionMap.current.entries()].reverse();
2253
-
2254
- let uidInput = str;
2255
-
2256
- // Iterate over the array in reverse order
2257
- entries.forEach(([key, value]) => {
2258
- let [start, end] = key.split("_").map(Number);
2259
-
2260
- let pre = uidInput.substring(0, start);
2261
- let post = uidInput.substring(end);
2262
-
2263
- uidInput = pre + value.underlyingText + post;
2264
- });
2265
-
2266
- return uidInput;
2267
- };
2273
+ // Picked mentions become their tokens; token-looking text the user typed is escaped so it
2274
+ // is stored — and rendered on every platform — as text, not a live mention.
2275
+ const getRegexString = (str: string) => insertMentionTokens(str, mentionMap.current.entries());
2268
2276
 
2269
2277
  const getPlainString = (
2270
2278
  str: string,
@@ -2419,7 +2427,7 @@ export const CometChatMessageComposer = React.forwardRef(
2419
2427
  mentionMap.current = deletionMentionMap;
2420
2428
 
2421
2429
  const firstStart = overlaps[0].start;
2422
- InteractionManager.runAfterInteractions(() => {
2430
+ runAfterInteractions(() => {
2423
2431
  messageInputRef.current?.setNativeProps({
2424
2432
  selection: { start: firstStart, end: firstStart },
2425
2433
  });
@@ -2600,9 +2608,9 @@ export const CometChatMessageComposer = React.forwardRef(
2600
2608
  (item.promptText?.length ?? 0) +
2601
2609
  1; // +1 for the space after mention
2602
2610
 
2603
- // On iOS, use InteractionManager to ensure selection is applied after UI updates
2611
+ // On iOS, defer so selection is applied after UI updates
2604
2612
  if (Platform.OS === "ios") {
2605
- InteractionManager.runAfterInteractions(() => {
2613
+ runAfterInteractions(() => {
2606
2614
  setSelectionPosition({
2607
2615
  start: newCursorPosition,
2608
2616
  end: newCursorPosition,
@@ -2736,8 +2744,13 @@ export const CometChatMessageComposer = React.forwardRef(
2736
2744
  {CustomView && CustomView}
2737
2745
  </Modal>
2738
2746
  <KeyboardAvoidingView
2739
- behavior={Platform.OS === "ios" ? "padding" : "height"}
2740
- keyboardVerticalOffset={Platform.select({ ios: kbOffset })}
2747
+ // "padding" on Android too: with edge-to-edge (always on from RN 0.87 / targetSdk 36) the window no
2748
+ // longer resizes for the keyboard, and "height" squashes this composer instead of lifting it.
2749
+ // When the window does resize (adjustResize), the keyboard overlap is 0 and padding adds nothing.
2750
+ behavior="padding"
2751
+ // The view is measured from its parent, the keyboard from the top of the screen: offset by
2752
+ // what sits above the parent — the top safe area on iOS, the status bar on Android.
2753
+ keyboardVerticalOffset={Platform.select({ ios: kbOffset, android: StatusBar.currentHeight ?? 0 })}
2741
2754
  {...keyboardAvoidingViewProps}
2742
2755
  >
2743
2756
  <View
@@ -2857,12 +2870,17 @@ export const CometChatMessageComposer = React.forwardRef(
2857
2870
  <CometChatMessagePreview
2858
2871
  messagePreviewTitle={t("EDIT_MESSAGE")}
2859
2872
  message={messagePreview?.message}
2873
+ textFormatters={textFormatters}
2860
2874
  // Editing a media caption: caption text is the editable subtitle; a muted overline
2861
2875
  // (media-type icon + attachment count) restores the context the hidden thumbnail gave.
2862
2876
  {...(typeof messagePreview?.message?.getCaption === "function"
2863
2877
  ? {
2864
- messagePreviewSubtitle:
2878
+ // A caption arrives as a plain string, so a consumer's token is rewritten
2879
+ // here — `textFormatters` above only covers the message-text path.
2880
+ messagePreviewSubtitle: applyRawFormatters(
2865
2881
  messagePreview.message.getCaption() ?? "",
2882
+ textFormatters
2883
+ ),
2866
2884
  hideSubtitleIcon: true,
2867
2885
  overlineText: attachmentCountLabel(messagePreview.message.getType?.(), messagePreview.message.getAttachments?.()?.length ?? 1),
2868
2886
  }
@@ -2888,6 +2906,7 @@ export const CometChatMessageComposer = React.forwardRef(
2888
2906
  {replyMessage && replyMessage.message && (
2889
2907
  <CometChatMessagePreview
2890
2908
  message={replyMessage.message}
2909
+ textFormatters={textFormatters}
2891
2910
  showCloseIcon={true}
2892
2911
  closeIconURL={ICONS.CLOSE}
2893
2912
  onCloseClick={() => {
@@ -2948,7 +2967,7 @@ export const CometChatMessageComposer = React.forwardRef(
2948
2967
  targetPosition = mentionRange.end;
2949
2968
  }
2950
2969
  if (targetPosition !== cursorPos) {
2951
- InteractionManager.runAfterInteractions(() => {
2970
+ runAfterInteractions(() => {
2952
2971
  // Move the cursor IMPERATIVELY — the input is uncontrolled (the `selection`
2953
2972
  // prop was removed). A controlled `selection` prop re-fires onSelectionChange
2954
2973
  // on every re-render, which hard-freezes iOS once the attachment tray adds
@@ -9,6 +9,7 @@ import {
9
9
  CometChatUIEventHandler,
10
10
  CometChatUiKitConstants,
11
11
  } from "../shared";
12
+ import { CometChatTextFormatter } from "../shared/formatters/CometChatTextFormatter";
12
13
  import { MessageUtils } from "../shared/utils/MessageUtils";
13
14
  import { Style } from "./styles";
14
15
  import { useTheme } from "../theme";
@@ -33,6 +34,11 @@ type Recipient = {
33
34
 
34
35
  export interface CometChatMessageInformationInterface {
35
36
  title?: string;
37
+ /**
38
+ * Text formatters, only needed when this screen is used on its own — opened from the message
39
+ * list, the template it receives already carries them.
40
+ */
41
+ textFormatters?: Array<CometChatTextFormatter>;
36
42
  message: CometChat.BaseMessage;
37
43
  template?: CometChatMessageTemplate;
38
44
  BubbleView?: (message: CometChat.BaseMessage) => JSX.Element;
@@ -60,6 +66,7 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
60
66
  title = t("MESSAGE_INFORMATION"),
61
67
  message,
62
68
  template,
69
+ textFormatters,
63
70
  BubbleView,
64
71
  ListItemView,
65
72
  receiptDatePattern,
@@ -354,7 +361,9 @@ export const CometChatMessageInformation = (props: CometChatMessageInformationIn
354
361
  message,
355
362
  templates: template
356
363
  ? [template]
357
- : ChatConfigurator.dataSource.getAllMessageTemplates(theme),
364
+ // Opened straight from the message list, the template above already carries the
365
+ // consumer's formatters. Standalone, they have to come in through the prop.
366
+ : ChatConfigurator.dataSource.getAllMessageTemplates(theme, { textFormatters }),
358
367
  alignment: "right",
359
368
  theme: theme,
360
369
  })}