@cometchat/chat-uikit-react-native 4.3.19 → 4.3.21
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/android/src/main/AndroidManifest.xml +6 -0
- package/package.json +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +19 -25
- package/src/CometChatGroups/CometChatGroups.tsx +2 -2
- package/src/CometChatGroups/GroupsConfiguration.ts +13 -16
- package/src/CometChatGroups/resources/index.ts +0 -3
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +6 -2
- package/src/CometChatMessageInformation/MessageInformationConfiguration.tsx +31 -12
- package/src/CometChatMessageInformation/index.ts +6 -3
- package/src/CometChatMessageList/CometChatMessageList.tsx +24 -9
- package/src/CometChatMessageList/MessageListConfiguration.ts +21 -0
- package/src/CometChatTabs/CometChatTabs.tsx +8 -8
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +2 -1
- package/src/CometChatUsers/CometChatUsers.tsx +40 -11
- package/src/CometChatUsers/UsersConfiguration.tsx +2 -2
- package/src/CometChatUsers/UsersStyle.ts +101 -0
- package/src/CometChatUsers/index.ts +4 -1
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +1 -1
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +1 -1
- package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -6
- package/src/index.ts +8 -2
- package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +53 -53
- package/src/shared/framework/MessageDataSource.tsx +1 -1
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +1 -1
- package/src/shared/libs/VideoPlayerControls/components/Control.tsx +1 -1
- package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +1 -1
- package/src/shared/libs/luxon/src/impl/zoneUtil.js +0 -4
- package/src/shared/utils/CommonUtils.ts +15 -15
- package/src/shared/utils/InteractiveMessageUtils.ts +1 -1
- package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +10 -12
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +1 -1
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +2 -2
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +1 -1
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +3 -3
- package/src/shared/views/CometChatImageBubble/assets/index.ts +1 -0
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +18 -4
- package/src/shared/views/CometChatMessageBubble/MessageBubbleStyle.ts +2 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +0 -1
- package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +5 -5
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
- package/src/CometChatGroups/resources/search.png +0 -0
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
5
5
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
6
6
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
7
|
+
<queries>
|
|
8
|
+
<intent>
|
|
9
|
+
<action android:name="android.intent.action.VIEW" />
|
|
10
|
+
<data android:scheme="https" android:host="*" />
|
|
11
|
+
</intent>
|
|
12
|
+
</queries>
|
|
7
13
|
<application android:requestLegacyExternalStorage="true"
|
|
8
14
|
android:largeHeap="true" >
|
|
9
15
|
<activity
|
package/package.json
CHANGED
|
@@ -367,11 +367,11 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
367
367
|
const userEventHandler = (...args: any[]) => {
|
|
368
368
|
const { uid, blockedByMe, status } = args[0];
|
|
369
369
|
if (!blockedByMe) {
|
|
370
|
-
let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`);
|
|
370
|
+
let item: CometChat.Conversation | any = conversationListRef.current?.getListItem(`${uid}_user_${loggedInUser.current?.uid}`) as unknown as CometChat.Conversation || conversationListRef.current?.getListItem(`${loggedInUser.current?.uid}_user_${uid}`) as unknown as CometChat.Conversation;
|
|
371
371
|
if (item) {
|
|
372
372
|
let updatedConversation = CommonUtils.clone(item);
|
|
373
373
|
updatedConversation.setConversationWith(args[0]);
|
|
374
|
-
conversationListRef.current
|
|
374
|
+
conversationListRef.current?.updateList(updatedConversation);
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
377
|
}
|
|
@@ -566,18 +566,18 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
566
566
|
}
|
|
567
567
|
|
|
568
568
|
const updateMessageReceipt = (receipt: CometChat.MessageReceipt) => {
|
|
569
|
-
const conv: CometChat.Conversation =
|
|
569
|
+
const conv: CometChat.Conversation | boolean =
|
|
570
570
|
receipt?.getReceiverType() === ReceiverTypeConstants.user
|
|
571
|
-
? conversationListRef.current
|
|
571
|
+
? conversationListRef.current?.getListItem(
|
|
572
572
|
`${receipt?.getReceiver()}_user_${receipt?.getSender().getUid()}`
|
|
573
|
-
) ||
|
|
574
|
-
conversationListRef.current
|
|
573
|
+
) as unknown as CometChat.Conversation ||
|
|
574
|
+
conversationListRef.current?.getListItem(
|
|
575
575
|
`${receipt?.getSender()?.getUid()}_user_${receipt?.getReceiver()}`
|
|
576
|
-
)
|
|
576
|
+
) as unknown as CometChat.Conversation
|
|
577
577
|
: [receipt.RECEIPT_TYPE.DELIVERED_TO_ALL_RECEIPT, receipt.RECEIPT_TYPE.READ_BY_ALL_RECEIPT].includes(receipt?.getReceiptType()) &&
|
|
578
|
-
conversationListRef.current
|
|
578
|
+
conversationListRef.current?.getListItem(
|
|
579
579
|
`group_${receipt?.getReceiver()}`
|
|
580
|
-
);
|
|
580
|
+
) as unknown as CometChat.Conversation;
|
|
581
581
|
|
|
582
582
|
if (
|
|
583
583
|
conv &&
|
|
@@ -590,17 +590,17 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
590
590
|
if (
|
|
591
591
|
conv &&
|
|
592
592
|
conv?.getLastMessage &&
|
|
593
|
-
(conv.getLastMessage().id == receipt
|
|
594
|
-
conv.getLastMessage().messageId == receipt
|
|
593
|
+
(conv.getLastMessage().id == receipt.getMessageId() ||
|
|
594
|
+
conv.getLastMessage().messageId == receipt.getMessageId())
|
|
595
595
|
) {
|
|
596
596
|
let newConversation = CommonUtils.clone(conv);
|
|
597
|
-
if (receipt
|
|
598
|
-
newConversation.getLastMessage().setReadAt(receipt
|
|
597
|
+
if (receipt.getReadAt()) {
|
|
598
|
+
newConversation.getLastMessage().setReadAt(receipt.getReadAt());
|
|
599
599
|
}
|
|
600
|
-
if (receipt
|
|
601
|
-
newConversation.getLastMessage().setDeliveredAt(receipt
|
|
600
|
+
if (receipt.getDeliveredAt()) {
|
|
601
|
+
newConversation.getLastMessage().setDeliveredAt(receipt.getDeliveredAt());
|
|
602
602
|
}
|
|
603
|
-
conversationListRef.current
|
|
603
|
+
conversationListRef.current?.updateList(newConversation);
|
|
604
604
|
}
|
|
605
605
|
};
|
|
606
606
|
|
|
@@ -749,7 +749,7 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
749
749
|
|
|
750
750
|
function getFormattedText(message: CometChat.BaseMessage, subtitle: string) {
|
|
751
751
|
let messageTextTmp = subtitle;
|
|
752
|
-
let allFormatters = [...(textFormatters
|
|
752
|
+
let allFormatters = [...(textFormatters ?? [])];
|
|
753
753
|
|
|
754
754
|
if (!disableMentions && message.getMentionedUsers().length) {
|
|
755
755
|
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
@@ -1057,14 +1057,8 @@ export const CometChatConversations = (props: ConversationInterface) => {
|
|
|
1057
1057
|
{
|
|
1058
1058
|
ccConversationDeleted:
|
|
1059
1059
|
({ conversation }: { conversation: CometChat.Conversation | any }) => {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
conversationListRef.current?.removeItemFromList(conversation);
|
|
1063
|
-
removeItemFromSelectionList(conversation.getConversationId())
|
|
1064
|
-
})
|
|
1065
|
-
.catch((err: any) => {
|
|
1066
|
-
console.log("Error", err);
|
|
1067
|
-
});
|
|
1060
|
+
conversationListRef.current?.removeItemFromList(conversation.getConversationId());
|
|
1061
|
+
removeItemFromSelectionList(conversation.getConversationId())
|
|
1068
1062
|
}
|
|
1069
1063
|
}
|
|
1070
1064
|
);
|
|
@@ -3,7 +3,7 @@ import React, { useState, useRef } from "react";
|
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import { Text, TextStyle, View, ViewProps } from "react-native";
|
|
5
5
|
import {
|
|
6
|
-
backIcon,
|
|
6
|
+
backIcon,
|
|
7
7
|
passwordGroupIcon, privateGroupIcon,
|
|
8
8
|
checkIcon,
|
|
9
9
|
} from "./resources";
|
|
@@ -595,7 +595,7 @@ CometChatGroups.defaultProps = {
|
|
|
595
595
|
title: localize("GROUPS"),
|
|
596
596
|
searchPlaceHolderText: localize("SEARCH"),
|
|
597
597
|
showBackButton: false,
|
|
598
|
-
searchBoxIcon:
|
|
598
|
+
searchBoxIcon: undefined,
|
|
599
599
|
hideSearch: false,
|
|
600
600
|
listItemStyle: undefined,
|
|
601
601
|
avatarStyle: undefined,
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
import { GroupsStyle, GroupsStyleInterface } from './GroupsStyle';
|
|
10
10
|
import {
|
|
11
11
|
backIcon,
|
|
12
|
-
searchIcon,
|
|
13
12
|
passwordGroupIcon,
|
|
14
13
|
privateGroupIcon,
|
|
15
14
|
} from './resources';
|
|
@@ -60,23 +59,23 @@ export class GroupsConfiguration implements GroupsConfigurationInterface {
|
|
|
60
59
|
ListItemView!: (item: CometChat.Group) => JSX.Element;
|
|
61
60
|
AppBarOption!: () => JSX.Element;
|
|
62
61
|
options!: (item: CometChat.Group) => CometChatOptions[];
|
|
63
|
-
hideSeparator
|
|
64
|
-
searchPlaceholderText
|
|
65
|
-
backButton
|
|
66
|
-
showBackButton
|
|
67
|
-
selectionMode
|
|
62
|
+
hideSeparator?: boolean;
|
|
63
|
+
searchPlaceholderText?: string;
|
|
64
|
+
backButton?: ImageType;
|
|
65
|
+
showBackButton?: boolean;
|
|
66
|
+
selectionMode?: 'none' | 'single' | 'multiple';
|
|
68
67
|
onSelection!: (items: Array<CometChat.Group>) => void;
|
|
69
|
-
searchBoxIcon
|
|
70
|
-
hideSearch
|
|
71
|
-
title
|
|
68
|
+
searchBoxIcon?: ImageType;
|
|
69
|
+
hideSearch?: boolean;
|
|
70
|
+
title?: string;
|
|
72
71
|
EmptyStateView!: () => JSX.Element;
|
|
73
72
|
ErrorStateView!: () => JSX.Element;
|
|
74
73
|
LoadingStateView!: () => JSX.Element;
|
|
75
74
|
groupsRequestBuilder: CometChat.GroupsRequestBuilder | undefined;
|
|
76
|
-
searchKeyword
|
|
77
|
-
privateGroupIcon
|
|
78
|
-
passwordGroupIcon
|
|
79
|
-
hideError
|
|
75
|
+
searchKeyword?: string;
|
|
76
|
+
privateGroupIcon?: ImageType;
|
|
77
|
+
passwordGroupIcon?: ImageType;
|
|
78
|
+
hideError?: boolean;
|
|
80
79
|
onItemPress?: (item: CometChat.Group) => void;
|
|
81
80
|
onItemLongPress?: (item: CometChat.Group) => void;
|
|
82
81
|
onError?: (e: CometChat.CometChatException) => void;
|
|
@@ -89,8 +88,6 @@ export class GroupsConfiguration implements GroupsConfigurationInterface {
|
|
|
89
88
|
|
|
90
89
|
constructor(props: GroupsConfigurationInterface) {
|
|
91
90
|
if (props)
|
|
92
|
-
|
|
93
|
-
this[key] = value;
|
|
94
|
-
}
|
|
91
|
+
Object.assign(this, props);
|
|
95
92
|
}
|
|
96
93
|
}
|
|
@@ -3,8 +3,6 @@ import backIcon from "./back.png";
|
|
|
3
3
|
//@ts-ignore
|
|
4
4
|
import createIcon from "./create.png";
|
|
5
5
|
//@ts-ignore
|
|
6
|
-
import searchIcon from "./search.png";
|
|
7
|
-
//@ts-ignore
|
|
8
6
|
import passwordGroupIcon from "./password.png";
|
|
9
7
|
//@ts-ignore
|
|
10
8
|
import privateGroupIcon from "./private.png";
|
|
@@ -22,7 +20,6 @@ import checkIcon from './check.png';
|
|
|
22
20
|
export {
|
|
23
21
|
backIcon,
|
|
24
22
|
createIcon,
|
|
25
|
-
searchIcon,
|
|
26
23
|
passwordGroupIcon,
|
|
27
24
|
privateGroupIcon,
|
|
28
25
|
loadingIcon,
|
|
@@ -236,6 +236,7 @@ let recordedTime = 0, timerIntervalId = null;
|
|
|
236
236
|
export interface MessageComposerStyleInterface extends BaseStyle {
|
|
237
237
|
attachIconTint?: string;
|
|
238
238
|
sendIconTint?: string;
|
|
239
|
+
voiceRecordingIconTint?: string;
|
|
239
240
|
inputBackground?: string;
|
|
240
241
|
inputBorder?: BorderStyleInterface;
|
|
241
242
|
dividerTint?: string;
|
|
@@ -1210,7 +1211,10 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1210
1211
|
const RecordAudioButtonView = () => {
|
|
1211
1212
|
return <ImageButton
|
|
1212
1213
|
image={voiceRecordingIconURL || ICONS.MICROPHONE}
|
|
1213
|
-
imageStyle={
|
|
1214
|
+
imageStyle={[
|
|
1215
|
+
Style.imageStyle,
|
|
1216
|
+
messageComposerStyle?.voiceRecordingIconTint ? { tintColor: messageComposerStyle?.voiceRecordingIconTint } : {},
|
|
1217
|
+
]}
|
|
1214
1218
|
onClick={() => setShowRecordAudio(true)}
|
|
1215
1219
|
/>
|
|
1216
1220
|
}
|
|
@@ -1228,7 +1232,7 @@ export const CometChatMessageComposer = React.forwardRef(
|
|
|
1228
1232
|
//fetch logged in user
|
|
1229
1233
|
useEffect(() => {
|
|
1230
1234
|
CometChat.getLoggedinUser().then((user: any) => (loggedInUser.current = user));
|
|
1231
|
-
let _formatter = [...(textFormatters
|
|
1235
|
+
let _formatter = [...(textFormatters ?? [])];
|
|
1232
1236
|
|
|
1233
1237
|
if (!disableMentions) {
|
|
1234
1238
|
let mentionsFormatter = ChatConfigurator.getDataSource().getMentionsFormatter();
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
import { CometChatMessageInformationInterface } from
|
|
1
|
+
import { CometChatMessageInformationInterface } from './CometChatMessageInformation';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
// Interface/Class merging: Class and Interface name should be the same. (below)
|
|
4
|
+
// Add a second interface for typing (if needed elsewhere)
|
|
5
|
+
// To avoid listing all properties individually in the class
|
|
6
|
+
export interface CometChatMessageInformationConfiguration
|
|
7
|
+
extends Omit<
|
|
8
|
+
CometChatMessageInformationInterface,
|
|
9
|
+
| 'title'
|
|
10
|
+
| 'message'
|
|
11
|
+
| 'template'
|
|
12
|
+
| 'BubbleView'
|
|
13
|
+
| 'receiptDatePattern'
|
|
14
|
+
| 'readIcon'
|
|
15
|
+
| 'sentIcon'
|
|
16
|
+
| 'deliveredIcon'
|
|
17
|
+
> {}
|
|
18
|
+
|
|
19
|
+
export interface CometChatMessageInformationConfigurationInterface
|
|
20
|
+
extends CometChatMessageInformationConfiguration {}
|
|
21
|
+
|
|
22
|
+
// Class name same as interface
|
|
23
|
+
export class CometChatMessageInformationConfiguration {
|
|
24
|
+
constructor(props: CometChatMessageInformationConfigurationInterface) {
|
|
25
|
+
if (props) {
|
|
26
|
+
for (const [key, value] of Object.entries(props)) {
|
|
27
|
+
//@ts-ignore - Ignore dynamic property assignment type checks
|
|
28
|
+
this[key] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -2,12 +2,15 @@ import {
|
|
|
2
2
|
CometChatMessageInformation,
|
|
3
3
|
CometChatMessageInformationInterface,
|
|
4
4
|
} from "./CometChatMessageInformation";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CometChatMessageInformationConfigurationInterface,
|
|
7
|
+
CometChatMessageInformationConfiguration
|
|
8
|
+
} from "./MessageInformationConfiguration";
|
|
6
9
|
import { MessageInformationStyleInterface } from "./MessageInformationStyle";
|
|
7
10
|
|
|
8
|
-
export { CometChatMessageInformation };
|
|
11
|
+
export { CometChatMessageInformation, CometChatMessageInformationConfiguration };
|
|
9
12
|
export type {
|
|
10
13
|
CometChatMessageInformationInterface,
|
|
11
|
-
|
|
14
|
+
CometChatMessageInformationConfigurationInterface,
|
|
12
15
|
MessageInformationStyleInterface,
|
|
13
16
|
};
|
|
@@ -25,7 +25,7 @@ import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandle
|
|
|
25
25
|
import { ActionSheetStylesInterface } from "../shared/views/CometChatActionSheet/ActionSheetStyle";
|
|
26
26
|
import { CometChatMessageInformation } from "../CometChatMessageInformation/CometChatMessageInformation";
|
|
27
27
|
// import { CometChatContacts, ForwardMessageConfigurationInterface } from "../CometChatContacts";
|
|
28
|
-
import {
|
|
28
|
+
import { CometChatMessageInformationConfigurationInterface } from "../CometChatMessageInformation";
|
|
29
29
|
import { InteractiveMessageUtils } from "../shared/utils/InteractiveMessageUtils";
|
|
30
30
|
import { CometChatEmojiKeyboard, EmojiKeyboardStyle } from "../shared/views/CometChatEmojiKeyboard";
|
|
31
31
|
import { CometChatReactionList, ReactionListConfigurationInterface } from "../shared/views/CometChatReactionList";
|
|
@@ -93,10 +93,15 @@ export interface CometChatMessageListProps {
|
|
|
93
93
|
onError?: (e: CometChat.CometChatException) => void,
|
|
94
94
|
onBack?: () => void,
|
|
95
95
|
// forwardMessageConfiguration?: ForwardMessageConfigurationInterface,
|
|
96
|
-
messageInformationConfiguration?:
|
|
96
|
+
messageInformationConfiguration?: CometChatMessageInformationConfigurationInterface,
|
|
97
97
|
/**
|
|
98
98
|
* Hide the header of the action sheet
|
|
99
99
|
*/
|
|
100
|
+
/**
|
|
101
|
+
* @deprecated
|
|
102
|
+
*
|
|
103
|
+
* This property is deprecated as of version 4.3.20, as it is no longer needed. It will be removed in subsequent versions.
|
|
104
|
+
*/
|
|
100
105
|
hideActionSheetHeader?: boolean,
|
|
101
106
|
/**
|
|
102
107
|
* Message Reaction Configuration @ReactionsConfigurationInterface
|
|
@@ -181,7 +186,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
181
186
|
onBack,
|
|
182
187
|
// forwardMessageConfiguration
|
|
183
188
|
messageInformationConfiguration,
|
|
184
|
-
hideActionSheetHeader,
|
|
189
|
+
hideActionSheetHeader = true,
|
|
185
190
|
reactionsConfiguration,
|
|
186
191
|
disableReactions,
|
|
187
192
|
reactionListConfiguration,
|
|
@@ -672,7 +677,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
672
677
|
}
|
|
673
678
|
function checkSameConversation(message: CometChat.BaseMessage): boolean {
|
|
674
679
|
return message.getConversationId() == conversationId.current ||
|
|
675
|
-
(message.getSender()?.
|
|
680
|
+
(message.getSender()?.getUid() === user?.getUid() && message.getReceiverType() == CometChatUiKitConstants.ReceiverTypeConstants.user);
|
|
676
681
|
}
|
|
677
682
|
|
|
678
683
|
function isNearBottom() {
|
|
@@ -865,7 +870,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
865
870
|
}
|
|
866
871
|
|
|
867
872
|
const handlePannel = (item: any) => {
|
|
868
|
-
if (item.alignment === ViewAlignment.messageListBottom && user
|
|
873
|
+
if (item.alignment === ViewAlignment.messageListBottom && (user || group) && CommonUtils.checkIdBelongsToThisComponent(item.id, user, group, parentMessageId || '')) {
|
|
869
874
|
if (item.child)
|
|
870
875
|
setCustomListHeader(() => item.child)
|
|
871
876
|
else
|
|
@@ -1321,9 +1326,11 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1321
1326
|
if (timeStampAlignment == "top" || item['category'] == "action" || item['deletedAt']) return null
|
|
1322
1327
|
|
|
1323
1328
|
let isSender = (item.getSender()?.getUid() || item?.['sender']?.['uid']) == loggedInUser.current?.getUid();
|
|
1324
|
-
let messageState;
|
|
1325
|
-
|
|
1326
|
-
|
|
1329
|
+
let messageState, nextItemIsRead, nextItemIsDelivered;
|
|
1330
|
+
if(currentIndex !== undefined) {
|
|
1331
|
+
nextItemIsRead = messagesContentListRef.current[currentIndex + 1] && messagesContentListRef.current[currentIndex + 1].getReadAt();
|
|
1332
|
+
nextItemIsDelivered = messagesContentListRef.current[currentIndex + 1] && messagesContentListRef.current[currentIndex + 1].getDeliveredAt();
|
|
1333
|
+
}
|
|
1327
1334
|
if (item.getReadAt() || nextItemIsRead)
|
|
1328
1335
|
messageState = "READ";
|
|
1329
1336
|
else if (item.getDeliveredAt() || nextItemIsDelivered)
|
|
@@ -1638,7 +1645,7 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1638
1645
|
const openOptionsForMessage = useCallback((item: CometChat.BaseMessage | any, template: CometChatMessageTemplate) => {
|
|
1639
1646
|
let options = template?.options ? loggedInUser.current ? template.options(loggedInUser.current, item, group) : [] : [];
|
|
1640
1647
|
let optionsWithPressHandling = options.map(option => {
|
|
1641
|
-
if (!option.onPress)
|
|
1648
|
+
if (!option.onPress){
|
|
1642
1649
|
switch (option.id) {
|
|
1643
1650
|
case MessageOptionConstants.messageInformation:
|
|
1644
1651
|
option.onPress = openMessageInfo.bind(this, item);
|
|
@@ -1665,6 +1672,14 @@ export const CometChatMessageList = memo(forwardRef<
|
|
|
1665
1672
|
option.onPress = shareMedia.bind(this, item);
|
|
1666
1673
|
break;
|
|
1667
1674
|
}
|
|
1675
|
+
}else{
|
|
1676
|
+
// If overriding `onPress`, make sure to pass `item` explicitly
|
|
1677
|
+
const customOnPress = option.onPress;
|
|
1678
|
+
option.onPress = () =>{
|
|
1679
|
+
customOnPress(item);
|
|
1680
|
+
setShowMessageOptions([]);
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1668
1683
|
if (option.id === MessageOptionConstants.reactToMessage) {
|
|
1669
1684
|
option.onPress = () => {
|
|
1670
1685
|
if (option.CustomView) {
|
|
@@ -21,6 +21,7 @@ import { ReactionsConfigurationInterface } from '../shared/views/CometChatReacti
|
|
|
21
21
|
import { ReactionListConfigurationInterface } from '../shared/views/CometChatReactionList';
|
|
22
22
|
import { QuickReactionsConfigurationInterface } from '../shared/views/CometChatQuickReactions';
|
|
23
23
|
import { EmojiKeyboardStyle } from '../shared/views/CometChatEmojiKeyboard';
|
|
24
|
+
import { CometChatMessageInformationConfigurationInterface } from '../CometChatMessageInformation/MessageInformationConfiguration';
|
|
24
25
|
|
|
25
26
|
export interface MessageListConfigurationInterface {
|
|
26
27
|
ErrorStateView?: (e: CometChat.CometChatException) => JSX.Element;
|
|
@@ -91,6 +92,11 @@ export interface MessageListConfigurationInterface {
|
|
|
91
92
|
/**
|
|
92
93
|
* Hides the header of the action sheet
|
|
93
94
|
*/
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated
|
|
97
|
+
*
|
|
98
|
+
* This property is deprecated as of version 4.3.20, as it is no longer needed. It will be removed in subsequent versions.
|
|
99
|
+
*/
|
|
94
100
|
hideActionSheetHeader?: boolean;
|
|
95
101
|
/**
|
|
96
102
|
* Message Reaction Configuration @ReactionsConfigurationInterface
|
|
@@ -118,6 +124,11 @@ export interface MessageListConfigurationInterface {
|
|
|
118
124
|
* @type {Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>}
|
|
119
125
|
*/
|
|
120
126
|
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Message Information Configuration @CometChatMessageInformationConfigurationInterface
|
|
130
|
+
*/
|
|
131
|
+
messageInformationConfiguration?: CometChatMessageInformationConfigurationInterface;
|
|
121
132
|
}
|
|
122
133
|
export class MessageListConfiguration
|
|
123
134
|
implements MessageListConfigurationInterface {
|
|
@@ -189,6 +200,11 @@ export class MessageListConfiguration
|
|
|
189
200
|
/**
|
|
190
201
|
* Hides the header of the action sheet
|
|
191
202
|
*/
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated
|
|
205
|
+
*
|
|
206
|
+
* This property is deprecated as of version 4.3.20, as it is no longer needed. It will be removed in subsequent versions.
|
|
207
|
+
*/
|
|
192
208
|
hideActionSheetHeader?: boolean;
|
|
193
209
|
/**
|
|
194
210
|
* Message Reaction Configuration @ReactionsConfigurationInterface
|
|
@@ -218,6 +234,11 @@ export class MessageListConfiguration
|
|
|
218
234
|
*/
|
|
219
235
|
textFormatters?: Array<CometChatMentionsFormatter | CometChatUrlsFormatter | CometChatTextFormatter>;
|
|
220
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Message Information Configuration @CometChatMessageInformationConfigurationInterface
|
|
239
|
+
*/
|
|
240
|
+
messageInformationConfiguration?: CometChatMessageInformationConfigurationInterface;
|
|
241
|
+
|
|
221
242
|
constructor(props: MessageListConfigurationInterface) {
|
|
222
243
|
if (props) {
|
|
223
244
|
for (const [key, value] of Object.entries(props)) {
|
|
@@ -27,7 +27,7 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
27
27
|
keepAlive = false,
|
|
28
28
|
tabAlignment = "bottom",
|
|
29
29
|
} = props;
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
const { theme } = React.useContext(CometChatContext);
|
|
32
32
|
|
|
33
33
|
const [views, setViews] = useState<Array<ViewType>>([]);
|
|
@@ -45,7 +45,7 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
45
45
|
},[props.tabs]);
|
|
46
46
|
|
|
47
47
|
useEffect(() => {
|
|
48
|
-
|
|
48
|
+
loadActiveTab();
|
|
49
49
|
}, [])
|
|
50
50
|
|
|
51
51
|
const getStyleFor = (tab: TabItem) => {
|
|
@@ -67,8 +67,8 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
67
67
|
titleTextColor: style?.tabTitleTextColor || theme?.palette.getAccent(),
|
|
68
68
|
titleTextFont: style?.tabTitleTextFont || theme?.typography.body,
|
|
69
69
|
activeIconTint: theme?.palette.getPrimary(),
|
|
70
|
-
activeTitleTextColor: style?.activeTabTitleTextColor || theme?.palette.
|
|
71
|
-
activeBackgroundColor: style?.activeTabBackgroundColor || theme?.palette.
|
|
70
|
+
activeTitleTextColor: style?.activeTabTitleTextColor || theme?.palette.getSecondary(),
|
|
71
|
+
activeBackgroundColor: style?.activeTabBackgroundColor || theme?.palette.getPrimary(),
|
|
72
72
|
iconTint: theme?.palette.getAccent600(),
|
|
73
73
|
activeTitleTextFont: theme?.typography.body,
|
|
74
74
|
borderRadius: style?.borderRadius,
|
|
@@ -80,7 +80,7 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
80
80
|
width: tabs.length <= 4 ? (screenWidth - 30) / tabs.length : width,
|
|
81
81
|
border: tab.isActive ? style?.activeTabBorder : undefined,
|
|
82
82
|
borderRadius: style?.borderRadius,
|
|
83
|
-
backgroundColor: tab.isActive ? activeBackgroundColor :
|
|
83
|
+
backgroundColor: tab.isActive ? activeBackgroundColor : "transparent",
|
|
84
84
|
tintColor: tab.isActive ? activeIconTint : iconTint,
|
|
85
85
|
color: tab.isActive ? activeTitleTextColor : titleTextColor,
|
|
86
86
|
titleFont: tab.isActive ? activeTitleTextFont : titleTextFont,
|
|
@@ -126,9 +126,9 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
126
126
|
setTabs(newTabState);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
const TabItemView = ({ item }) => {
|
|
129
|
+
const TabItemView = ({ item }: {item: any}) => {
|
|
130
130
|
let style = getStyleFor(item);
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
return (
|
|
133
133
|
<TouchableOpacity
|
|
134
134
|
style={[style, { justifyContent: "center", alignItems: "center" }] as ViewProps}
|
|
@@ -146,7 +146,7 @@ export const CometChatTabs = (props: CometChatTabsInterface) => {
|
|
|
146
146
|
|
|
147
147
|
const TabsList = () => {
|
|
148
148
|
return (
|
|
149
|
-
<View style={{flexDirection: 'row', backgroundColor: style
|
|
149
|
+
<View style={{flexDirection: 'row', backgroundColor: style?.backgroundColor, borderRadius: style?.borderRadius, margin: 15, marginTop: 0}}>
|
|
150
150
|
{ tabs.map(item=> <TabItemView item={item}/>) }
|
|
151
151
|
</View>
|
|
152
152
|
)
|
|
@@ -257,7 +257,7 @@ export const CometChatThreadedMessages = (
|
|
|
257
257
|
titleStyle={({
|
|
258
258
|
...theme.typography.heading,
|
|
259
259
|
color: theme.palette.getAccent(),
|
|
260
|
-
...threadedMessagesStyle
|
|
260
|
+
...threadedMessagesStyle?.titleStyle
|
|
261
261
|
}) as TextStyle
|
|
262
262
|
}
|
|
263
263
|
closeIconTint={
|
|
@@ -304,6 +304,7 @@ export const CometChatThreadedMessages = (
|
|
|
304
304
|
user={user}
|
|
305
305
|
group={group}
|
|
306
306
|
onError={onError && onError}
|
|
307
|
+
hideActionSheetHeader={true}
|
|
307
308
|
{...(messageListConfiguration ? messageListConfiguration : {})}
|
|
308
309
|
/>
|
|
309
310
|
)}
|
|
@@ -4,12 +4,16 @@ import React, { useRef, useEffect, useImperativeHandle } from 'react';
|
|
|
4
4
|
//@ts-ignore
|
|
5
5
|
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
6
6
|
import {
|
|
7
|
+
BorderStyle,
|
|
8
|
+
CometChatContext,
|
|
9
|
+
CometChatContextType,
|
|
7
10
|
CometChatList,
|
|
8
11
|
CometChatListActionsInterface,
|
|
9
12
|
CometChatListProps,
|
|
10
13
|
CometChatListStylesInterface,
|
|
11
14
|
CometChatOptions,
|
|
12
15
|
} from '../shared';
|
|
16
|
+
import {UsersStyle, UsersStyleInterface} from './UsersStyle'
|
|
13
17
|
import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
|
|
14
18
|
|
|
15
19
|
export interface CometChatUsersInterface
|
|
@@ -61,10 +65,10 @@ export interface CometChatUsersInterface
|
|
|
61
65
|
usersRequestBuilder?: CometChat.UsersRequestBuilder;
|
|
62
66
|
/**
|
|
63
67
|
*
|
|
64
|
-
* @type {
|
|
68
|
+
* @type {UsersStyleInterface}
|
|
65
69
|
* pass custom styling for user
|
|
66
70
|
*/
|
|
67
|
-
usersStyle?:
|
|
71
|
+
usersStyle?: UsersStyleInterface;
|
|
68
72
|
/**
|
|
69
73
|
*
|
|
70
74
|
* Function which have user object as prop and takes a to render in place of subtitle view in list item
|
|
@@ -103,18 +107,43 @@ export const CometChatUsers = React.forwardRef<
|
|
|
103
107
|
const ccUserUnBlockedId = 'ccUserBlocked_' + new Date().getTime();
|
|
104
108
|
|
|
105
109
|
const { usersRequestBuilder, usersStyle, ...newProps } = props;
|
|
110
|
+
|
|
111
|
+
//context values
|
|
112
|
+
const { theme } = React.useContext<CometChatContextType>(CometChatContext);
|
|
113
|
+
|
|
106
114
|
const userRef = useRef<CometChatUsersActionsInterface>(null);
|
|
115
|
+
|
|
116
|
+
const _usersStyle = new UsersStyle({
|
|
117
|
+
backgroundColor: theme?.palette.getBackgroundColor(),
|
|
118
|
+
backIconTint: theme?.palette.getPrimary(),
|
|
119
|
+
emptyTextColor: theme?.palette.getAccent400(),
|
|
120
|
+
emptyTextFont: theme?.typography.caption2,
|
|
121
|
+
errorTextColor: theme?.palette.getError(),
|
|
122
|
+
errorTextFont: theme?.typography.subtitle1,
|
|
123
|
+
searchBackgroundColor: theme?.palette.getAccent600(),
|
|
124
|
+
searchBorder: new BorderStyle({
|
|
125
|
+
borderColor: theme?.palette.getAccent700(),
|
|
126
|
+
...usersStyle?.border,
|
|
127
|
+
}),
|
|
128
|
+
separatorColor: theme?.palette.getAccent100(),
|
|
129
|
+
subtitleTextColor: theme?.palette.getAccent600(),
|
|
130
|
+
subtitleTextFont: theme?.typography.text1,
|
|
131
|
+
titleColor: theme?.palette.getAccent(),
|
|
132
|
+
titleFont: theme?.typography.title1,
|
|
133
|
+
loadingIconTint: theme?.palette.getPrimary(),
|
|
134
|
+
...usersStyle
|
|
135
|
+
});
|
|
107
136
|
|
|
108
137
|
useImperativeHandle(ref, () => {
|
|
109
138
|
return {
|
|
110
|
-
updateList: userRef.current
|
|
111
|
-
addItemToList: userRef.current
|
|
112
|
-
removeItemFromList: userRef.current
|
|
113
|
-
getListItem: userRef.current
|
|
114
|
-
updateAndMoveToFirst: userRef.current
|
|
115
|
-
getSelectedItems: userRef.current
|
|
116
|
-
getAllListItems: userRef.current
|
|
117
|
-
clearSelection: userRef.current
|
|
139
|
+
updateList: userRef.current!.updateList,
|
|
140
|
+
addItemToList: userRef.current!.addItemToList,
|
|
141
|
+
removeItemFromList: userRef.current!.removeItemFromList,
|
|
142
|
+
getListItem: userRef.current!.getListItem,
|
|
143
|
+
updateAndMoveToFirst: userRef.current!.updateAndMoveToFirst,
|
|
144
|
+
getSelectedItems: userRef.current!.getSelectedItems,
|
|
145
|
+
getAllListItems: userRef.current!.getAllListItems,
|
|
146
|
+
clearSelection: userRef.current!.clearSelection
|
|
118
147
|
};
|
|
119
148
|
});
|
|
120
149
|
|
|
@@ -166,7 +195,7 @@ export const CometChatUsers = React.forwardRef<
|
|
|
166
195
|
ref={userRef}
|
|
167
196
|
title={'Users'}
|
|
168
197
|
requestBuilder={usersRequestBuilder}
|
|
169
|
-
listStyle={
|
|
198
|
+
listStyle={{ ..._usersStyle, background: _usersStyle.backgroundColor }}
|
|
170
199
|
{...newProps as CometChatListProps}
|
|
171
200
|
listItemKey="uid"
|
|
172
201
|
/>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ListRenderItem, StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
import {
|
|
3
3
|
AvatarStyleInterface,
|
|
4
|
-
CometChatListStylesInterface,
|
|
5
4
|
CometChatOptions,
|
|
6
5
|
ImageType,
|
|
7
6
|
ListItemStyleInterface,
|
|
@@ -10,6 +9,7 @@ import { StatusIndicatorStyleInterface } from '../shared/views/CometChatStatusIn
|
|
|
10
9
|
import { CometChatUsersInterface } from './CometChatUsers';
|
|
11
10
|
//@ts-ignore
|
|
12
11
|
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
12
|
+
import { UsersStyleInterface } from './UsersStyle'
|
|
13
13
|
|
|
14
14
|
export interface UsersConfigurationInterface
|
|
15
15
|
extends Omit<
|
|
@@ -48,7 +48,7 @@ export class UsersConfiguration {
|
|
|
48
48
|
TailView?: (item: CometChat.User) => JSX.Element;
|
|
49
49
|
tailViewContainerStyle?: StyleProp<ViewStyle>;
|
|
50
50
|
usersRequestBuilder?: CometChat.UsersRequestBuilder;
|
|
51
|
-
usersStyle?:
|
|
51
|
+
usersStyle?: UsersStyleInterface;
|
|
52
52
|
constructor(props: UsersConfigurationInterface) {
|
|
53
53
|
if (props)
|
|
54
54
|
for (const [key, value] of Object.entries(props)) {
|