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

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 (36) hide show
  1. package/package.json +2 -1
  2. package/src/CometChatConversations/CometChatConversations.tsx +107 -18
  3. package/src/CometChatMessageList/CometChatMessageList.tsx +24 -5
  4. package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +811 -0
  5. package/src/CometChatNotificationFeed/Skeleton.tsx +43 -0
  6. package/src/CometChatNotificationFeed/index.ts +19 -0
  7. package/src/CometChatNotificationFeed/style.ts +333 -0
  8. package/src/CometChatNotificationFeed/utils.ts +124 -0
  9. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +22 -18
  10. package/src/extensions/LinkPreview/LinkPreviewExtensionDecorator.tsx +1 -1
  11. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +5 -1
  12. package/src/index.ts +7 -0
  13. package/src/shared/icons/components/notification-empty.tsx +27 -0
  14. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +8 -1
  15. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +8 -1
  16. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +8 -1
  17. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +8 -1
  18. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +8 -1
  19. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +8 -1
  20. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +8 -1
  21. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +8 -1
  22. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +8 -1
  23. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +8 -1
  24. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +8 -1
  25. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +8 -1
  26. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +8 -1
  27. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +8 -1
  28. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +8 -1
  29. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +8 -1
  30. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +8 -1
  31. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +8 -1
  32. package/src/shared/utils/MessageReceiptUtils.ts +0 -1
  33. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +53 -21
  34. package/src/shared/views/CometChatList/CometChatList.tsx +26 -15
  35. package/src/theme/default/default.ts +6 -0
  36. package/src/theme/type.ts +2 -0
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Texto del enlace",
511
511
  "URL": "URL",
512
512
  "INSERT": "Insertar",
513
- "GROUP_NO_LONGER_MEMBER": "No puedes enviar mensajes a este grupo porque ya no eres miembro."
513
+ "GROUP_NO_LONGER_MEMBER": "No puedes enviar mensajes a este grupo porque ya no eres miembro.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Nada aquí todavía",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "La nueva actividad aparecerá aquí cuando esté disponible.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Algo salió mal",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "No se pudieron cargar las notificaciones. Por favor, inténtalo de nuevo.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Cargando...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "No se pudo cargar más",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Toca para reintentar"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Texte du lien",
511
511
  "URL": "URL",
512
512
  "INSERT": "Insérer",
513
- "GROUP_NO_LONGER_MEMBER": "Vous ne pouvez pas envoyer de message à ce groupe car vous n'en êtes plus membre."
513
+ "GROUP_NO_LONGER_MEMBER": "Vous ne pouvez pas envoyer de message à ce groupe car vous n'en êtes plus membre.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Rien ici pour le moment",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Les nouvelles activités apparaîtront ici lorsqu'elles seront disponibles.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Une erreur s'est produite",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Impossible de charger les notifications. Veuillez réessayer.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Chargement...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Impossible de charger plus",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Appuyez pour réessayer"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "लिंक टेक्स्ट",
511
511
  "URL": "URL",
512
512
  "INSERT": "डालें",
513
- "GROUP_NO_LONGER_MEMBER": "आप इस समूह में संदेश नहीं भेज सकते क्योंकि अब आप सदस्य नहीं हैं।"
513
+ "GROUP_NO_LONGER_MEMBER": "आप इस समूह में संदेश नहीं भेज सकते क्योंकि अब आप सदस्य नहीं हैं।",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "यहाँ अभी कुछ नहीं है",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "उपलब्ध होने पर नई गतिविधि यहाँ दिखाई देगी।",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "कुछ गलत हो गया",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "सूचनाएँ लोड नहीं हो सकीं। कृपया पुनः प्रयास करें।",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "लोड हो रहा है...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "और लोड नहीं हो सका",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "पुनः प्रयास करने के लिए टैप करें"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Link szövege",
511
511
  "URL": "URL",
512
512
  "INSERT": "Beszúrás",
513
- "GROUP_NO_LONGER_MEMBER": "Nem küldhet üzenetet ebbe a csoportba, mert már nem tag."
513
+ "GROUP_NO_LONGER_MEMBER": "Nem küldhet üzenetet ebbe a csoportba, mert már nem tag.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Még nincs itt semmi",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Az új tevékenységek itt jelennek meg, ha elérhetők.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Valami hiba történt",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Nem sikerült betölteni az értesítéseket. Kérjük, próbálja újra.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Betöltés...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Nem sikerült többet betölteni",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Koppintson az újrapróbálkozáshoz"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Testo del link",
511
511
  "URL": "URL",
512
512
  "INSERT": "Inserisci",
513
- "GROUP_NO_LONGER_MEMBER": "Non puoi inviare messaggi a questo gruppo perché non sei più un membro."
513
+ "GROUP_NO_LONGER_MEMBER": "Non puoi inviare messaggi a questo gruppo perché non sei più un membro.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Niente qui ancora",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Le nuove attività appariranno qui quando disponibili.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Qualcosa è andato storto",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Impossibile caricare le notifiche. Riprova.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Caricamento...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Impossibile caricare altro",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Tocca per riprovare"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "リンクテキスト",
511
511
  "URL": "URL",
512
512
  "INSERT": "挿入",
513
- "GROUP_NO_LONGER_MEMBER": "あなたはもうメンバーではないため、このグループにメッセージを送信できません。"
513
+ "GROUP_NO_LONGER_MEMBER": "あなたはもうメンバーではないため、このグループにメッセージを送信できません。",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "まだ何もありません",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "新しいアクティビティが利用可能になるとここに表示されます。",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "問題が発生しました",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "通知を読み込めませんでした。もう一度お試しください。",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "読み込み中...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "さらに読み込めませんでした",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "タップして再試行"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "링크 텍스트",
511
511
  "URL": "URL",
512
512
  "INSERT": "삽입",
513
- "GROUP_NO_LONGER_MEMBER": "더 이상 멤버가 아니므로 이 그룹에 메시지를 보낼 수 없습니다."
513
+ "GROUP_NO_LONGER_MEMBER": "더 이상 멤버가 아니므로 이 그룹에 메시지를 보낼 수 없습니다.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "아직 아무것도 없습니다",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "새로운 활동이 있으면 여기에 표시됩니다.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "문제가 발생했습니다",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "알림을 불러올 수 없습니다. 다시 시도해 주세요.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "로딩 중...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "더 불러올 수 없습니다",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "탭하여 재시도"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Nuorodos tekstas",
511
511
  "URL": "URL",
512
512
  "INSERT": "Įterpti",
513
- "GROUP_NO_LONGER_MEMBER": "Negalite siųsti žinutės šiai grupei, nes nebesate narys."
513
+ "GROUP_NO_LONGER_MEMBER": "Negalite siųsti žinutės šiai grupei, nes nebesate narys.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Čia dar nieko nėra",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Nauja veikla bus rodoma čia, kai bus prieinama.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Kažkas nutiko",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Nepavyko įkelti pranešimų. Bandykite dar kartą.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Kraunama...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Nepavyko įkelti daugiau",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Bakstelėkite, kad bandytumėte dar kartą"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Teks pautan",
511
511
  "URL": "URL",
512
512
  "INSERT": "Masukkan",
513
- "GROUP_NO_LONGER_MEMBER": "Anda tidak boleh menghantar mesej ke kumpulan ini kerana anda bukan lagi ahli."
513
+ "GROUP_NO_LONGER_MEMBER": "Anda tidak boleh menghantar mesej ke kumpulan ini kerana anda bukan lagi ahli.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Belum ada apa-apa di sini",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Aktiviti baharu akan muncul di sini apabila tersedia.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Sesuatu telah berlaku",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Tidak dapat memuatkan pemberitahuan. Sila cuba lagi.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Memuatkan...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Tidak dapat memuatkan lagi",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Ketik untuk cuba semula"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Linktekst",
511
511
  "URL": "URL",
512
512
  "INSERT": "Invoegen",
513
- "GROUP_NO_LONGER_MEMBER": "U kunt geen bericht naar deze groep sturen omdat u geen lid meer bent."
513
+ "GROUP_NO_LONGER_MEMBER": "U kunt geen bericht naar deze groep sturen omdat u geen lid meer bent.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Nog niets hier",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Nieuwe activiteit verschijnt hier wanneer beschikbaar.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Er is iets misgegaan",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Kan meldingen niet laden. Probeer het opnieuw.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Laden...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Kan niet meer laden",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Tik om opnieuw te proberen"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Texto do link",
511
511
  "URL": "URL",
512
512
  "INSERT": "Inserir",
513
- "GROUP_NO_LONGER_MEMBER": "Você não pode enviar mensagem para este grupo porque não é mais membro."
513
+ "GROUP_NO_LONGER_MEMBER": "Você não pode enviar mensagem para este grupo porque não é mais membro.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Nada aqui ainda",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Novas atividades aparecerão aqui quando disponíveis.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Algo deu errado",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Não foi possível carregar as notificações. Tente novamente.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Carregando...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Não foi possível carregar mais",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Toque para tentar novamente"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Текст ссылки",
511
511
  "URL": "URL",
512
512
  "INSERT": "Вставить",
513
- "GROUP_NO_LONGER_MEMBER": "Вы не можете отправить сообщение в эту группу, так как вы больше не являетесь участником."
513
+ "GROUP_NO_LONGER_MEMBER": "Вы не можете отправить сообщение в эту группу, так как вы больше не являетесь участником.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Здесь пока ничего нет",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Новая активность появится здесь, когда будет доступна.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Что-то пошло не так",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Не удалось загрузить уведомления. Попробуйте ещё раз.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Загрузка...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Не удалось загрузить ещё",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Нажмите, чтобы повторить"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Länktext",
511
511
  "URL": "URL",
512
512
  "INSERT": "Infoga",
513
- "GROUP_NO_LONGER_MEMBER": "Du kan inte skicka meddelande till denna grupp eftersom du inte längre är medlem."
513
+ "GROUP_NO_LONGER_MEMBER": "Du kan inte skicka meddelande till denna grupp eftersom du inte längre är medlem.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Inget här ännu",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Ny aktivitet visas här när den är tillgänglig.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Något gick fel",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Det gick inte att ladda aviseringar. Försök igen.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Laddar...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Kunde inte ladda mer",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Tryck för att försöka igen"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "Bağlantı metni",
511
511
  "URL": "URL",
512
512
  "INSERT": "Ekle",
513
- "GROUP_NO_LONGER_MEMBER": "Artık üye olmadığınız için bu gruba mesaj gönderemezsiniz."
513
+ "GROUP_NO_LONGER_MEMBER": "Artık üye olmadığınız için bu gruba mesaj gönderemezsiniz.",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "Henüz burada bir şey yok",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "Yeni etkinlikler mevcut olduğunda burada görünecektir.",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "Bir şeyler ters gitti",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "Bildirimler yüklenemedi. Lütfen tekrar deneyin.",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "Yükleniyor...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "Daha fazla yüklenemedi",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "Tekrar denemek için dokunun"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "链接文本",
511
511
  "URL": "URL",
512
512
  "INSERT": "插入",
513
- "GROUP_NO_LONGER_MEMBER": "您无法向此群组发送消息,因为您已不再是成员。"
513
+ "GROUP_NO_LONGER_MEMBER": "您无法向此群组发送消息,因为您已不再是成员。",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "这里还没有内容",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "有新活动时将在此显示。",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "出了点问题",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "无法加载通知。请重试。",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "加载中...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "无法加载更多",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "点击重试"
514
521
  }
@@ -510,5 +510,12 @@
510
510
  "LINK_TEXT": "連結文字",
511
511
  "URL": "URL",
512
512
  "INSERT": "插入",
513
- "GROUP_NO_LONGER_MEMBER": "您無法向此群組發送訊息,因為您已不再是成員。"
513
+ "GROUP_NO_LONGER_MEMBER": "您無法向此群組發送訊息,因為您已不再是成員。",
514
+ "NOTIFICATION_FEED_EMPTY_TITLE": "這裡還沒有內容",
515
+ "NOTIFICATION_FEED_EMPTY_SUBTITLE": "有新活動時將在此顯示。",
516
+ "NOTIFICATION_FEED_ERROR_TITLE": "出了點問題",
517
+ "NOTIFICATION_FEED_ERROR_SUBTITLE": "無法載入通知。請重試。",
518
+ "NOTIFICATION_FEED_LOADING_MORE": "載入中...",
519
+ "NOTIFICATION_FEED_LOAD_MORE_ERROR": "無法載入更多",
520
+ "NOTIFICATION_FEED_TAP_TO_RETRY": "點擊重試"
514
521
  }
@@ -12,7 +12,6 @@ export const MessageReceiptUtils = {
12
12
  // Moderation status (if available)
13
13
  const moderationStatus = getModerationStatus(message);
14
14
  if (moderationStatus === "disapproved") return MessageReceipt.ERROR;
15
- if (moderationStatus === "pending") return MessageReceipt.WAIT;
16
15
 
17
16
  // Explicit error markers
18
17
  const hasError = (message as any)?.error || (message as any)?.metadata?.error;
@@ -240,53 +240,68 @@ export function useAudioRecorder(): UseAudioRecorderReturn {
240
240
 
241
241
  /**
242
242
  * Duration timer effect - increments duration during recording state.
243
- * Replicates the EXACT logic from the old Timer component in CometChatMediaRecorder/Timer.tsx:
244
- * - Uses a local ref to track time in milliseconds
245
- * - Increments by 1000ms every second when recording (not paused)
246
- * - Freezes (stops incrementing) when paused - time value is preserved
247
- * - Resets to 0 when going back to idle state
248
- *
249
- * The old Timer component:
250
- * - Used `time` state in seconds, incremented by 1 every 1000ms
251
- * - We use milliseconds for consistency with the rest of the codebase
243
+ * Uses wall-clock time (Date.now()) for accurate duration tracking,
244
+ * combined with a preserved offset for pause/resume support.
252
245
  *
253
246
  * @validates Requirements 1.4, 3.1
254
247
  */
255
248
  const timerValueRef = useRef<number>(0);
249
+ const segmentStartTimeRef = useRef<number>(0);
250
+ /** Duration accumulated before the current active recording segment started. */
251
+ const offsetAtSegmentStartRef = useRef<number>(0);
252
+ /** Timestamp captured at the moment the user initiates a pause, before the async native call. */
253
+ const pauseRequestedAtRef = useRef<number>(0);
256
254
 
257
255
  useEffect(() => {
258
256
  if (reducerState.state === 'recording') {
259
- // Not paused -> start counting (increment every 1 second like old Timer)
260
- // This matches: intervalRef.current = setInterval(() => { setTime((prev) => prev + 1); }, 1000);
257
+ // Capture wall-clock start and the offset accumulated so far
258
+ segmentStartTimeRef.current = Date.now();
259
+ offsetAtSegmentStartRef.current = timerValueRef.current;
260
+ pauseRequestedAtRef.current = 0;
261
+
262
+ // Tick every 500ms, compute elapsed from Date.now() for accuracy
261
263
  durationTimerRef.current = setInterval(() => {
262
- timerValueRef.current += 1000; // Increment by 1000ms (1 second)
263
- dispatch({ type: 'UPDATE_DURATION', duration: timerValueRef.current });
264
- }, 1000);
264
+ const elapsed = Date.now() - segmentStartTimeRef.current;
265
+ const totalMs = offsetAtSegmentStartRef.current + elapsed;
266
+ timerValueRef.current = totalMs;
267
+ dispatch({ type: 'UPDATE_DURATION', duration: totalMs });
268
+ }, 500);
265
269
  } else if (reducerState.state === 'paused') {
266
- // Paused -> clear interval, so time is frozen (but value preserved in timerValueRef)
267
- // This matches the old Timer's behavior when paused=true
270
+ // Paused -> stop interval, snap to exact elapsed time
268
271
  if (durationTimerRef.current) {
269
272
  clearInterval(durationTimerRef.current);
270
273
  durationTimerRef.current = null;
271
274
  }
272
- // Note: timerValueRef.current is NOT reset here - time is frozen but preserved
275
+ if (segmentStartTimeRef.current > 0) {
276
+ // Use the timestamp from when pause was requested (before the async native call)
277
+ // to avoid overcounting the time the native call took to complete.
278
+ const pauseTime = pauseRequestedAtRef.current > 0
279
+ ? pauseRequestedAtRef.current
280
+ : Date.now();
281
+ const elapsed = pauseTime - segmentStartTimeRef.current;
282
+ timerValueRef.current = offsetAtSegmentStartRef.current + Math.max(0, elapsed);
283
+ dispatch({ type: 'UPDATE_DURATION', duration: timerValueRef.current });
284
+ segmentStartTimeRef.current = 0;
285
+ pauseRequestedAtRef.current = 0;
286
+ }
273
287
  } else if (reducerState.state === 'idle') {
274
- // Reset timer when going back to idle (like resetKey changing in old Timer)
288
+ // Reset everything
275
289
  timerValueRef.current = 0;
290
+ segmentStartTimeRef.current = 0;
291
+ offsetAtSegmentStartRef.current = 0;
292
+ pauseRequestedAtRef.current = 0;
276
293
  if (durationTimerRef.current) {
277
294
  clearInterval(durationTimerRef.current);
278
295
  durationTimerRef.current = null;
279
296
  }
280
297
  } else {
281
298
  // For other states (completed, playing, error), just stop the interval
282
- // but preserve the duration value
283
299
  if (durationTimerRef.current) {
284
300
  clearInterval(durationTimerRef.current);
285
301
  durationTimerRef.current = null;
286
302
  }
287
303
  }
288
304
 
289
- // Cleanup when unmounting or when effect re-runs
290
305
  return () => {
291
306
  if (durationTimerRef.current) {
292
307
  clearInterval(durationTimerRef.current);
@@ -502,8 +517,11 @@ export function useAudioRecorder(): UseAudioRecorderReturn {
502
517
  // Reset state for new recording
503
518
  pausedDurationRef.current = 0;
504
519
  recordingStartTimeRef.current = 0;
505
- // Reset timer value for new recording (like resetKey in old Timer)
520
+ // Reset timer value for new recording
506
521
  timerValueRef.current = 0;
522
+ segmentStartTimeRef.current = 0;
523
+ offsetAtSegmentStartRef.current = 0;
524
+ pauseRequestedAtRef.current = 0;
507
525
 
508
526
  return new Promise((resolve, reject) => {
509
527
  NativeModules.FileManager.startRecording((result: string) => {
@@ -552,6 +570,17 @@ export function useAudioRecorder(): UseAudioRecorderReturn {
552
570
  return;
553
571
  }
554
572
 
573
+ // Capture the exact moment pause was requested, before the async native call.
574
+ // This prevents the timer from overcounting while the native call completes.
575
+ pauseRequestedAtRef.current = Date.now();
576
+
577
+ // Stop the duration timer immediately so it doesn't keep ticking
578
+ // while the async native call completes.
579
+ if (durationTimerRef.current) {
580
+ clearInterval(durationTimerRef.current);
581
+ durationTimerRef.current = null;
582
+ }
583
+
555
584
  try {
556
585
  // Save current amplitudes for this segment
557
586
  const currentAmplitudes = [...reducerState.amplitudes];
@@ -1253,6 +1282,9 @@ export function useAudioRecorder(): UseAudioRecorderReturn {
1253
1282
  pausedDurationRef.current = 0;
1254
1283
  recordingStartTimeRef.current = 0;
1255
1284
  timerValueRef.current = 0;
1285
+ segmentStartTimeRef.current = 0;
1286
+ offsetAtSegmentStartRef.current = 0;
1287
+ pauseRequestedAtRef.current = 0;
1256
1288
  seekOperationIdRef.current = 0;
1257
1289
  isSeekingRef.current = false;
1258
1290
  pendingSeekRef.current = null;
@@ -251,8 +251,14 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
251
251
  const selectionEffectDidMountRef = useRef(false);
252
252
 
253
253
  const [list, setList] = useState<any[]>([]);
254
+ const listRef = useRef<any[]>([]);
254
255
  const [dataLoadingStatus, setDataLoadingStatus] = useState<string>(LOADING);
255
256
 
257
+ // Keep listRef in sync with list state for use in imperative methods
258
+ useEffect(() => {
259
+ listRef.current = list;
260
+ }, [list]);
261
+
256
262
  useEffect(() => {
257
263
  // Skip calling onSelection on initial mount; only trigger after a user-driven change
258
264
  if (!selectionEffectDidMountRef.current) {
@@ -382,13 +388,16 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
382
388
  * @param
383
389
  */
384
390
  const updateList = (item: any) => {
385
- let newList = [...list];
386
- let itemKey = newList.findIndex((u) => u[listItemKey] === item[listItemKey]);
387
- if (itemKey > -1) {
388
- newList.splice(itemKey, 1, item);
389
- if (newList.length === 0) setDataLoadingStatus(NO_DATA_FOUND);
390
- setList(newList);
391
- }
391
+ setList((prevList) => {
392
+ let newList = [...prevList];
393
+ let itemKey = newList.findIndex((u) => u[listItemKey] === item[listItemKey]);
394
+ if (itemKey > -1) {
395
+ newList.splice(itemKey, 1, item);
396
+ if (newList.length === 0) setDataLoadingStatus(NO_DATA_FOUND);
397
+ return newList;
398
+ }
399
+ return prevList;
400
+ });
392
401
  };
393
402
 
394
403
  /**
@@ -396,12 +405,14 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
396
405
  * @param item
397
406
  */
398
407
  const updateAndMoveToFirst = (item: any) => {
399
- let newList = [...list];
400
- let itemKey = newList.findIndex((u) => u[listItemKey] === item[listItemKey]);
401
- if (itemKey > -1) {
402
- newList.splice(itemKey, 1);
403
- }
404
- setList([item, ...newList]);
408
+ setList((prevList) => {
409
+ let newList = [...prevList];
410
+ let itemKey = newList.findIndex((u) => u[listItemKey] === item[listItemKey]);
411
+ if (itemKey > -1) {
412
+ newList.splice(itemKey, 1);
413
+ }
414
+ return [item, ...newList];
415
+ });
405
416
  };
406
417
 
407
418
  const addItemToList = (item: any, position?: number) => {
@@ -431,14 +442,14 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
431
442
  };
432
443
 
433
444
  const getListItem = (itemId: string | number): any => {
434
- return list.find((item: any) => item[listItemKey] === itemId);
445
+ return listRef.current.find((item: any) => item[listItemKey] === itemId);
435
446
  };
436
447
 
437
448
  /**
438
449
  * Get all list items
439
450
  */
440
451
  const getAllListItems = (): any[] => {
441
- return list;
452
+ return listRef.current;
442
453
  };
443
454
 
444
455
  /**
@@ -6,6 +6,10 @@ import {
6
6
  getConversationStyleDark,
7
7
  getConversationStyleLight,
8
8
  } from "../../CometChatConversations/style";
9
+ import {
10
+ getNotificationFeedStyleDark,
11
+ getNotificationFeedStyleLight,
12
+ } from "../../CometChatNotificationFeed/style";
9
13
  import {
10
14
  getGroupMemberStyleDark,
11
15
  getGroupMemberStyleLight,
@@ -130,6 +134,7 @@ export const lightThemeMaker = (
130
134
  dateStyles: getDateStyleLight(color, spacing, typography),
131
135
  dateSeparatorStyles: getDateSeparatorStyleLight(color, spacing, typography),
132
136
  conversationStyles: getConversationStyleLight(color, spacing, typography),
137
+ notificationFeedStyles: getNotificationFeedStyleLight(color, spacing, typography),
133
138
  confirmDialogStyles: getConfirmDialogStyleLight(color, spacing, typography),
134
139
  reportDialogStyles: getReportDialogStyleLight(color, spacing, typography),
135
140
  messageHeaderStyles: getMessageHeaderStyle(color, spacing, typography),
@@ -171,6 +176,7 @@ export const darkThemeMaker = (
171
176
  dateStyles: getDateStyleDark(color, spacing, typography),
172
177
  dateSeparatorStyles: getDateSeparatorStyleDark(color, spacing, typography),
173
178
  conversationStyles: getConversationStyleDark(color, spacing, typography),
179
+ notificationFeedStyles: getNotificationFeedStyleDark(color, spacing, typography),
174
180
  confirmDialogStyles: getConfirmDialogStyleDark(color, spacing, typography),
175
181
  reportDialogStyles: getReportDialogStyleDark(color, spacing, typography),
176
182
  messageHeaderStyles: getMessageHeaderStyle(color, spacing, typography),
package/src/theme/type.ts CHANGED
@@ -24,6 +24,7 @@ import { DateSeparatorStyle } from "../shared/views/CometChatDateSeperator/style
24
24
  import { JSX } from "react";
25
25
  import { ChatHistoryStyle } from "../CometChatAIAssistantChatHistory/style";
26
26
  import { ReportDialogStyle } from "../shared/views/CometChatReportDialog/style";
27
+ import { NotificationFeedStyle } from "../CometChatNotificationFeed/style";
27
28
 
28
29
  export type BubbleStyles = {
29
30
  containerStyle: ViewStyle;
@@ -468,6 +469,7 @@ export interface CometChatTheme {
468
469
  badgeStyle: BadgeStyle;
469
470
  callLogsStyles: CallLogsStyle;
470
471
  conversationStyles: ConversationStyle;
472
+ notificationFeedStyles: NotificationFeedStyle;
471
473
  confirmDialogStyles: ConfirmDialogStyle;
472
474
  reportDialogStyles: ReportDialogStyle;
473
475
  quickReactionStyle: {