@cometchat/chat-uikit-react-native 5.2.8 → 5.2.9
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.
- package/package.json +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +8 -1
- package/src/CometChatGroups/CometChatGroups.tsx +5 -3
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +55 -8
- package/src/CometChatMessageList/CometChatMessageList.tsx +1169 -548
- package/src/CometChatMessageList/components/MessageListItem.tsx +127 -0
- package/src/CometChatMessageList/components/MessageModals.tsx +60 -0
- package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +130 -0
- package/src/CometChatMessageList/components/ReactionModals.tsx +70 -0
- package/src/CometChatUsers/CometChatUsers.tsx +4 -1
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +27 -36
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +13 -9
- package/src/shared/base/Types.ts +1 -0
- package/src/shared/constants/UIKitConstants.ts +1 -0
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +4 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -1
- package/src/shared/events/conversations.ts +1 -0
- package/src/shared/framework/MessageDataSource.tsx +79 -17
- package/src/shared/index.ts +2 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +3 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +3 -1
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +7 -4
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +20 -12
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +6 -3
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +2 -1
- package/src/shared/views/CometChatList/CometChatList.tsx +20 -1
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +2 -3
- package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +55 -0
- package/src/shared/views/CometChatNewMessageIndicator/index.ts +3 -0
- package/src/shared/views/CometChatNewMessageIndicator/styles.ts +33 -0
- package/src/shared/views/CometChatRetryButton/CometChatRetryButton.tsx +54 -0
- package/src/shared/views/CometChatRetryButton/index.ts +3 -0
- package/src/shared/views/index.ts +15 -0
|
@@ -294,6 +294,26 @@ export class MessageDataSource implements DataSource {
|
|
|
294
294
|
),
|
|
295
295
|
};
|
|
296
296
|
}
|
|
297
|
+
|
|
298
|
+
getMarkAsUnreadOption(theme: CometChatTheme): CometChatMessageOption {
|
|
299
|
+
return {
|
|
300
|
+
id: MessageOptionConstants.markAsUnread,
|
|
301
|
+
title: t("MARK_AS_UNREAD"),
|
|
302
|
+
icon: (
|
|
303
|
+
<Icon
|
|
304
|
+
name='unread'
|
|
305
|
+
color={
|
|
306
|
+
theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.tintColor
|
|
307
|
+
}
|
|
308
|
+
height={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.height}
|
|
309
|
+
width={theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconStyle?.width}
|
|
310
|
+
containerStyle={
|
|
311
|
+
theme.messageListStyles.messageOptionsStyles?.optionsItemStyle?.iconContainerStyle
|
|
312
|
+
}
|
|
313
|
+
></Icon>
|
|
314
|
+
),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
297
317
|
// getForwardOption(): CometChatMessageOption {
|
|
298
318
|
// return {
|
|
299
319
|
// id: MessageOptionConstants.forwardMessage,
|
|
@@ -352,30 +372,34 @@ export class MessageDataSource implements DataSource {
|
|
|
352
372
|
let messageOptionList: CometChatMessageOption[] = [];
|
|
353
373
|
|
|
354
374
|
if (isDeletedMessage(messageObject)) return messageOptionList;
|
|
375
|
+
|
|
376
|
+
// reply in thread
|
|
355
377
|
if (
|
|
356
378
|
this.validateOption(
|
|
357
379
|
loggedInUser,
|
|
358
380
|
messageObject,
|
|
359
|
-
MessageOptionConstants.
|
|
381
|
+
MessageOptionConstants.replyInThread,
|
|
360
382
|
group,
|
|
361
383
|
additionalParams
|
|
362
384
|
)
|
|
363
385
|
) {
|
|
364
|
-
messageOptionList.push(this.
|
|
386
|
+
messageOptionList.push(this.getReplyInThreadOption(theme));
|
|
365
387
|
}
|
|
366
388
|
|
|
389
|
+
// reply
|
|
367
390
|
if (
|
|
368
391
|
this.validateOption(
|
|
369
392
|
loggedInUser,
|
|
370
393
|
messageObject,
|
|
371
|
-
MessageOptionConstants.
|
|
394
|
+
MessageOptionConstants.replyMessage,
|
|
372
395
|
group,
|
|
373
396
|
additionalParams
|
|
374
397
|
)
|
|
375
398
|
) {
|
|
376
|
-
messageOptionList.push(this.
|
|
399
|
+
messageOptionList.push(this.getReplyOption(theme));
|
|
377
400
|
}
|
|
378
401
|
|
|
402
|
+
// share
|
|
379
403
|
if (
|
|
380
404
|
this.validateOption(
|
|
381
405
|
loggedInUser,
|
|
@@ -388,6 +412,7 @@ export class MessageDataSource implements DataSource {
|
|
|
388
412
|
messageOptionList.push(this.getShareOption(theme));
|
|
389
413
|
}
|
|
390
414
|
|
|
415
|
+
// copy
|
|
391
416
|
if (
|
|
392
417
|
this.validateOption(
|
|
393
418
|
loggedInUser,
|
|
@@ -400,64 +425,79 @@ export class MessageDataSource implements DataSource {
|
|
|
400
425
|
messageOptionList.push(this.getCopyOption(theme));
|
|
401
426
|
}
|
|
402
427
|
|
|
428
|
+
// mark as unread
|
|
429
|
+
if(
|
|
430
|
+
this.validateOption(
|
|
431
|
+
loggedInUser,
|
|
432
|
+
messageObject,
|
|
433
|
+
MessageOptionConstants.markAsUnread,
|
|
434
|
+
group,
|
|
435
|
+
additionalParams,
|
|
436
|
+
|
|
437
|
+
)
|
|
438
|
+
) {
|
|
439
|
+
messageOptionList.push(this.getMarkAsUnreadOption(theme));
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// report
|
|
403
443
|
if (
|
|
404
444
|
this.validateOption(
|
|
405
445
|
loggedInUser,
|
|
406
446
|
messageObject,
|
|
407
|
-
MessageOptionConstants.
|
|
447
|
+
MessageOptionConstants.reportMessage,
|
|
408
448
|
group,
|
|
409
449
|
additionalParams
|
|
410
450
|
)
|
|
411
451
|
) {
|
|
412
|
-
messageOptionList.push(this.
|
|
452
|
+
messageOptionList.push(this.getReportOption(theme));
|
|
413
453
|
}
|
|
414
454
|
|
|
455
|
+
// message privately
|
|
415
456
|
if (
|
|
416
457
|
this.validateOption(
|
|
417
458
|
loggedInUser,
|
|
418
459
|
messageObject,
|
|
419
|
-
MessageOptionConstants.
|
|
460
|
+
MessageOptionConstants.sendMessagePrivately,
|
|
420
461
|
group,
|
|
421
462
|
additionalParams
|
|
422
463
|
)
|
|
423
464
|
) {
|
|
424
|
-
messageOptionList.push(this.
|
|
465
|
+
messageOptionList.push(this.getPrivateMessageOption(theme));
|
|
425
466
|
}
|
|
426
|
-
|
|
427
467
|
if (
|
|
428
468
|
this.validateOption(
|
|
429
469
|
loggedInUser,
|
|
430
470
|
messageObject,
|
|
431
|
-
MessageOptionConstants.
|
|
471
|
+
MessageOptionConstants.editMessage,
|
|
432
472
|
group,
|
|
433
473
|
additionalParams
|
|
434
474
|
)
|
|
435
475
|
) {
|
|
436
|
-
messageOptionList.push(this.
|
|
476
|
+
messageOptionList.push(this.getEditOption(theme));
|
|
437
477
|
}
|
|
438
478
|
|
|
439
|
-
|
|
479
|
+
if (
|
|
440
480
|
this.validateOption(
|
|
441
481
|
loggedInUser,
|
|
442
482
|
messageObject,
|
|
443
|
-
MessageOptionConstants.
|
|
483
|
+
MessageOptionConstants.messageInformation,
|
|
444
484
|
group,
|
|
445
485
|
additionalParams
|
|
446
486
|
)
|
|
447
487
|
) {
|
|
448
|
-
messageOptionList.push(this.
|
|
488
|
+
messageOptionList.push(this.getInformationOption(theme));
|
|
449
489
|
}
|
|
450
490
|
|
|
451
491
|
if (
|
|
452
492
|
this.validateOption(
|
|
453
493
|
loggedInUser,
|
|
454
494
|
messageObject,
|
|
455
|
-
MessageOptionConstants.
|
|
495
|
+
MessageOptionConstants.deleteMessage,
|
|
456
496
|
group,
|
|
457
497
|
additionalParams
|
|
458
498
|
)
|
|
459
499
|
) {
|
|
460
|
-
messageOptionList.push(this.
|
|
500
|
+
messageOptionList.push(this.getDeleteOption(theme));
|
|
461
501
|
}
|
|
462
502
|
|
|
463
503
|
return messageOptionList;
|
|
@@ -715,6 +755,15 @@ export class MessageDataSource implements DataSource {
|
|
|
715
755
|
) {
|
|
716
756
|
return true;
|
|
717
757
|
}
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
if (
|
|
761
|
+
MessageOptionConstants.markAsUnread === optionId &&
|
|
762
|
+
!isSentByMe &&
|
|
763
|
+
!additionalParams?.hideMarkAsUnreadOption
|
|
764
|
+
) {
|
|
765
|
+
return true;
|
|
766
|
+
}
|
|
718
767
|
|
|
719
768
|
return false;
|
|
720
769
|
}
|
|
@@ -813,6 +862,18 @@ export class MessageDataSource implements DataSource {
|
|
|
813
862
|
messageOptionList.push(this.getPrivateMessageOption(theme));
|
|
814
863
|
}
|
|
815
864
|
|
|
865
|
+
if(
|
|
866
|
+
this.validateOption(
|
|
867
|
+
loggedInUser,
|
|
868
|
+
messageObject,
|
|
869
|
+
MessageOptionConstants.markAsUnread,
|
|
870
|
+
group,
|
|
871
|
+
additionalParams
|
|
872
|
+
)
|
|
873
|
+
) {
|
|
874
|
+
messageOptionList.push(this.getMarkAsUnreadOption(theme));
|
|
875
|
+
}
|
|
876
|
+
|
|
816
877
|
return messageOptionList;
|
|
817
878
|
}
|
|
818
879
|
|
|
@@ -1012,8 +1073,9 @@ export class MessageDataSource implements DataSource {
|
|
|
1012
1073
|
|
|
1013
1074
|
// Wrap with TouchableOpacity for click handling
|
|
1014
1075
|
if (additionalParams?.onReplyClick && !isQuotedMessageDeleted) {
|
|
1076
|
+
const replyTouchableStyle = { padding: theme.spacing.padding.p0_5 };
|
|
1015
1077
|
return (
|
|
1016
|
-
<TouchableOpacity onPress={handleReplyClick} activeOpacity={0.7}>
|
|
1078
|
+
<TouchableOpacity onPress={handleReplyClick} activeOpacity={0.7} style={replyTouchableStyle}>
|
|
1017
1079
|
{previewComponent}
|
|
1018
1080
|
</TouchableOpacity>
|
|
1019
1081
|
);
|
package/src/shared/index.ts
CHANGED
|
@@ -62,6 +62,7 @@ export {
|
|
|
62
62
|
CometChatQuickReactions,
|
|
63
63
|
CometChatReactionList,
|
|
64
64
|
CometChatReactions,
|
|
65
|
+
CometChatRetryButton,
|
|
65
66
|
CometChatStatusIndicator,
|
|
66
67
|
CometChatSuggestionList,
|
|
67
68
|
CometChatTextBubble,
|
|
@@ -87,6 +88,7 @@ export type{
|
|
|
87
88
|
CometChatMessageInputInterface,
|
|
88
89
|
CometChatReactionListInterface,
|
|
89
90
|
CometChatReactionsInterface,
|
|
91
|
+
CometChatRetryButtonProps,
|
|
90
92
|
CometChatStatusIndicatorInterface,
|
|
91
93
|
CometChatSuggestionListInterface,
|
|
92
94
|
CometChatTextBubbleInterface,
|
|
@@ -481,5 +481,7 @@
|
|
|
481
481
|
"CHAT_HISTORY": "Chat-Verlauf",
|
|
482
482
|
"ASK_ANYTHING": "Frag etwas...",
|
|
483
483
|
"AI_ASSISTANT": "AI-Assistent",
|
|
484
|
-
"MESSAGE_REPORTED": "Nachricht gemeldet"
|
|
484
|
+
"MESSAGE_REPORTED": "Nachricht gemeldet",
|
|
485
|
+
"MARK_AS_UNREAD": "Ungelesen markieren",
|
|
486
|
+
"NEW": "Neu"
|
|
485
487
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Conversations",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Messages",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "No messages",
|
|
504
|
-
|
|
504
|
+
"MESSAGE_REPORTED": "Message reported",
|
|
505
|
+
"MARK_AS_UNREAD": "Mark Unread",
|
|
506
|
+
"NEW": "New"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Conversaciones",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Mensajes",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "No hay mensajes",
|
|
504
|
-
"MESSAGE_REPORTED": "Mensaje reportado"
|
|
504
|
+
"MESSAGE_REPORTED": "Mensaje reportado",
|
|
505
|
+
"MARK_AS_UNREAD": "Marcar no leído",
|
|
506
|
+
"NEW": "Nuevo"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Conversations",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Messages",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Aucun message",
|
|
504
|
-
"MESSAGE_REPORTED": "Message signalé"
|
|
504
|
+
"MESSAGE_REPORTED": "Message signalé",
|
|
505
|
+
"MARK_AS_UNREAD": "Marquer non lu",
|
|
506
|
+
"NEW": "Nouveau"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "बातचीत",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "संदेश",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "कोई संदेश नहीं",
|
|
504
|
-
"MESSAGE_REPORTED": "संदेश रिपोर्ट किया गया"
|
|
504
|
+
"MESSAGE_REPORTED": "संदेश रिपोर्ट किया गया",
|
|
505
|
+
"MARK_AS_UNREAD": "अपठित करें",
|
|
506
|
+
"NEW": "नया"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Beszélgetések",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Üzenetek",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Nincsenek üzenetek",
|
|
504
|
-
"MESSAGE_REPORTED": "Üzenet
|
|
504
|
+
"MESSAGE_REPORTED": "Üzenet jelentve",
|
|
505
|
+
"MARK_AS_UNREAD": "Olvasatlanként jelöl",
|
|
506
|
+
"NEW": "Új"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Conversazioni",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Messaggi",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Nessun messaggio",
|
|
504
|
-
"MESSAGE_REPORTED": "Messaggio segnalato"
|
|
504
|
+
"MESSAGE_REPORTED": "Messaggio segnalato",
|
|
505
|
+
"MARK_AS_UNREAD": "Contrassegna non letto",
|
|
506
|
+
"NEW": "Nuovo"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Pokalbiai",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Žinutės",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Nėra žinučių",
|
|
504
|
-
"MESSAGE_REPORTED": "Pranešimas praneštas"
|
|
504
|
+
"MESSAGE_REPORTED": "Pranešimas praneštas",
|
|
505
|
+
"MARK_AS_UNREAD": "Pažymėti neskaitytą",
|
|
506
|
+
"NEW": "Naujas"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Perbualan",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Mesej",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Tiada mesej",
|
|
504
|
-
"MESSAGE_REPORTED": "Mesej dilaporkan"
|
|
504
|
+
"MESSAGE_REPORTED": "Mesej dilaporkan",
|
|
505
|
+
"MARK_AS_UNREAD": "Tandai belum dibaca",
|
|
506
|
+
"NEW": "Baru"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Gesprekken",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Berichten",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Geen berichten",
|
|
504
|
-
"MESSAGE_REPORTED": "Bericht gemeld"
|
|
504
|
+
"MESSAGE_REPORTED": "Bericht gemeld",
|
|
505
|
+
"MARK_AS_UNREAD": "Ongelezen markeren",
|
|
506
|
+
"NEW": "Nieuw"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Conversas",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Mensagens",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Nenhuma mensagem",
|
|
504
|
-
"MESSAGE_REPORTED": "Mensagem denunciada"
|
|
504
|
+
"MESSAGE_REPORTED": "Mensagem denunciada",
|
|
505
|
+
"MARK_AS_UNREAD": "Marcar não lido",
|
|
506
|
+
"NEW": "Novo"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Беседы",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Сообщения",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Нет сообщений",
|
|
504
|
-
"MESSAGE_REPORTED": "Сообщение отправлено на жалобу"
|
|
504
|
+
"MESSAGE_REPORTED": "Сообщение отправлено на жалобу",
|
|
505
|
+
"MARK_AS_UNREAD": "Отметить непрочитанным",
|
|
506
|
+
"NEW": "Новый"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Konversationer",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Meddelanden",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Inga meddelanden",
|
|
504
|
-
"MESSAGE_REPORTED": "Meddelandet har rapporterats"
|
|
504
|
+
"MESSAGE_REPORTED": "Meddelandet har rapporterats",
|
|
505
|
+
"MARK_AS_UNREAD": "Markera oläst",
|
|
506
|
+
"NEW": "Ny"
|
|
505
507
|
}
|
|
@@ -501,5 +501,7 @@
|
|
|
501
501
|
"SEARCH_FILTER_CONVERSATIONS": "Sohbetler",
|
|
502
502
|
"SEARCH_FILTER_MESSAGES": "Mesajlar",
|
|
503
503
|
"SEARCH_NO_MESSAGES": "Mesaj yok",
|
|
504
|
-
"MESSAGE_REPORTED": "Mesaj bildirildi"
|
|
504
|
+
"MESSAGE_REPORTED": "Mesaj bildirildi",
|
|
505
|
+
"MARK_AS_UNREAD": "Okunmamış işaretle",
|
|
506
|
+
"NEW": "Yeni"
|
|
505
507
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { JSX, useCallback, useMemo } from "react";
|
|
1
|
+
import React, { JSX, useCallback, useMemo, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
FlatList,
|
|
4
4
|
ImageSourcePropType,
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
Pressable,
|
|
7
7
|
Text,
|
|
8
8
|
TextStyle,
|
|
9
|
-
View,
|
|
10
9
|
ViewStyle,
|
|
11
10
|
} from "react-native";
|
|
12
11
|
import { useTheme } from "../../../theme";
|
|
@@ -36,6 +35,8 @@ const OptionListView = ({
|
|
|
36
35
|
}>;
|
|
37
36
|
}) => {
|
|
38
37
|
const theme = useTheme();
|
|
38
|
+
const [isPressed, setIsPressed] = useState(false);
|
|
39
|
+
|
|
39
40
|
const renderIcon = useCallback(() => {
|
|
40
41
|
return (
|
|
41
42
|
<Icon icon={icon} imageStyle={style?.iconStyle} containerStyle={style?.iconContainerStyle} />
|
|
@@ -46,9 +47,11 @@ const OptionListView = ({
|
|
|
46
47
|
<Pressable
|
|
47
48
|
key={id}
|
|
48
49
|
onPress={onPress}
|
|
49
|
-
|
|
50
|
+
onPressIn={() => setIsPressed(true)}
|
|
51
|
+
onPressOut={() => setIsPressed(false)}
|
|
52
|
+
style={[
|
|
50
53
|
style?.containerStyle,
|
|
51
|
-
|
|
54
|
+
isPressed && { backgroundColor: theme.color.background4 },
|
|
52
55
|
]}
|
|
53
56
|
>
|
|
54
57
|
{renderIcon()}
|
|
@@ -65,7 +65,9 @@ export const CometChatAudioBubble = ({
|
|
|
65
65
|
useEffect(() => {
|
|
66
66
|
if (audioUrl) {
|
|
67
67
|
SoundPlayer.prepareMediaPlayer(audioUrl, (s: string) => {
|
|
68
|
-
|
|
68
|
+
try {
|
|
69
|
+
setDuration(JSON.parse(s).duration);
|
|
70
|
+
} catch (e) {}
|
|
69
71
|
});
|
|
70
72
|
}
|
|
71
73
|
|
|
@@ -118,20 +120,24 @@ export const CometChatAudioBubble = ({
|
|
|
118
120
|
}
|
|
119
121
|
// Get total duration when audio starts playing
|
|
120
122
|
SoundPlayer.getPosition((info: string) => {
|
|
121
|
-
|
|
122
|
-
if (
|
|
123
|
-
|
|
123
|
+
try {
|
|
124
|
+
if (info) {
|
|
125
|
+
if (Platform.OS == "android") {
|
|
126
|
+
setStatus("playing");
|
|
127
|
+
}
|
|
128
|
+
setCurrentTime(JSON.parse(info).position);
|
|
124
129
|
}
|
|
125
|
-
|
|
126
|
-
}
|
|
130
|
+
} catch (e) {}
|
|
127
131
|
});
|
|
128
132
|
|
|
129
133
|
// Start tracking the current time
|
|
130
134
|
interval = setInterval(() => {
|
|
131
135
|
SoundPlayer.getPosition((info: string) => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
try {
|
|
137
|
+
if (info) {
|
|
138
|
+
setCurrentTime(JSON.parse(info).position);
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {}
|
|
135
141
|
});
|
|
136
142
|
}, 500);
|
|
137
143
|
return;
|
|
@@ -145,9 +151,11 @@ export const CometChatAudioBubble = ({
|
|
|
145
151
|
setStatus("playing");
|
|
146
152
|
// Get total duration when audio starts playing
|
|
147
153
|
SoundPlayer.getPosition((info: string) => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
try {
|
|
155
|
+
if (info) {
|
|
156
|
+
setCurrentTime(JSON.parse(info).position);
|
|
157
|
+
}
|
|
158
|
+
} catch (e) {}
|
|
151
159
|
});
|
|
152
160
|
|
|
153
161
|
// Start tracking the current time
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
|
-
import { Text, View } from "react-native";
|
|
2
|
+
import { Text, View, Dimensions } from "react-native";
|
|
3
3
|
import { useTheme } from "../../../theme";
|
|
4
4
|
import { deepMerge } from "../../helper/helperFunctions";
|
|
5
5
|
import { BadgeStyle } from "./styles";
|
|
@@ -49,9 +49,12 @@ export const CometChatBadge = (props: CometChatBadgeProps) => {
|
|
|
49
49
|
// If count is zero or an empty string, do not render the badge.
|
|
50
50
|
if (countText.length === 0) return null;
|
|
51
51
|
|
|
52
|
+
const fontScale = Dimensions.get('window').fontScale;
|
|
53
|
+
const badgeSize = 25 * fontScale;
|
|
54
|
+
|
|
52
55
|
return (
|
|
53
|
-
<View style={[badgeStyle.containerStyle]}>
|
|
54
|
-
<Text style={[badgeStyle.textStyle]}>{countText}</Text>
|
|
56
|
+
<View style={[badgeStyle.containerStyle, { width: badgeSize, height: badgeSize }]}>
|
|
57
|
+
<Text style={[badgeStyle.textStyle]} numberOfLines={1} adjustsFontSizeToFit={true}>{countText}</Text>
|
|
55
58
|
</View>
|
|
56
59
|
);
|
|
57
60
|
};
|
|
@@ -91,7 +91,7 @@ const CometChatBottomSheet = forwardRef(
|
|
|
91
91
|
onDismiss,
|
|
92
92
|
} = props;
|
|
93
93
|
|
|
94
|
-
//
|
|
94
|
+
// All hooks called unconditionally at top level
|
|
95
95
|
const overlayAnim = useRef(new Animated.Value(0)).current;
|
|
96
96
|
const [isModalOpen, setIsModalOpen] = useState(isOpen);
|
|
97
97
|
|
|
@@ -161,6 +161,7 @@ const CometChatBottomSheet = forwardRef(
|
|
|
161
161
|
visible={isModalOpen}
|
|
162
162
|
onRequestClose={togglePanel}
|
|
163
163
|
onDismiss={onDismiss}
|
|
164
|
+
supportedOrientations={["portrait", "landscape"]}
|
|
164
165
|
>
|
|
165
166
|
{/* Animated overlay that fades in from transparent to a semi-transparent black */}
|
|
166
167
|
<Animated.View
|
|
@@ -38,6 +38,7 @@ export interface CometChatListActionsInterface {
|
|
|
38
38
|
getListItem: (itemId: string | number) => any;
|
|
39
39
|
getSelectedItems: () => Array<any>;
|
|
40
40
|
getAllListItems: () => Array<any>;
|
|
41
|
+
reload: () => void;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
export interface CometChatListStylesInterface {
|
|
@@ -212,6 +213,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
212
213
|
updateAndMoveToFirst,
|
|
213
214
|
getSelectedItems,
|
|
214
215
|
getAllListItems,
|
|
216
|
+
reload,
|
|
215
217
|
};
|
|
216
218
|
});
|
|
217
219
|
|
|
@@ -491,7 +493,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
491
493
|
if (newlist.length === 0) setHasMoreData(false);
|
|
492
494
|
}
|
|
493
495
|
|
|
494
|
-
// If we *did* get results but less than a full
|
|
496
|
+
// If we *did* get results but less than a full "page", also stop further loads
|
|
495
497
|
if (newlist.length === 0) setHasMoreData(false);
|
|
496
498
|
|
|
497
499
|
props.onListFetched?.(finalList);
|
|
@@ -508,6 +510,23 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
|
|
|
508
510
|
});
|
|
509
511
|
};
|
|
510
512
|
|
|
513
|
+
/**
|
|
514
|
+
* Reloads the list by fetching fresh data (matches Calls tab behavior)
|
|
515
|
+
*/
|
|
516
|
+
const reload = () => {
|
|
517
|
+
// Prevent multiple reloads if a load operation is already in progress
|
|
518
|
+
if (isLoadingMore) return;
|
|
519
|
+
|
|
520
|
+
setDataLoadingStatus(LOADING);
|
|
521
|
+
setHasMoreData(true);
|
|
522
|
+
if (requestBuilder) {
|
|
523
|
+
if (searchInputRef.current)
|
|
524
|
+
listHandlerRef.current = requestBuilder.setSearchKeyword(searchInputRef.current).build();
|
|
525
|
+
else listHandlerRef.current = requestBuilder.build();
|
|
526
|
+
}
|
|
527
|
+
handleList(true);
|
|
528
|
+
};
|
|
529
|
+
|
|
511
530
|
const renderFooter = useCallback(() => {
|
|
512
531
|
if (!isLoadingMore || !hasMoreData) return null;
|
|
513
532
|
return (
|
|
@@ -133,15 +133,14 @@ export const CometChatMessageInput = (props: CometChatMessageInputInterface) =>
|
|
|
133
133
|
placeholder={placeHolderText}
|
|
134
134
|
onSelectionChange={onSelectionChange}
|
|
135
135
|
selection={selection}
|
|
136
|
+
value={text}
|
|
136
137
|
onFocus={() => {
|
|
137
138
|
CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.hidePanel, {
|
|
138
139
|
alignment: ViewAlignment.composerBottom,
|
|
139
140
|
child: () => null, // Hide the panel content.
|
|
140
141
|
});
|
|
141
142
|
}}
|
|
142
|
-
|
|
143
|
-
{text}
|
|
144
|
-
</TextInput>
|
|
143
|
+
/>
|
|
145
144
|
<View style={style?.dividerStyle as ViewStyle} />
|
|
146
145
|
<View
|
|
147
146
|
style={{
|