@cometchat/chat-uikit-react-native 5.2.9 → 5.2.11

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/package.json +2 -2
  2. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +47 -11
  3. package/src/CometChatMessageList/CometChatMessageList.tsx +58 -47
  4. package/src/CometChatMessageList/components/MessageListItem.tsx +11 -8
  5. package/src/CometChatSearch/style.ts +3 -3
  6. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +71 -14
  7. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +1 -0
  8. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +1 -0
  9. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +1 -0
  10. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +1 -0
  11. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +1 -0
  12. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +1 -0
  13. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +1 -0
  14. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +1 -0
  15. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +1 -0
  16. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +1 -0
  17. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +1 -0
  18. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +1 -0
  19. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +1 -0
  20. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +1 -0
  21. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +1 -0
  22. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +1 -0
  23. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +1 -0
  24. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +1 -0
  25. package/src/shared/utils/MessageUtils.tsx +55 -0
  26. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -1
  27. package/src/shared/views/CometChatList/Header.tsx +57 -49
  28. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +0 -1
  29. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +4 -3
  30. package/src/shared/views/CometChatQuickReactions/QuickReactionsStyle.tsx +2 -2
  31. package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +3 -2
  32. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +11 -5
  33. package/src/shared/views/CometChatReactions/style.ts +35 -8
  34. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +46 -61
  35. package/src/theme/index.ts +1 -1
  36. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  37. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  38. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  39. package/android/.gradle/7.4/gc.properties +0 -0
  40. package/android/.gradle/vcs-1/gc.properties +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "5.2.9",
3
+ "version": "5.2.11",
4
4
  "description": "Ready-to-use Chat UI Components for React Native",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -120,4 +120,4 @@
120
120
  "node_modules/",
121
121
  "lib/"
122
122
  ]
123
- }
123
+ }
@@ -105,6 +105,7 @@ const ActionSheetBoard = (props: any) => {
105
105
  ref={sheetRef}
106
106
  onClose={onClose}
107
107
  isOpen={shouldShow}
108
+ doNotOccupyEntireHeight
108
109
  >
109
110
  <CometChatActionSheet actions={options} style={style} />
110
111
  </CometChatBottomSheet>
@@ -132,6 +133,7 @@ const RecordAudio = (props: any) => {
132
133
  onClose={onClose}
133
134
  style={cometChatBottomSheetStyle}
134
135
  isOpen={shouldShow}
136
+ doNotOccupyEntireHeight
135
137
  >
136
138
  <CometChatMediaRecorder
137
139
  onClose={onClose}
@@ -1151,6 +1153,11 @@ export const CometChatMessageComposer = React.forwardRef(
1151
1153
  url: messageInput["uri"],
1152
1154
  sender: loggedInUser.current,
1153
1155
  attachments: [messageInput],
1156
+ entities: {
1157
+ sender: {
1158
+ entity: loggedInUser.current,
1159
+ },
1160
+ },
1154
1161
  });
1155
1162
 
1156
1163
  CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
@@ -1172,18 +1179,34 @@ export const CometChatMessageComposer = React.forwardRef(
1172
1179
  });
1173
1180
  }
1174
1181
  setReplyMessage(null);
1182
+ setWarningMessage("");
1175
1183
  setShowRecordAudio(false);
1176
1184
  })
1177
1185
  .catch((error: any) => {
1178
1186
  setShowRecordAudio(false);
1187
+ if (error?.code === "ERR_PERMISSION_DENIED") {
1188
+ onError && onError(error);
1189
+ // Set error in data.metaData where the message list receipt logic checks
1190
+ const currentData = localMessage.getData() || {};
1191
+ localMessage.setData({ ...currentData, metaData: { error: true } });
1192
+ localMessage.setMetadata({ error: true });
1193
+ CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
1194
+ message: localMessage,
1195
+ status: messageStatus.error,
1196
+ });
1197
+ setReplyMessage(null);
1198
+ return;
1199
+ }
1179
1200
  onError && onError(error);
1201
+ // Set error in data.metaData where the message list receipt logic checks
1202
+ const currentData = localMessage.getData() || {};
1203
+ localMessage.setData({ ...currentData, metaData: { error: true } });
1180
1204
  localMessage.setMetadata({ error: true });
1181
1205
  CometChatUIEventHandler.emitMessageEvent(MessageEvents.ccMessageSent, {
1182
1206
  message: localMessage,
1183
1207
  status: messageStatus.error,
1184
1208
  });
1185
1209
  setReplyMessage(null);
1186
- // console.log("media message sent error", error); // Removed debug log
1187
1210
  });
1188
1211
  };
1189
1212
 
@@ -2076,16 +2099,29 @@ export const CometChatMessageComposer = React.forwardRef(
2076
2099
  trackingCharacter: activeCharacter.current,
2077
2100
  });
2078
2101
  mentionMap.current = updatedMap;
2079
- setSelectionPosition({
2080
- start:
2081
- selectionPosition.start -
2082
- (searchStringRef.current.length + 1) +
2083
- (item.promptText?.length ?? 0),
2084
- end:
2085
- selectionPosition.start -
2086
- (searchStringRef.current.length + 1) +
2087
- (item.promptText?.length ?? 0),
2088
- });
2102
+
2103
+ // Calculate cursor position after the mention + space
2104
+ // Add 1 to account for the space character added after the mention
2105
+ const newCursorPosition =
2106
+ selectionPosition.start -
2107
+ (searchStringRef.current.length + 1) +
2108
+ (item.promptText?.length ?? 0) +
2109
+ 1; // +1 for the space after mention
2110
+
2111
+ // On iOS, use InteractionManager to ensure selection is applied after UI updates
2112
+ if (Platform.OS === "ios") {
2113
+ InteractionManager.runAfterInteractions(() => {
2114
+ setSelectionPosition({
2115
+ start: newCursorPosition,
2116
+ end: newCursorPosition,
2117
+ });
2118
+ });
2119
+ } else {
2120
+ setSelectionPosition({
2121
+ start: newCursorPosition,
2122
+ end: newCursorPosition,
2123
+ });
2124
+ }
2089
2125
  setFormattedInputMessage();
2090
2126
  };
2091
2127
 
@@ -75,9 +75,9 @@ import { CometChatAvatar } from "../shared/views/CometChatAvatar";
75
75
  import { CometChatBadge } from "../shared/views/CometChatBadge";
76
76
  import { CometChatDate } from "../shared/views/CometChatDate";
77
77
  import { CometChatMessageBubble } from "../shared/views/CometChatMessageBubble";
78
- import { getModerationStatus, ModerationBottomView } from "../shared/utils/MessageUtils";
78
+ import { getModerationStatus, ModerationBottomView, MimeErrorBottomView } from "../shared/utils/MessageUtils";
79
79
  import { CometChatReactions } from "../shared/views/CometChatReactions";
80
- import { useTheme } from "../theme";
80
+ import { useTheme, useThemeInternal } from "../theme";
81
81
  import { MessageSkeleton } from "./Skeleton";
82
82
  import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
83
83
  import { BubbleStyles, CometChatTheme } from "../theme/type";
@@ -632,7 +632,7 @@ export const CometChatMessageList = memo(
632
632
  const hideMarkAsUnreadOption = (isAgenticUser || !!parentMessageId) ? true : !showMarkAsUnreadOption;//hide for threads and agentic users
633
633
 
634
634
  const callListenerId = "call_" + new Date().getTime();
635
- const effectiveHideModeration = hideModerationStatus;
635
+ const effectiveHideModeration = hideModerationStatus;
636
636
  const groupListenerId = "group_" + new Date().getTime();
637
637
  const uiEventListener = "uiEvent_" + new Date().getTime();
638
638
  const callEventListener = "callEvent_" + new Date().getTime();
@@ -715,6 +715,8 @@ export const CometChatMessageList = memo(
715
715
  }, [hideGroupActionMessages, isAgenticUser, parentMessageId]);
716
716
 
717
717
  const theme = useTheme();
718
+ const themeInternal = useThemeInternal();
719
+ const themeMode = themeInternal.mode; // 'light' or 'dark' - used for FlatList extraData
718
720
  const { t } = useCometChatTranslation();
719
721
 
720
722
  const mergedTheme: CometChatTheme = useMemo(() => {
@@ -1073,7 +1075,10 @@ export const CometChatMessageList = memo(
1073
1075
  const oldestMessage = previousMessagesFetched[previousMessagesFetched.length];
1074
1076
 
1075
1077
  if (oldestMessage) {
1076
- setNewMessageIndicatorId(oldestMessage.getId().toString());
1078
+ const msgId = safeGetId(oldestMessage);
1079
+ if (msgId !== undefined) {
1080
+ setNewMessageIndicatorId(String(msgId));
1081
+ }
1077
1082
  }
1078
1083
  }
1079
1084
 
@@ -1383,7 +1388,6 @@ export const CometChatMessageList = memo(
1383
1388
  // Center the message: place it at middle of the screen
1384
1389
  // In inverted list: offset = message.y - (screenHeight/2 - messageHeight/2)
1385
1390
  const centeredOffset = Math.max(0, position.y - (screenHeight / 2) + (position.height / 2));
1386
- console.log({centeredOffset});
1387
1391
 
1388
1392
  // console.log(`📍 Scrolling to position-based offset ${centeredOffset.toFixed(1)}px for message ${messageId}`);
1389
1393
  messageListRef.current?.scrollToOffset({
@@ -1715,8 +1719,8 @@ export const CometChatMessageList = memo(
1715
1719
  (response: any) => {
1716
1720
  setShowMessageOptions([]);
1717
1721
  setHasManuallyMarkedUnread(true);
1718
- let convId:string = "";
1719
- let conversationType:string = "";
1722
+ let convId: string = "";
1723
+ let conversationType: string = "";
1720
1724
  if (user) {
1721
1725
  convId = user?.getUid();
1722
1726
  conversationType = CometChat.RECEIVER_TYPE.USER;
@@ -1727,12 +1731,10 @@ export const CometChatMessageList = memo(
1727
1731
  //getting convesation using conversationId=Uid and conversationType
1728
1732
  CometChat.getConversation(convId, conversationType).then((conversation) => {
1729
1733
  // Emitting conversation update event
1730
- console.log("Emitting ccUpdateConversation event for mark as unread", conversation);
1731
1734
  CometChatUIEventHandler.emitConversationEvent(
1732
1735
  CometChatConversationEvents.ccUpdateConversation,
1733
1736
  { conversation }
1734
1737
  );
1735
- console.log("latest",conversation.getUnreadMessageCount());
1736
1738
  setUnreadCount(conversation.getUnreadMessageCount());
1737
1739
  setNewMessageIndicatorId(message.getId().toString());
1738
1740
  }).catch((error) => {
@@ -2184,12 +2186,11 @@ export const CometChatMessageList = memo(
2184
2186
  .catch((rej: any) => {
2185
2187
  deleteItem.current = undefined;
2186
2188
  setShowDeleteModal(false);
2187
- console.log(rej);
2188
2189
  onError && onError(rej);
2189
2190
  });
2190
2191
  };
2191
2192
 
2192
- const createActionMessage = () => {};
2193
+ const createActionMessage = () => { };
2193
2194
 
2194
2195
  const updateMessageReceipt = (receipt: any) => {
2195
2196
  if (
@@ -2262,8 +2263,6 @@ export const CometChatMessageList = memo(
2262
2263
  });
2263
2264
  CometChat.getLoggedinUser()
2264
2265
  .then(async (u: any) => {
2265
- console.log({startFromUnreadMessages});
2266
-
2267
2266
  loggedInUser.current = u;
2268
2267
  if (isAgenticUser && !parentMessageId) {
2269
2268
  messageRequest.current = null;
@@ -2289,8 +2288,6 @@ export const CometChatMessageList = memo(
2289
2288
  convId,
2290
2289
  conversationType
2291
2290
  );
2292
- console.log({convId,conversationType,user,group,conversation,getUnreadMessageCount:conversation.getUnreadMessageCount()});
2293
- // console.log("lower", conversation);
2294
2291
  if (conversation.getUnreadMessageCount() > 0) {
2295
2292
  setUnreadCount(conversation.getUnreadMessageCount());
2296
2293
  const lastReadMessageId = conversation.getLastReadMessageId();
@@ -2430,33 +2427,32 @@ export const CometChatMessageList = memo(
2430
2427
  (aiAssistantMessage, aiToolResultMessage, aiToolArgumentMessage) => {
2431
2428
  const replacement = aiAssistantMessage || aiToolResultMessage || aiToolArgumentMessage;
2432
2429
  if (!replacement) return;
2433
- console.log("replacement", replacement);
2434
2430
 
2435
2431
  const replacementId = typeof (replacement as any)?.getId === 'function' ? (replacement as any).getId() : (replacement as any)?.id;
2436
2432
  const replacementRunId = (replacement as any)?.data?.runId;
2437
-
2438
- if(messagesContentListRef.current?.[0]?.isStreamMessage && messagesContentListRef.current?.[0]?.targetMessageId === runId){
2433
+
2434
+ if (messagesContentListRef.current?.[0]?.isStreamMessage && messagesContentListRef.current?.[0]?.targetMessageId === runId) {
2439
2435
  latestMessageRef.current = replacement;
2440
2436
  }
2441
-
2437
+
2442
2438
  const list = messagesContentListRef.current;
2443
2439
  let updatedList: any[];
2444
-
2440
+
2445
2441
  // Find indices in one pass
2446
2442
  const existingIndex = list.findIndex((msg) => {
2447
2443
  const msgId = typeof (msg as any)?.getId === 'function' ? (msg as any).getId() : (msg as any)?.id;
2448
2444
  return msgId && String(msgId) === String(replacementId);
2449
2445
  });
2450
-
2451
- const streamIndex = existingIndex === -1 ? list.findIndex((msg) =>
2446
+
2447
+ const streamIndex = existingIndex === -1 ? list.findIndex((msg) =>
2452
2448
  (msg as any).isStreamMessage === true && (msg as any).targetMessageId === runId
2453
2449
  ) : -1;
2454
-
2450
+
2455
2451
  const matchingIndex = (existingIndex === -1 && streamIndex === -1) ? list.findIndex((msg) => {
2456
2452
  const msgRunId = (msg as any)?.data?.runId;
2457
2453
  return msgRunId && String(msgRunId) === String(replacementRunId);
2458
2454
  }) : -1;
2459
-
2455
+
2460
2456
  // Update list based on what we found
2461
2457
  if (existingIndex !== -1) {
2462
2458
  // Update existing message
@@ -2472,8 +2468,7 @@ export const CometChatMessageList = memo(
2472
2468
  // Add at beginning
2473
2469
  updatedList = [replacement, ...list];
2474
2470
  }
2475
-
2476
- console.log("updatedList", updatedList);
2471
+
2477
2472
  messagesContentListRef.current = updatedList;
2478
2473
  setMessagesList(updatedList);
2479
2474
  onLoad && onLoad([...updatedList].reverse());
@@ -2783,15 +2778,13 @@ export const CometChatMessageList = memo(
2783
2778
  connectionListenerId,
2784
2779
  new CometChat.ConnectionListener({
2785
2780
  onConnected: () => {
2786
- console.log("CONNECTED...");
2787
2781
  streamOnConnected();
2788
2782
  if (lastID.current) {
2789
2783
  getUpdatedPreviousMessages();
2790
2784
  }
2791
2785
  },
2792
- inConnecting: () => {},
2786
+ inConnecting: () => { },
2793
2787
  onDisconnected: () => {
2794
- console.log("DISCONNECTED...");
2795
2788
  streamOnDisconnected();
2796
2789
  if (!messagesList[0].id) {
2797
2790
  for (let i = 0; i < messagesList.length; i++) {
@@ -3052,11 +3045,17 @@ export const CometChatMessageList = memo(
3052
3045
  messagesContentListRef.current[currentIndex! - 1].getDeliveredAt();
3053
3046
  // Moderation status should override other receipt states for immediate error display
3054
3047
  const moderationStatus = getModerationStatus(item);
3055
- if (item.getReadAt() || nextItemIsRead) messageState = MessageReceipt.READ;
3048
+
3049
+ // Check error metadata FIRST before sentAt/deliveredAt/readAt
3050
+ const hasErrorMetadata = item?.getData?.()?.metaData?.error;
3051
+ const hasErrorInMetadata = item?.getMetadata?.()?.error;
3052
+ const hasErrorProp = (item as any)?.error;
3053
+ if (hasErrorMetadata || hasErrorInMetadata || hasErrorProp) {
3054
+ messageState = MessageReceipt.ERROR;
3055
+ } else if (item.getReadAt() || nextItemIsRead) messageState = MessageReceipt.READ;
3056
3056
  else if (item.getDeliveredAt() || nextItemIsDelivered)
3057
3057
  messageState = MessageReceipt.DELIVERED;
3058
3058
  else if (item.getSentAt()) messageState = MessageReceipt.SENT;
3059
- else if (item?.getData()?.metaData?.error) messageState = MessageReceipt.ERROR;
3060
3059
  else if (isOutgoingMessage) messageState = MessageReceipt.WAIT;
3061
3060
  else messageState = MessageReceipt.ERROR;
3062
3061
 
@@ -3356,8 +3355,7 @@ export const CometChatMessageList = memo(
3356
3355
 
3357
3356
  <Text
3358
3357
  style={_style.threadedMessageStyles?.indicatorTextStyle}
3359
- >{`${item.getReplyCount()} ${
3360
- item.getReplyCount() > 1 ? t("REPLIES") : t("REPLY")
3358
+ >{`${item.getReplyCount()} ${item.getReplyCount() > 1 ? t("REPLIES") : t("REPLY")
3361
3359
  }`}</Text>
3362
3360
  <CometChatBadge
3363
3361
  style={{
@@ -3376,7 +3374,6 @@ export const CometChatMessageList = memo(
3376
3374
  setShowMessageOptions([]);
3377
3375
  CometChat.getUser(item.getSender().getUid())
3378
3376
  .then((user: any) => {
3379
- console.log({ user });
3380
3377
  CometChatUIEventHandler.emitUIEvent("openChat", { user });
3381
3378
  })
3382
3379
  .catch((e: any) => {
@@ -3407,13 +3404,11 @@ export const CometChatMessageList = memo(
3407
3404
  };
3408
3405
 
3409
3406
  NativeModules.FileManager.shareMessage(shareObj, (callback: any) => {
3410
- console.log("shareMessage Callback", callback);
3411
3407
  });
3412
3408
  };
3413
3409
 
3414
3410
  const openOptionsForMessage = useCallback(
3415
3411
  (item: CometChat.BaseMessage | any, template: CometChatMessageTemplate) => {
3416
- console.log("Opening options for message:", item);
3417
3412
  let options = template?.options
3418
3413
  ? loggedInUser.current
3419
3414
  ? template.options(loggedInUser.current, item, mergedTheme, group)
@@ -3422,6 +3417,9 @@ export const CometChatMessageList = memo(
3422
3417
  if (hideFlagMessageOption) {
3423
3418
  options = options.filter((opt: any) => opt.id !== MessageOptionConstants.reportMessage);
3424
3419
  }
3420
+ if (hideMarkAsUnreadOption) {
3421
+ options = options.filter((opt: any) => opt.id !== MessageOptionConstants.markAsUnread);
3422
+ }
3425
3423
  let optionsWithPressHandling = options.map((option) => {
3426
3424
  if (!option.onPress)
3427
3425
  switch (option.id) {
@@ -3575,6 +3573,20 @@ export const CometChatMessageList = memo(
3575
3573
  const BottomView = useMemo(() => {
3576
3574
  const moderationStatus = getModerationStatus(message);
3577
3575
  const isOutgoing = message.getSender()?.getUid() === loggedInUser.current?.getUid();
3576
+
3577
+ // Check for MIME type error (ERR_PERMISSION_DENIED)
3578
+ const hasErrorMetadata = (message as any)?.getData?.()?.metaData?.error;
3579
+ const hasErrorInMetadata = (message as any)?.getMetadata?.()?.error;
3580
+ if (isOutgoing && (hasErrorMetadata || hasErrorInMetadata) && !isAgenticUser) {
3581
+ return (
3582
+ <MimeErrorBottomView
3583
+ moderationStyle={
3584
+ mergedTheme.messageListStyles.outgoingMessageBubbleStyles.moderationStyle
3585
+ }
3586
+ />
3587
+ );
3588
+ }
3589
+
3578
3590
  if (effectiveHideModeration) {
3579
3591
  return hasTemplate?.BottomView && hasTemplate?.BottomView(message, bubbleAlignment);
3580
3592
  } else {
@@ -3860,7 +3872,7 @@ export const CometChatMessageList = memo(
3860
3872
  </React.Fragment>
3861
3873
  );
3862
3874
  },
3863
- [] // Empty dependencies - MessageView handles its own memoization
3875
+ [themeMode] // Only recreate when theme mode changes - MessageView accessed via closure
3864
3876
  );
3865
3877
 
3866
3878
  const keyExtractor = useCallback((item: any, index: number) => {
@@ -3868,32 +3880,32 @@ export const CometChatMessageList = memo(
3868
3880
  const id = typeof item?.getId === 'function' ? item.getId() : item?.id;
3869
3881
  const muid = typeof item?.getMuid === 'function' ? item.getMuid() : item?.muid;
3870
3882
 
3871
-
3883
+
3872
3884
  // For stream messages in agentic mode, use a unique combination
3873
3885
  // to prevent duplicate keys when navigating between chat and history
3874
3886
  if (item?.isStreamMessage) {
3875
3887
  const targetId = item?.targetMessageId || '';
3876
3888
  return `stream_${id}_${targetId}_${index}`;
3877
3889
  }
3878
-
3890
+
3879
3891
  // Use id + muid if both exist
3880
3892
  if (id && muid) {
3881
3893
  return `${id}_${muid}`;
3882
3894
  }
3883
3895
 
3884
-
3896
+
3885
3897
  // Use muid if id doesn't exist (pending message)
3886
3898
  if (muid) {
3887
3899
  return `muid_${muid}`;
3888
3900
  }
3889
3901
 
3890
-
3902
+
3891
3903
  // Use id if muid doesn't exist
3892
3904
  if (id) {
3893
3905
  return `id_${id}`;
3894
3906
  }
3895
3907
 
3896
-
3908
+
3897
3909
  // Fallback to index if neither exist (should not happen, but prevents duplicates)
3898
3910
  if (__DEV__) {
3899
3911
  console.warn('[MessageList] Message without id or muid at index:', index, item);
@@ -4387,6 +4399,7 @@ export const CometChatMessageList = memo(
4387
4399
  isHighlighted={isHighlighted}
4388
4400
  highlightAnimatedValue={highlightAnimatedValue}
4389
4401
  theme={mergedTheme}
4402
+ themeMode={themeMode}
4390
4403
  timestamp={ms}
4391
4404
  dayHeaderString={dayHeaderString}
4392
4405
  RenderMessageItem={RenderMessageItem}
@@ -4403,6 +4416,7 @@ export const CometChatMessageList = memo(
4403
4416
  },
4404
4417
  [
4405
4418
  mergedTheme,
4419
+ themeMode,
4406
4420
  highlightedMessageId,
4407
4421
  highlightAnimatedValue,
4408
4422
  sentAtToMs,
@@ -4454,7 +4468,7 @@ export const CometChatMessageList = memo(
4454
4468
  )}
4455
4469
 
4456
4470
  {/* Navigation loading for far message fetching and scroll operations */}
4457
- {navigationLoading&& (getLoadingStateView())}
4471
+ {navigationLoading && (getLoadingStateView())}
4458
4472
  <FlatList
4459
4473
  showsVerticalScrollIndicator={false}
4460
4474
  ref={messageListRef}
@@ -4471,6 +4485,7 @@ export const CometChatMessageList = memo(
4471
4485
  scrollEventThrottle={16}
4472
4486
  keyboardShouldPersistTaps={(Platform.OS === "ios" ? "handled" : "always") as "handled" | "always"}
4473
4487
  data={messagesList}
4488
+ extraData={themeMode}
4474
4489
  keyExtractor={keyExtractor}
4475
4490
  renderItem={memoizedRenderItem}
4476
4491
  ListHeaderComponent={renderFooter}
@@ -4551,10 +4566,6 @@ export const CometChatMessageList = memo(
4551
4566
  reportedMessageRef.current = null;
4552
4567
  }}
4553
4568
  onReportSubmit={(payload) => {
4554
- console.log("Report submitted", {
4555
- messageId: payload.message?.getId?.(),
4556
- payload,
4557
- });
4558
4569
  setShowReportDialog(false);
4559
4570
  reportedMessageRef.current = null;
4560
4571
  }}
@@ -14,6 +14,7 @@ interface MessageListItemProps {
14
14
  isHighlighted: boolean;
15
15
  highlightAnimatedValue: Animated.Value;
16
16
  theme: CometChatTheme;
17
+ themeMode: string;
17
18
  timestamp: number;
18
19
  dayHeaderString: string | undefined;
19
20
  RenderMessageItem: React.ComponentType<any>;
@@ -33,6 +34,7 @@ const MessageListItemComponent: React.FC<MessageListItemProps> = ({
33
34
  isHighlighted,
34
35
  highlightAnimatedValue,
35
36
  theme,
37
+ themeMode,
36
38
  timestamp,
37
39
  dayHeaderString,
38
40
  RenderMessageItem,
@@ -99,9 +101,12 @@ const MessageListItemComponent: React.FC<MessageListItemProps> = ({
99
101
  export const MessageListItem = memo(MessageListItemComponent, (prevProps, nextProps) => {
100
102
  // Return true if props are equal (skip re-render)
101
103
  // Return false if props changed (re-render needed)
102
-
104
+
103
105
  const itemUnchanged = prevProps.item === nextProps.item;
104
-
106
+
107
+ // Theme mode change should trigger re-render for theme updates
108
+ const themeModeUnchanged = prevProps.themeMode === nextProps.themeMode;
109
+
105
110
  const visualsUnchanged =
106
111
  prevProps.isHighlighted === nextProps.isHighlighted &&
107
112
  prevProps.showSeparator === nextProps.showSeparator &&
@@ -109,19 +114,17 @@ export const MessageListItem = memo(MessageListItemComponent, (prevProps, nextPr
109
114
  prevProps.dayHeaderString === nextProps.dayHeaderString &&
110
115
  prevProps.showNewMessageIndicator === nextProps.showNewMessageIndicator &&
111
116
  prevProps.newMessageIndicatorText === nextProps.newMessageIndicatorText;
112
-
117
+
113
118
  const styleUnchanged =
114
- prevProps.theme === nextProps.theme &&
115
119
  prevProps.staticStyles === nextProps.staticStyles &&
116
120
  prevProps.newMessageIndicatorStyle === nextProps.newMessageIndicatorStyle;
117
-
121
+
118
122
  const functionsUnchanged =
119
- prevProps.RenderMessageItem === nextProps.RenderMessageItem &&
120
123
  prevProps.itemSeparator === nextProps.itemSeparator &&
121
124
  prevProps.highlightAnimatedValue === nextProps.highlightAnimatedValue &&
122
125
  prevProps.onLayout === nextProps.onLayout;
123
-
124
- return itemUnchanged && visualsUnchanged && styleUnchanged && functionsUnchanged;
126
+
127
+ return itemUnchanged && themeModeUnchanged && visualsUnchanged && styleUnchanged && functionsUnchanged;
125
128
  });
126
129
 
127
130
  MessageListItem.displayName = 'MessageListItem';
@@ -314,9 +314,9 @@ export const getSearchStyleLight = (
314
314
  maxWidth: '80%',
315
315
  },
316
316
  textContainerStyle: {
317
- width: 328,
318
- height: 80,
319
- flex: 0,
317
+ flex: 1,
318
+ minHeight: 80,
319
+ maxWidth: '100%',
320
320
  },
321
321
  titleStyle: {
322
322
  ...typography.caption1.medium,