@cometchat/chat-uikit-react-native 5.2.3 → 5.2.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 (75) hide show
  1. package/package.json +1 -1
  2. package/src/CometChatConversations/CometChatConversations.tsx +167 -86
  3. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +312 -116
  4. package/src/CometChatMessageComposer/styles.tsx +2 -1
  5. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +83 -17
  6. package/src/CometChatMessageList/CometChatMessageList.tsx +549 -70
  7. package/src/CometChatMessageList/style.ts +4 -2
  8. package/src/CometChatSearch/CometChatSearch.tsx +1718 -0
  9. package/src/CometChatSearch/SearchConstants.ts +46 -0
  10. package/src/CometChatSearch/Skeleton.tsx +192 -0
  11. package/src/CometChatSearch/index.ts +1 -0
  12. package/src/CometChatSearch/style.ts +414 -0
  13. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +43 -7
  14. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +45 -7
  15. package/src/extensions/Polls/Polls.tsx +36 -2
  16. package/src/extensions/Polls/PollsBubble.tsx +13 -9
  17. package/src/extensions/Polls/PollsDecorator.tsx +13 -1
  18. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +50 -11
  19. package/src/extensions/Stickers/style.ts +0 -1
  20. package/src/index.ts +5 -0
  21. package/src/shared/base/Types.ts +8 -0
  22. package/src/shared/constants/UIKitConstants.ts +2 -0
  23. package/src/shared/events/CometChatMessageEvents/index.ts +8 -7
  24. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
  25. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +158 -27
  26. package/src/shared/framework/DataSource.ts +7 -0
  27. package/src/shared/framework/DataSourceDecorator.tsx +12 -0
  28. package/src/shared/framework/MessageDataSource.tsx +182 -1
  29. package/src/shared/helper/functions.js +0 -67
  30. package/src/shared/helper/helperFunctions.ts +73 -0
  31. package/src/shared/icons/components/documents.tsx +23 -0
  32. package/src/shared/icons/components/empty-search.tsx +52 -0
  33. package/src/shared/icons/components/message-blocked.tsx +1 -1
  34. package/src/shared/icons/components/unread.tsx +29 -0
  35. package/src/shared/icons/icon-mapping.tsx +7 -0
  36. package/src/shared/index.ts +2 -1
  37. package/src/shared/modals/CometChatMessageTemplate.ts +23 -0
  38. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +4 -4
  39. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +17 -1
  40. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +70 -34
  41. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +60 -24
  42. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +37 -1
  43. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +60 -24
  44. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +37 -1
  45. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +37 -1
  46. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +37 -1
  47. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +37 -1
  48. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +40 -4
  49. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +37 -1
  50. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +37 -1
  51. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +37 -1
  52. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +37 -1
  53. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +38 -2
  54. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +37 -1
  55. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +37 -1
  56. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +40 -4
  57. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +274 -23
  58. package/src/shared/utils/MessageUtils.tsx +0 -1
  59. package/src/shared/views/CometChatAudioBubble/style.ts +0 -2
  60. package/src/shared/views/CometChatFileBubble/style.ts +0 -4
  61. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
  62. package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
  63. package/src/shared/views/CometChatList/Header.tsx +79 -49
  64. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
  65. package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +390 -0
  66. package/src/shared/views/CometChatReportDialog/index.ts +3 -0
  67. package/src/shared/views/CometChatReportDialog/style.ts +164 -0
  68. package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
  69. package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
  70. package/src/shared/views/CometChatStatusIndicator/styles.ts +2 -2
  71. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +18 -2
  72. package/src/shared/views/index.ts +6 -0
  73. package/src/theme/default/default.ts +3 -0
  74. package/src/theme/provider.tsx +7 -5
  75. package/src/theme/type.ts +2 -0
@@ -1,4 +1,5 @@
1
1
  import React, { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
2
+ import { Keyboard } from "react-native";
2
3
  import {
3
4
  ColorValue,
4
5
  Dimensions,
@@ -45,6 +46,7 @@ import {
45
46
  } from "../shared/constants/UIKitConstants";
46
47
  import { MessageEvents } from "../shared/events";
47
48
  import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandler/CometChatUIEventHandler";
49
+ import { CometChatMessageEvents } from "../shared/events/CometChatMessageEvents";
48
50
  import { CometChatMessageComposerAction, DeepPartial } from "../shared/helper/types";
49
51
  import { Icon } from "../shared/icons/Icon";
50
52
  import { CometChatSendButtonView } from "../shared/views/CometChatSendButtonView/CometChatSendButtonView";
@@ -74,18 +76,7 @@ const { FileManager, CommonUtil } = NativeModules;
74
76
  const uiEventListenerShow = "uiEvent_show_" + new Date().getTime();
75
77
  const uiEventListenerHide = "uiEvent_hide_" + new Date().getTime();
76
78
 
77
- const MessagePreviewTray = (props: any) => {
78
- const { shouldShow = false, text = "", onClose = () => {} } = props;
79
- const {t}= useCometChatTranslation()
80
- return shouldShow ? (
81
- <CometChatMessagePreview
82
- messagePreviewTitle={t("EDIT_MESSAGE")}
83
- messagePreviewSubtitle={text}
84
- closeIconURL={ICONS.CLOSE}
85
- onCloseClick={onClose}
86
- />
87
- ) : null;
88
- };
79
+
89
80
 
90
81
  const AttachIconButton = (props: {
91
82
  onPress: TouchableWithoutFeedbackProps["onPress"];
@@ -340,6 +331,21 @@ export interface CometChatMessageComposerInterface {
340
331
  */
341
332
  disableMentions?: boolean;
342
333
 
334
+ /**
335
+ * Flag to disable the special group mention (@all / @channel etc.).
336
+ * When true, the alias suggestion will not appear.
337
+ * @default false
338
+ */
339
+ disableMentionAll?: boolean;
340
+
341
+ /**
342
+ * Custom alias label for the group-wide mention.
343
+ * Rendered as @Alias in composer and bubbles.
344
+ * Internally stored as <@all:Alias>.
345
+ * @default "all"
346
+ */
347
+ mentionAllLabel?: string;
348
+
343
349
  /**
344
350
  * Controls image quality when taking pictures from the camera.
345
351
  * A value of 100 means no compression.
@@ -445,6 +451,7 @@ export interface CometChatMessageComposerInterface {
445
451
  export const CometChatMessageComposer = React.forwardRef(
446
452
  (props: CometChatMessageComposerInterface, ref) => {
447
453
  const editMessageListenerID = "editMessageListener_" + new Date().getTime();
454
+ const replyMessageListenerID = "replyMessageListener_" + new Date().getTime();
448
455
  const UiEventListenerID = "UiEventListener_" + new Date().getTime();
449
456
 
450
457
  const theme = useTheme();
@@ -470,6 +477,8 @@ export const CometChatMessageComposer = React.forwardRef(
470
477
  keyboardAvoidingViewProps,
471
478
  textFormatters,
472
479
  disableMentions: propDisableMentions,
480
+ disableMentionAll = false,
481
+ mentionAllLabel = "all",
473
482
  imageQuality = 20,
474
483
  hideCameraOption = false,
475
484
  hideImageAttachmentOption = false,
@@ -519,17 +528,7 @@ export const CometChatMessageComposer = React.forwardRef(
519
528
  return mergedStyle;
520
529
  }, [theme, style, isAgenticUser]);
521
530
 
522
- const defaultAuxiliaryButtonOptions = useMemo(() => {
523
- if (hideAuxiliaryButtons) return [];
524
- return ChatConfigurator.getDataSource().getAuxiliaryOptions(user, group, composerIdMap, {
525
- stickerIcon: mergedComposerStyle.stickerIcon as ImageSourcePropType | JSX.Element,
526
- stickerIconStyle: mergedComposerStyle.stickerIconStyle as {
527
- active: ImageStyle;
528
- inactive: ImageStyle;
529
- },
530
- hideStickersButton,
531
- });
532
- }, [mergedComposerStyle, hideStickersButton, hideAuxiliaryButtons]);
531
+
533
532
 
534
533
  const loggedInUser = React.useRef<any>({});
535
534
  const chatWith = React.useRef<any>(null);
@@ -563,6 +562,9 @@ export const CometChatMessageComposer = React.forwardRef(
563
562
  const [showRecordAudio, setShowRecordAudio] = React.useState(false);
564
563
  const [actionSheetItems, setActionSheetItems] = React.useState<any[]>([]);
565
564
  const [messagePreview, setMessagePreview] = React.useState<any>();
565
+ const [replyMessage, setReplyMessage] = React.useState<any>();
566
+ // Ref to hold current replyMessage value to avoid stale closures in attachment handlers
567
+ const replyMessageRef = React.useRef(replyMessage);
566
568
  const [CustomView, setCustomView] = React.useState(null);
567
569
  const [CustomViewHeader, setCustomViewHeader] = React.useState<React.FC | React.ReactNode>(
568
570
  null
@@ -580,12 +582,30 @@ export const CometChatMessageComposer = React.forwardRef(
580
582
  const bottomSheetRef = React.useRef<any>(null);
581
583
  const [showStopButton, setShowStopButton] = React.useState(false);
582
584
 
585
+ const closeReplyPreview = useCallback(() => {
586
+ setReplyMessage(null);
587
+ }, []);
588
+
583
589
  // Reset streaming state when component mounts
590
+ const defaultAuxiliaryButtonOptions = useMemo(() => {
591
+ if (hideAuxiliaryButtons) return [];
592
+ return ChatConfigurator.getDataSource().getAuxiliaryOptions(user, group, composerIdMap, {
593
+ stickerIcon: mergedComposerStyle.stickerIcon as ImageSourcePropType | JSX.Element,
594
+ stickerIconStyle: mergedComposerStyle.stickerIconStyle as {
595
+ active: ImageStyle;
596
+ inactive: ImageStyle;
597
+ },
598
+ hideStickersButton,
599
+ replyToMessage: replyMessage?.message,
600
+ closeReplyPreview,
601
+ });
602
+ }, [mergedComposerStyle, hideStickersButton, hideAuxiliaryButtons, replyMessage, closeReplyPreview]);
603
+
584
604
  useEffect(() => {
585
605
  setShowStopButton(false);
586
606
  setIsStreaming(false);
587
607
  }, []);
588
-
608
+
589
609
  useLayoutEffect(() => {
590
610
  if (Platform.OS === "ios") {
591
611
  if (Number.isInteger(commonVars.safeAreaInsets.top)) {
@@ -618,7 +638,7 @@ export const CometChatMessageComposer = React.forwardRef(
618
638
  try {
619
639
  stopStreamingForRunId();
620
640
  } catch (error) {
621
- console.log(error);
641
+ // console.log(error); // Removed debug log
622
642
  }
623
643
  }
624
644
  }));
@@ -657,8 +677,16 @@ export const CometChatMessageComposer = React.forwardRef(
657
677
  setCustomViewHeader(null);
658
678
  }, [warningMessage, theme]);
659
679
 
680
+ // Keep replyMessageRef in sync with replyMessage state
681
+ useEffect(() => {
682
+ replyMessageRef.current = replyMessage;
683
+ }, [replyMessage]);
684
+
660
685
  const previewMessage = ({ message, status }: any) => {
661
686
  if (status === messageStatus.inprogress) {
687
+ // Don't clear reply preview here - it needs to remain available for sendMediaMessage
688
+ // The reply preview will be cleared after successful send in sendMediaMessage (line 1127)
689
+
662
690
  let textComponents = message?.text;
663
691
 
664
692
  let rawText = message?.text;
@@ -731,6 +759,27 @@ export const CometChatMessageComposer = React.forwardRef(
731
759
  }
732
760
  };
733
761
 
762
+ const previewReplyMessage = (message: any) => {
763
+ // Clear edit preview if it exists
764
+ if (messagePreview) {
765
+ setMessagePreview(null);
766
+ mentionMap.current = new Map();
767
+ plainTextInput.current = "";
768
+ setOriginalText("");
769
+ }
770
+
771
+ setReplyMessage({
772
+ message: message,
773
+ mode: ConversationOptionConstants.reply,
774
+ });
775
+
776
+ try {
777
+ messageInputRef.current?.focus();
778
+ } catch (error) {
779
+ // console.log(error); // Removed debug log
780
+ }
781
+ };
782
+
734
783
  const cameraCallback = async (cameraImage: any) => {
735
784
  if (CheckPropertyExists(cameraImage, "error")) {
736
785
  return;
@@ -800,10 +849,20 @@ export const CometChatMessageComposer = React.forwardRef(
800
849
  setHasEdited(false);
801
850
  setInputMessage("");
802
851
  setWarningMessage("");
852
+ setReplyMessage(null);
853
+ };
854
+
855
+ const clearEditPreview = () => {
856
+ inputValueRef.current = "";
857
+ setPlainText("");
858
+ setHasEdited(false);
859
+ setInputMessage("");
860
+ setWarningMessage("");
803
861
  };
804
862
 
805
863
  const sendTextMessage = () => {
806
- setShowStopButton(true);
864
+ setShowStopButton(true);
865
+
807
866
  //ignore sending new message
808
867
  if (messagePreview != null) {
809
868
  editMessage(messagePreview.message);
@@ -813,6 +872,12 @@ export const CometChatMessageComposer = React.forwardRef(
813
872
  let finalTextInput = getRegexString(plainTextInput.current);
814
873
  let trimmedTextInput = finalTextInput.trim();
815
874
 
875
+ if (trimmedTextInput.trim().length === 0) {
876
+ return;
877
+ }
878
+ const currentReplyMessage = replyMessage;
879
+ const replyMessageId = currentReplyMessage?.message?.getId?.() ?? null;
880
+
816
881
  let textMessage = new CometChat.TextMessage(
817
882
  chatWithId.current,
818
883
  trimmedTextInput,
@@ -821,13 +886,29 @@ export const CometChatMessageComposer = React.forwardRef(
821
886
 
822
887
  textMessage.setSender(loggedInUser.current);
823
888
  textMessage.setReceiver(chatWith.current);
824
- // Use the trimmed text here as well
825
889
  textMessage.setText(trimmedTextInput);
826
890
  textMessage.setMuid(String(getUnixTimestampInMilliseconds()));
827
- const currentParentId = parentMessageId || (isAgenticUser() ? parentMessageIdRef.current : null);
828
891
 
829
- if (currentParentId) {
830
- textMessage.setParentMessageId(currentParentId as number);
892
+ // Handle parent message ID for threaded messages
893
+ if (parentMessageId) {
894
+ textMessage.setParentMessageId(parentMessageId as number);
895
+ } else if (isAgenticUser() && parentMessageIdRef.current) {
896
+ textMessage.setParentMessageId(Number(parentMessageIdRef.current));
897
+ }
898
+
899
+ // Handle reply message - set quoted message for replies
900
+ if (replyMessageId && currentReplyMessage?.message) {
901
+ try {
902
+ // Use only the SDK's built-in quoted message functionality
903
+ if (typeof textMessage.setQuotedMessage === 'function') {
904
+ textMessage.setQuotedMessage(currentReplyMessage.message);
905
+ }
906
+ if (typeof textMessage.setQuotedMessageId === 'function') {
907
+ textMessage.setQuotedMessageId(replyMessageId);
908
+ }
909
+ } catch (error) {
910
+ // console.log(error); // Removed debug log
911
+ }
831
912
  }
832
913
 
833
914
  allFormatters.current.forEach((item) => {
@@ -837,11 +918,13 @@ export const CometChatMessageComposer = React.forwardRef(
837
918
  setMentionsSearchData([]);
838
919
  plainTextInput.current = "";
839
920
 
840
- if (trimmedTextInput.trim().length === 0) {
841
- return;
842
- }
843
-
844
- clearInputBox();
921
+ // Clear input and reply message immediately for better UX
922
+ inputValueRef.current = "";
923
+ setPlainText("");
924
+ setHasEdited(false);
925
+ setInputMessage("");
926
+ setWarningMessage("");
927
+ setReplyMessage(null);
845
928
 
846
929
  if (onSendButtonPress) {
847
930
  onSendButtonPress(textMessage);
@@ -879,7 +962,6 @@ export const CometChatMessageComposer = React.forwardRef(
879
962
  message: textMessage,
880
963
  status: messageStatus.error,
881
964
  });
882
- clearInputBox();
883
965
  });
884
966
  };
885
967
 
@@ -952,7 +1034,26 @@ export const CometChatMessageComposer = React.forwardRef(
952
1034
  url: messageInput["uri"],
953
1035
  sender: loggedInUser.current,
954
1036
  });
955
- parentMessageId && mediaMessage.setParentMessageId(parentMessageId as number);
1037
+ // Use ref to get current replyMessage value (avoids stale closure)
1038
+ const currentReplyMessage = replyMessageRef.current;
1039
+ const replyMessageId = currentReplyMessage?.message?.getId?.() ?? null;
1040
+ if (replyMessageId) {
1041
+ if (currentReplyMessage?.message) {
1042
+ if (typeof mediaMessage.setQuotedMessage === 'function') {
1043
+ mediaMessage.setQuotedMessage(currentReplyMessage.message);
1044
+ }
1045
+ if (typeof mediaMessage.setQuotedMessageId === 'function') {
1046
+ mediaMessage.setQuotedMessageId(replyMessageId);
1047
+ }
1048
+ // Store full message object directly on the message (not in metadata)
1049
+ (mediaMessage as any).quotedMessage = currentReplyMessage.message;
1050
+ (mediaMessage as any).quotedMessageId = replyMessageId;
1051
+
1052
+ // Don't store in metadata - it exceeds size limit and SDK handles it
1053
+ }
1054
+ } else if (parentMessageId) {
1055
+ mediaMessage.setParentMessageId(parentMessageId as number);
1056
+ }
956
1057
 
957
1058
  let localMessage = new CometChat.MediaMessage(
958
1059
  receiverId,
@@ -973,7 +1074,26 @@ export const CometChatMessageComposer = React.forwardRef(
973
1074
  url: messageInput["uri"],
974
1075
  sender: loggedInUser.current,
975
1076
  });
976
- parentMessageId && localMessage.setParentMessageId(parentMessageId as number);
1077
+ if (replyMessageId) {
1078
+ if (currentReplyMessage?.message) {
1079
+ if (typeof localMessage.setQuotedMessage === 'function') {
1080
+ localMessage.setQuotedMessage(currentReplyMessage.message);
1081
+ }
1082
+ if (typeof localMessage.setQuotedMessageId === 'function') {
1083
+ localMessage.setQuotedMessageId(replyMessageId);
1084
+ }
1085
+ (localMessage as any).quotedMessage = currentReplyMessage.message;
1086
+ (localMessage as any).quotedMessageId = replyMessageId;
1087
+ const currentMetadata = localMessage.getMetadata() || {};
1088
+ localMessage.setMetadata({
1089
+ ...currentMetadata,
1090
+ quotedMessage: currentReplyMessage.message,
1091
+ quotedMessageId: replyMessageId
1092
+ });
1093
+ }
1094
+ } else if (parentMessageId) {
1095
+ localMessage.setParentMessageId(parentMessageId as number);
1096
+ }
977
1097
  localMessage.setData({
978
1098
  type: messageType,
979
1099
  category: CometChat.CATEGORY_MESSAGE,
@@ -996,6 +1116,13 @@ export const CometChatMessageComposer = React.forwardRef(
996
1116
  message: message,
997
1117
  status: messageStatus.success,
998
1118
  });
1119
+ if (replyMessageId) {
1120
+ CometChatMessageEvents.emit(CometChatMessageEvents.ccReplyToMessage, {
1121
+ message: message,
1122
+ status: messageStatus.success,
1123
+ });
1124
+ }
1125
+ setReplyMessage(null);
999
1126
  setShowRecordAudio(false);
1000
1127
  })
1001
1128
  .catch((error: any) => {
@@ -1006,7 +1133,8 @@ export const CometChatMessageComposer = React.forwardRef(
1006
1133
  message: localMessage,
1007
1134
  status: messageStatus.error,
1008
1135
  });
1009
- console.log("media message sent error", error);
1136
+ setReplyMessage(null);
1137
+ // console.log("media message sent error", error); // Removed debug log
1010
1138
  });
1011
1139
  };
1012
1140
 
@@ -1065,7 +1193,10 @@ export const CometChatMessageComposer = React.forwardRef(
1065
1193
  if (hideAttachmentButton || !actionSheetItems.length) return <></>;
1066
1194
  return (
1067
1195
  <AttachIconButton
1068
- onPress={() => setShowActionSheet(true)}
1196
+ onPress={() => {
1197
+ Keyboard.dismiss();
1198
+ setTimeout(() => setShowActionSheet(true), 50);
1199
+ }}
1069
1200
  icon={mergedComposerStyle.attachmentIcon as JSX.Element | ImageSourcePropType}
1070
1201
  iconStyle={mergedComposerStyle.attachmentIconStyle as ImageStyle}
1071
1202
  />
@@ -1080,7 +1211,12 @@ export const CometChatMessageComposer = React.forwardRef(
1080
1211
  iconStyle?: ImageStyle;
1081
1212
  }) => {
1082
1213
  return (
1083
- <TouchableOpacity onPress={() => setShowRecordAudio(true)}>
1214
+ <TouchableOpacity
1215
+ onPress={() => {
1216
+ Keyboard.dismiss();
1217
+ setTimeout(() => setShowRecordAudio(true), 50);
1218
+ }}
1219
+ >
1084
1220
  <Icon
1085
1221
  name='mic'
1086
1222
  height={24}
@@ -1095,7 +1231,7 @@ export const CometChatMessageComposer = React.forwardRef(
1095
1231
 
1096
1232
  const voiceRecoringButtonElem = useMemo(() => {
1097
1233
  const isAgenticUser = user?.getRole?.() === '@agentic';
1098
-
1234
+
1099
1235
  return (hideVoiceRecordingButton || isAgenticUser) ? undefined : (
1100
1236
  <RecordAudioButtonView
1101
1237
  icon={mergedComposerStyle.voiceRecordingIcon as ImageSourcePropType | JSX.Element}
@@ -1106,14 +1242,14 @@ export const CometChatMessageComposer = React.forwardRef(
1106
1242
 
1107
1243
  const AuxiliaryButtonViewElem = useCallback(() => {
1108
1244
  const isAgenticUser = user?.getRole?.() === '@agentic';
1109
-
1245
+
1110
1246
  if (AuxiliaryButtonView)
1111
1247
  return <AuxiliaryButtonView user={user} group={group} composerId={id!} />;
1112
-
1248
+
1113
1249
  if (isAgenticUser) {
1114
1250
  return <></>;
1115
1251
  }
1116
-
1252
+
1117
1253
  if (defaultAuxiliaryButtonOptions)
1118
1254
  return (
1119
1255
  <View
@@ -1145,9 +1281,9 @@ export const CometChatMessageComposer = React.forwardRef(
1145
1281
 
1146
1282
  const SendButtonViewElem = useCallback(() => {
1147
1283
  if (hideSendButton) return <></>;
1148
-
1284
+
1149
1285
  const isAgenticUserCheck = isAgenticUser();
1150
-
1286
+
1151
1287
  if (isAgenticUserCheck) {
1152
1288
  const disabled = isStreaming || plainText.trim().length === 0 || (messagePreview && !hasEdited);
1153
1289
  const SendButtonComponent = DefaultAgentSendButtonView;
@@ -1163,7 +1299,7 @@ export const CometChatMessageComposer = React.forwardRef(
1163
1299
  };
1164
1300
  return <SendButtonComponent isButtonDisabled={disabled} composerRef={composerRef} />;
1165
1301
  }
1166
-
1302
+
1167
1303
  if (SendButtonView) return <SendButtonView user={user} group={group} composerId={id!} />;
1168
1304
  const disabled = isStreaming || plainText.trim().length === 0 || (messagePreview && !hasEdited);
1169
1305
  return (
@@ -1208,6 +1344,9 @@ export const CometChatMessageComposer = React.forwardRef(
1208
1344
  );
1209
1345
  mentionsFormatter.setTargetElement(MentionsTargetElement.textinput);
1210
1346
 
1347
+ if (mentionAllLabel) mentionsFormatter.setMentionAllLabel(mentionAllLabel);
1348
+ mentionsFormatter.setDisableMentionAll(disableMentionAll);
1349
+
1211
1350
  if (user) mentionsFormatter.setUser(user);
1212
1351
  if (group) mentionsFormatter.setGroup(group);
1213
1352
 
@@ -1281,17 +1420,39 @@ export const CometChatMessageComposer = React.forwardRef(
1281
1420
  hidePollsAttachmentOption,
1282
1421
  hideCollaborativeDocumentOption,
1283
1422
  hideCollaborativeWhiteboardOption,
1423
+ replyToMessage: replyMessage?.message,
1424
+ closeReplyPreview: () => setReplyMessage(null),
1284
1425
  }
1285
1426
  );
1286
1427
  setActionSheetItems(() =>
1287
1428
  attachmentOptions && typeof attachmentOptions === "function"
1288
1429
  ? attachmentOptions({ user, group, composerId: composerIdMap })?.map((item) => {
1430
+ if (typeof item.CustomView === "function")
1431
+ return {
1432
+ ...item,
1433
+ onPress: () => handleOnClick(item.CustomView),
1434
+ };
1435
+ if (typeof item.onPress == "function")
1436
+ return {
1437
+ ...item,
1438
+ onPress: () => {
1439
+ setShowActionSheet(false);
1440
+ item.onPress?.(user, group);
1441
+ },
1442
+ };
1443
+ return {
1444
+ ...item,
1445
+ onPress: () => fileInputHandler(item.id),
1446
+ };
1447
+ })
1448
+ : [
1449
+ ...defaultAttachmentOptions.map((item: any) => {
1289
1450
  if (typeof item.CustomView === "function")
1290
1451
  return {
1291
1452
  ...item,
1292
1453
  onPress: () => handleOnClick(item.CustomView),
1293
1454
  };
1294
- if (typeof item.onPress == "function")
1455
+ if (typeof item.onPress === "function")
1295
1456
  return {
1296
1457
  ...item,
1297
1458
  onPress: () => {
@@ -1303,15 +1464,15 @@ export const CometChatMessageComposer = React.forwardRef(
1303
1464
  ...item,
1304
1465
  onPress: () => fileInputHandler(item.id),
1305
1466
  };
1306
- })
1307
- : [
1308
- ...defaultAttachmentOptions.map((item: any) => {
1467
+ }),
1468
+ ...(addAttachmentOptions && typeof addAttachmentOptions === "function"
1469
+ ? addAttachmentOptions({ user, group, composerId: composerIdMap })?.map((item) => {
1309
1470
  if (typeof item.CustomView === "function")
1310
1471
  return {
1311
1472
  ...item,
1312
1473
  onPress: () => handleOnClick(item.CustomView),
1313
1474
  };
1314
- if (typeof item.onPress === "function")
1475
+ if (typeof item.onPress == "function")
1315
1476
  return {
1316
1477
  ...item,
1317
1478
  onPress: () => {
@@ -1323,29 +1484,9 @@ export const CometChatMessageComposer = React.forwardRef(
1323
1484
  ...item,
1324
1485
  onPress: () => fileInputHandler(item.id),
1325
1486
  };
1326
- }),
1327
- ...(addAttachmentOptions && typeof addAttachmentOptions === "function"
1328
- ? addAttachmentOptions({ user, group, composerId: composerIdMap })?.map((item) => {
1329
- if (typeof item.CustomView === "function")
1330
- return {
1331
- ...item,
1332
- onPress: () => handleOnClick(item.CustomView),
1333
- };
1334
- if (typeof item.onPress == "function")
1335
- return {
1336
- ...item,
1337
- onPress: () => {
1338
- setShowActionSheet(false);
1339
- item.onPress?.(user, group);
1340
- },
1341
- };
1342
- return {
1343
- ...item,
1344
- onPress: () => fileInputHandler(item.id),
1345
- };
1346
- })
1347
- : []),
1348
- ]
1487
+ })
1488
+ : []),
1489
+ ]
1349
1490
  );
1350
1491
  }, [
1351
1492
  user,
@@ -1361,6 +1502,7 @@ export const CometChatMessageComposer = React.forwardRef(
1361
1502
  hideCollaborativeDocumentOption,
1362
1503
  hideCollaborativeWhiteboardOption,
1363
1504
  addAttachmentOptions,
1505
+ replyMessage,
1364
1506
  ]);
1365
1507
 
1366
1508
  useEffect(() => {
@@ -1374,6 +1516,16 @@ export const CometChatMessageComposer = React.forwardRef(
1374
1516
  }
1375
1517
  },
1376
1518
  });
1519
+ CometChatMessageEvents.addListener(
1520
+ CometChatMessageEvents.ccReplyToMessage,
1521
+ replyMessageListenerID,
1522
+ (data: any) => {
1523
+ if (data.status === messageStatus.inprogress) {
1524
+ previewReplyMessage(data.message);
1525
+ } else if (data.status === messageStatus.success) {
1526
+ }
1527
+ }
1528
+ );
1377
1529
  CometChatUIEventHandler.addUIListener(UiEventListenerID, {
1378
1530
  ccToggleBottomSheet: (item) => {
1379
1531
  if (item?.bots) {
@@ -1410,6 +1562,7 @@ export const CometChatMessageComposer = React.forwardRef(
1410
1562
  });
1411
1563
  return () => {
1412
1564
  CometChatUIEventHandler.removeMessageListener(editMessageListenerID);
1565
+ CometChatMessageEvents.removeListener(CometChatMessageEvents.ccReplyToMessage, replyMessageListenerID);
1413
1566
  CometChatUIEventHandler.removeUIListener(UiEventListenerID);
1414
1567
  };
1415
1568
  }, []);
@@ -1424,7 +1577,6 @@ export const CometChatMessageComposer = React.forwardRef(
1424
1577
  else if (item.alignment === ViewAlignment.composerBottom) setCustomViewFooter(undefined);
1425
1578
  }
1426
1579
  };
1427
-
1428
1580
  useEffect(() => {
1429
1581
  CometChatUIEventHandler.addUIListener(uiEventListenerShow, {
1430
1582
  showPanel: (item) => handlePannel(item),
@@ -1444,9 +1596,9 @@ export const CometChatMessageComposer = React.forwardRef(
1444
1596
  type: "audio/mp4",
1445
1597
  uri: recordedFile,
1446
1598
  };
1447
- console.log("fileObj", fileObj);
1599
+ // console.log("fileObj", fileObj); // Removed debug log
1448
1600
  sendMediaMessage(chatWithId.current, fileObj, MessageTypeConstants.audio, chatWith.current);
1449
- console.log("Send Audio");
1601
+ // console.log("Send Audio"); // Removed debug log
1450
1602
  };
1451
1603
 
1452
1604
  function isCursorWithinMentionRange(mentionRanges: any, cursorPosition: number) {
@@ -1473,11 +1625,11 @@ export const CometChatMessageComposer = React.forwardRef(
1473
1625
  trackingCharacters.current.includes(tracker) &&
1474
1626
  (searchString === ""
1475
1627
  ? (plainTextInput.current[selection.start - 2]?.length === 1 &&
1476
- plainTextInput.current[selection.start - 2]?.trim()?.length === 0) ||
1477
- plainTextInput.current[selection.start - 2] === undefined
1628
+ plainTextInput.current[selection.start - 2]?.trim()?.length === 0) ||
1629
+ plainTextInput.current[selection.start - 2] === undefined
1478
1630
  : true) &&
1479
1631
  (plainTextInput.current[selection.start - 1]?.length === 1 &&
1480
- plainTextInput.current[selection.start - 1]?.trim()?.length === 0
1632
+ plainTextInput.current[selection.start - 1]?.trim()?.length === 0
1481
1633
  ? searchString.length > 0
1482
1634
  : true)
1483
1635
  );
@@ -1585,9 +1737,9 @@ export const CometChatMessageComposer = React.forwardRef(
1585
1737
  ) => {
1586
1738
  return selection.start === selection.end
1587
1739
  ? {
1588
- start: Math.max(0, selection.start - deletionLength),
1589
- end: selection.start,
1590
- }
1740
+ start: Math.max(0, selection.start - deletionLength),
1741
+ end: selection.start,
1742
+ }
1591
1743
  : { start: selection.start, end: selection.end };
1592
1744
  };
1593
1745
 
@@ -1980,7 +2132,7 @@ export const CometChatMessageComposer = React.forwardRef(
1980
2132
  ? targetedFormatter?.getErrorString()
1981
2133
  : `${t("MENTION_UPTO")} ${limit} ${
1982
2134
  limit === 1 ? t("TIME") : t("TIMES")
1983
- } ${t("AT_A_TIME")}.`
2135
+ } ${t("AT_A_TIME")}.`
1984
2136
  );
1985
2137
  return true;
1986
2138
  };
@@ -2037,7 +2189,7 @@ export const CometChatMessageComposer = React.forwardRef(
2037
2189
  mediaRecorderStyle={mergedComposerStyle.mediaRecorderStyle}
2038
2190
  />
2039
2191
 
2040
- {showMentionList && (plainTextInput.current?.length ?? 0) > 0 && (
2192
+ {showMentionList && (plainTextInput.current?.length ?? 0) > 0 && mentionsSearchData.length > 0 && (
2041
2193
  <View
2042
2194
  style={[
2043
2195
  theme.mentionsListStyle.containerStyle,
@@ -2057,37 +2209,80 @@ export const CometChatMessageComposer = React.forwardRef(
2057
2209
 
2058
2210
  <View
2059
2211
  style={[
2060
- { flexDirection: "column" },
2061
- mentionsSearchData.length
2062
- ? { maxHeight: Dimensions.get("window").height * 0.2 }
2063
- : { maxHeight: Dimensions.get("window").height * 0.3 },
2212
+ {
2213
+ flexDirection: "column",
2214
+ ...(messagePreview || replyMessage ? {
2215
+ backgroundColor: theme.color.background1,
2216
+ borderTopRightRadius: 8,
2217
+ borderTopLeftRadius: 8,
2218
+ paddingHorizontal: theme.spacing.padding.p1,
2219
+ // paddingTop: theme.spacing.padding.p1,
2220
+ } : {}),
2221
+ },
2064
2222
  ]}
2065
2223
  >
2066
2224
  {HeaderView
2067
2225
  ? HeaderView({ user, group })
2068
2226
  : CustomViewHeader &&
2069
- (typeof CustomViewHeader === "function" ? (
2070
- <CustomViewHeader /> // Invoke CustomViewHeader if it's a functional component
2071
- ) : (
2072
- CustomViewHeader // Render it directly if it's a React node
2073
- ))}
2074
- <MessagePreviewTray
2075
- onClose={() => {
2076
- setMessagePreview(null);
2077
- clearInputBox();
2078
- mentionMap.current = new Map();
2079
- plainTextInput.current = "";
2080
- setOriginalText("");
2081
- }}
2082
- text={messagePreview?.message?.text}
2083
- shouldShow={messagePreview != null}
2084
- />
2227
+ (typeof CustomViewHeader === "function" ? (
2228
+ <CustomViewHeader /> // Invoke CustomViewHeader if it's a functional component
2229
+ ) : (
2230
+ CustomViewHeader // Render it directly if it's a React node
2231
+ ))}
2232
+ {messagePreview && (
2233
+ <CometChatMessagePreview
2234
+ messagePreviewTitle={t("EDIT_MESSAGE")}
2235
+ messagePreviewSubtitle={messagePreview?.message?.text || "Message"}
2236
+ showCloseIcon={true}
2237
+ closeIconURL={ICONS.CLOSE}
2238
+ onCloseClick={() => {
2239
+ setMessagePreview(null);
2240
+ clearEditPreview();
2241
+ mentionMap.current = new Map();
2242
+ plainTextInput.current = "";
2243
+ setOriginalText("");
2244
+ }}
2245
+ style={{
2246
+ borderRadius: 8,
2247
+ borderWidth: 0,
2248
+ borderLeftWidth: 3,
2249
+ borderLeftColor: theme.color.borderHighlight,
2250
+ margin:theme.spacing.padding.p1,
2251
+ }}
2252
+ />
2253
+ )}
2254
+ {replyMessage && replyMessage.message && (
2255
+ <CometChatMessagePreview
2256
+ message={replyMessage.message}
2257
+ showCloseIcon={true}
2258
+ closeIconURL={ICONS.CLOSE}
2259
+ onCloseClick={() => {
2260
+ setReplyMessage(null);
2261
+ }}
2262
+ titleStyle={{ color: theme.color.textHighlight }}
2263
+ style={{
2264
+ borderRadius: 8,
2265
+ borderLeftWidth: 3,
2266
+ borderLeftColor: theme.color.borderHighlight,
2267
+ margin:theme.spacing.padding.p1,
2268
+ }}
2269
+ />
2270
+ )}
2085
2271
  </View>
2086
2272
  <CometChatMessageInput
2087
2273
  messageInputRef={messageInputRef}
2088
2274
  text={inputMessage as string}
2089
2275
  placeHolderText={isAgenticUser()? t("ASK_ANYTHING") : t("ENTER_YOUR_MESSAGE_HERE")}
2090
- style={mergedComposerStyle.messageInputStyles}
2276
+ style={{
2277
+ ...mergedComposerStyle.messageInputStyles,
2278
+ containerStyle: {
2279
+ ...mergedComposerStyle.messageInputStyles?.containerStyle,
2280
+ ...(messagePreview || replyMessage ? {
2281
+ borderTopLeftRadius: 0,
2282
+ borderTopRightRadius: 0,
2283
+ } : {}),
2284
+ },
2285
+ }}
2091
2286
  onSelectionChange={({ nativeEvent: { selection } }) => {
2092
2287
  setSelectionPosition(selection);
2093
2288
  openList(selection);
@@ -2099,17 +2294,18 @@ export const CometChatMessageComposer = React.forwardRef(
2099
2294
  PrimaryButtonView={SendButtonViewElem}
2100
2295
  auxiliaryButtonAlignment={auxiliaryButtonsAlignment}
2101
2296
  />
2102
- {CustomViewFooter ? (
2103
- // If CustomViewFooter is a function component (React.FC)
2104
- typeof CustomViewFooter === "function" ? (
2105
- <CustomViewFooter /> // Invoke the function component
2106
- ) : (
2107
- CustomViewFooter // Render it directly if it's a React node (JSX or element)
2108
- )
2109
- ) : null}
2110
2297
  </View>
2111
2298
  </KeyboardAvoidingView>
2299
+ {CustomViewFooter ? (
2300
+ // If CustomViewFooter is a function component (React.FC)
2301
+ typeof CustomViewFooter === "function" ? (
2302
+ <CustomViewFooter /> // Invoke the function component
2303
+ ) : (
2304
+ CustomViewFooter // Render it directly if it's a React node (JSX or element)
2305
+ )
2306
+ ) : null}
2112
2307
  </>
2113
2308
  );
2114
2309
  }
2115
2310
  );
2311
+