@cometchat/chat-uikit-react-native 5.0.0-beta.1 → 5.0.0
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/README.md +2 -3
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometChatSoundModule.java +29 -44
- package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +12 -0
- package/ios/FileManager.m +26 -9
- package/package.json +11 -36
- package/src/CometChatConversations/CometChatConversations.tsx +287 -147
- package/src/CometChatConversations/Skeleton.tsx +116 -73
- package/src/CometChatConversations/style.ts +17 -22
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +439 -227
- package/src/CometChatGroupMembers/style.ts +2 -4
- package/src/CometChatGroups/CometChatGroups.tsx +239 -135
- package/src/CometChatGroups/GroupsStyle.ts +20 -17
- package/src/CometChatGroups/Skeleton.tsx +198 -288
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +208 -73
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +97 -43
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +4 -2
- package/src/CometChatMessageList/CometChatMessageList.tsx +200 -76
- package/src/CometChatMessageList/style.ts +4 -4
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +77 -11
- package/src/CometChatThreadHeader/style.ts +2 -2
- package/src/CometChatUsers/CometChatUsers.tsx +203 -51
- package/src/CometChatUsers/Skeleton.tsx +174 -159
- package/src/CometChatUsers/style.ts +21 -18
- package/src/calls/CallingConfiguration.ts +4 -3
- package/src/calls/CallingExtensionDecorator.tsx +5 -3
- package/src/calls/CometChatCallButtons/CometChatCallButtonConfiguration.ts +4 -2
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +10 -8
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +240 -97
- package/src/calls/CometChatCallLogs/Skeleton.tsx +175 -91
- package/src/calls/CometChatCallLogs/index.ts +1 -0
- package/src/calls/CometChatCallLogs/style.ts +85 -43
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +42 -29
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +36 -10
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +39 -12
- package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +5 -4
- package/src/extensions/Polls/PollsDecorator.tsx +30 -9
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +34 -16
- package/src/index.ts +3 -1
- package/src/shared/base/Types.ts +31 -1
- package/src/shared/framework/DataSource.ts +64 -20
- package/src/shared/framework/DataSourceDecorator.tsx +46 -37
- package/src/shared/framework/MessageDataSource.tsx +518 -316
- package/src/shared/index.ts +3 -1
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +3 -2
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +3 -2
- package/src/shared/utils/MessageUtils.tsx +41 -20
- package/src/shared/utils/conversationUtils.ts +2 -2
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +22 -1
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +20 -8
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +177 -123
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +76 -10
- package/src/shared/views/CometChatConfirmDialog/style.ts +2 -2
- package/src/shared/views/CometChatDate/CometChatDate.tsx +26 -18
- package/src/shared/views/CometChatDateSeperator/CometChatDateSeparator.tsx +22 -16
- package/src/shared/views/CometChatDeletedBubble/CometChatDeletedBubble.tsx +17 -5
- package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +65 -35
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +22 -11
- package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +47 -18
- package/src/shared/views/CometChatList/CometChatList.tsx +70 -46
- package/src/shared/views/CometChatList/Header.tsx +122 -37
- package/src/shared/views/CometChatList/styles.ts +1 -0
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +116 -30
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +52 -30
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +36 -22
- package/src/shared/views/CometChatQuickReactions/CometChatQuickReactions.tsx +41 -13
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +132 -17
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +30 -2
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +10 -6
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +20 -13
- package/src/shared/views/CometChatStatusIndicator/styles.ts +26 -13
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +25 -2
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +94 -14
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +52 -16
- package/src/shared/views/CometChatTooltipMenu/index.ts +2 -1
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +29 -9
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +20 -2
- package/src/shared/views/ErrorEmptyView/ErrorEmptyView.tsx +29 -14
- package/src/shared/views/index.ts +2 -0
- package/src/theme/default/index.ts +5 -5
- package/src/theme/type.ts +2 -2
- package/src/shared/views/CometChatPanel/CometChatPanel.tsx +0 -57
- package/src/shared/views/CometChatPanel/PanelStyle.tsx +0 -43
- package/src/shared/views/CometChatPanel/resources/CloseIcon.png +0 -0
- package/src/shared/views/CometChatPanel/resources/index.ts +0 -3
|
@@ -18,7 +18,7 @@ export const getThreadHeaderStyleLight = (
|
|
|
18
18
|
marginVertical: spacing.padding.p4,
|
|
19
19
|
paddingHorizontal: spacing.padding.p4,
|
|
20
20
|
},
|
|
21
|
-
|
|
21
|
+
replyCountBarStyle: {
|
|
22
22
|
paddingVertical: spacing.padding.p1,
|
|
23
23
|
paddingHorizontal: spacing.padding.p5,
|
|
24
24
|
backgroundColor: color.extendedPrimary100,
|
|
@@ -51,7 +51,7 @@ export const getThreadHeaderStyleDark = (
|
|
|
51
51
|
marginVertical: spacing.padding.p4,
|
|
52
52
|
paddingHorizontal: spacing.padding.p4,
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
replyCountBarStyle: {
|
|
55
55
|
paddingVertical: spacing.padding.p1,
|
|
56
56
|
paddingHorizontal: spacing.padding.p5,
|
|
57
57
|
backgroundColor: color.extendedPrimary100,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ColorValue, KeyboardAvoidingView, Platform, View } from "react-native";
|
|
4
4
|
import {
|
|
5
5
|
CometChatList,
|
|
6
6
|
CometChatListActionsInterface,
|
|
@@ -14,26 +14,41 @@ import { Icon } from "../shared/icons/Icon";
|
|
|
14
14
|
import { CometChatStatusIndicatorInterface } from "../shared/views/CometChatStatusIndicator";
|
|
15
15
|
import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
|
|
16
16
|
import { useTheme } from "../theme";
|
|
17
|
-
import dark from "../theme/default/resources/icons/dark_error_icon.png";
|
|
18
|
-
import light from "../theme/default/resources/icons/light_error_icon.png";
|
|
19
|
-
import { useThemeInternal } from "../theme/hook";
|
|
20
17
|
import { Skeleton } from "./Skeleton";
|
|
21
18
|
import { UserStyle } from "./style";
|
|
22
19
|
import { CommonUtils } from "../shared/utils/CommonUtils";
|
|
20
|
+
import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Interface for the menu items (tooltip actions).
|
|
24
|
+
*/
|
|
25
|
+
export interface MenuItemInterface {
|
|
26
|
+
text: string;
|
|
27
|
+
onPress: () => void;
|
|
28
|
+
textColor?: ColorValue;
|
|
29
|
+
iconColor?: ColorValue;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
23
32
|
|
|
24
33
|
/**
|
|
25
34
|
* Interface for the props accepted by the CometChatUsers component.
|
|
26
|
-
*
|
|
27
35
|
* @interface CometChatUsersInterface
|
|
28
|
-
* @extends {Omit<CometChatListProps, "title" | "requestBuilder" | "listStyle" | "SubtitleView" | "TailView" | "disableUsersPresence" | "ItemView" | "onItemPress" | "onItemLongPress" | "listItemKey" | "onSelection" | "statusIndicatorType" | "emptyStateText" | "errorStateText">}
|
|
29
36
|
*/
|
|
37
|
+
|
|
30
38
|
export interface CometChatUsersInterface
|
|
31
39
|
extends Omit<
|
|
32
40
|
CometChatListProps,
|
|
33
41
|
| "title"
|
|
34
42
|
| "requestBuilder"
|
|
35
43
|
| "listStyle"
|
|
44
|
+
| "TitleView"
|
|
36
45
|
| "SubtitleView"
|
|
46
|
+
| "statusIndicatorStyle"
|
|
47
|
+
| "avatarStyle"
|
|
48
|
+
| "hideBackButton"
|
|
49
|
+
| "onListFetched"
|
|
50
|
+
| "listItemStyle"
|
|
51
|
+
| "ListItemView"
|
|
37
52
|
| "TailView"
|
|
38
53
|
| "disableUsersPresence"
|
|
39
54
|
| "ItemView"
|
|
@@ -44,6 +59,7 @@ export interface CometChatUsersInterface
|
|
|
44
59
|
| "statusIndicatorType"
|
|
45
60
|
| "emptyStateText"
|
|
46
61
|
| "errorStateText"
|
|
62
|
+
| "hideStickyHeader"
|
|
47
63
|
> {
|
|
48
64
|
/**
|
|
49
65
|
* Callback function when a list item (user) is pressed.
|
|
@@ -63,6 +79,10 @@ export interface CometChatUsersInterface
|
|
|
63
79
|
* @param {CometChat.User[]} list - The array of selected user objects.
|
|
64
80
|
*/
|
|
65
81
|
onSelection?: (list: CometChat.User[]) => void;
|
|
82
|
+
/**
|
|
83
|
+
* Callback when submit selection button is pressed.
|
|
84
|
+
*/
|
|
85
|
+
onSubmit?: (list: Array<CometChat.User>) => void;
|
|
66
86
|
/**
|
|
67
87
|
* Users request builder instance to customize the user request.
|
|
68
88
|
*
|
|
@@ -140,6 +160,54 @@ export interface CometChatUsersInterface
|
|
|
140
160
|
* @type {string}
|
|
141
161
|
*/
|
|
142
162
|
searchPlaceholderText?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Hide the users Status.
|
|
165
|
+
*/
|
|
166
|
+
usersStatusVisibility?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Search Keyword.
|
|
169
|
+
*/
|
|
170
|
+
searchKeyword?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Callback when an error occurs.
|
|
173
|
+
*/
|
|
174
|
+
onError?: (e: CometChat.CometChatException) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Callback triggered when the fetched list is empty.
|
|
177
|
+
*/
|
|
178
|
+
onEmpty?: () => void;
|
|
179
|
+
/**
|
|
180
|
+
* Callback triggered once the users have loaded and are not empty.
|
|
181
|
+
*/
|
|
182
|
+
onLoad?: (list: CometChat.User[]) => void;
|
|
183
|
+
/**
|
|
184
|
+
* Hide the loading skeleton.
|
|
185
|
+
*/
|
|
186
|
+
hideLoadingState?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* Title for the header.
|
|
189
|
+
*/
|
|
190
|
+
title?: string;
|
|
191
|
+
/**
|
|
192
|
+
* A function to **append** more menu items on top of the default menu items for a users.
|
|
193
|
+
*/
|
|
194
|
+
addOptions?: (user: CometChat.User) => MenuItemInterface[];
|
|
195
|
+
/**
|
|
196
|
+
* A function to **replace** the default menu items entirely for a users.
|
|
197
|
+
*/
|
|
198
|
+
options?: (user: CometChat.User) => MenuItemInterface[];
|
|
199
|
+
/**
|
|
200
|
+
* Toggle error view visibility.
|
|
201
|
+
*/
|
|
202
|
+
hideError?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Toggle back button visibility.
|
|
205
|
+
*/
|
|
206
|
+
showBackButton?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Toggle Sticky Header visibility.
|
|
209
|
+
*/
|
|
210
|
+
stickyHeaderVisibility?: boolean;
|
|
143
211
|
}
|
|
144
212
|
|
|
145
213
|
/**
|
|
@@ -153,10 +221,6 @@ export interface CometChatUsersActionsInterface extends CometChatListActionsInte
|
|
|
153
221
|
/**
|
|
154
222
|
* CometChatUsers component renders a list of users with support for search,
|
|
155
223
|
* selection, and custom empty/error/loading states.
|
|
156
|
-
*
|
|
157
|
-
* @param {CometChatUsersInterface} props - Props passed to the component.
|
|
158
|
-
* @param {React.Ref<CometChatUsersActionsInterface>} ref - Forwarded ref for component actions.
|
|
159
|
-
* @returns {JSX.Element} The rendered users list.
|
|
160
224
|
*/
|
|
161
225
|
export const CometChatUsers = React.forwardRef<
|
|
162
226
|
CometChatUsersActionsInterface,
|
|
@@ -164,56 +228,81 @@ export const CometChatUsers = React.forwardRef<
|
|
|
164
228
|
>((props, ref) => {
|
|
165
229
|
const userListenerId = "userStatus_" + new Date().getTime();
|
|
166
230
|
const theme = useTheme();
|
|
167
|
-
const { mode } = useThemeInternal();
|
|
168
231
|
const [hideSearchError, setHideSearchError] = useState(false);
|
|
169
232
|
|
|
170
233
|
const {
|
|
171
|
-
usersRequestBuilder
|
|
172
|
-
.setLimit(30)
|
|
173
|
-
.hideBlockedUsers(false)
|
|
174
|
-
.setRoles([])
|
|
175
|
-
.friendsOnly(false)
|
|
176
|
-
.setStatus("")
|
|
177
|
-
.setTags([])
|
|
178
|
-
.setUIDs([]),
|
|
179
|
-
style = {},
|
|
234
|
+
usersRequestBuilder,
|
|
180
235
|
LoadingView,
|
|
181
236
|
ErrorView,
|
|
182
237
|
EmptyView,
|
|
183
|
-
selectionMode,
|
|
238
|
+
selectionMode = "none",
|
|
239
|
+
title,
|
|
240
|
+
addOptions,
|
|
241
|
+
options,
|
|
242
|
+
TrailingView,
|
|
243
|
+
LeadingView,
|
|
184
244
|
AppBarOptions,
|
|
185
245
|
hideSearch = false,
|
|
246
|
+
stickyHeaderVisibility = true,
|
|
247
|
+
style = {},
|
|
248
|
+
onError,
|
|
249
|
+
onLoad,
|
|
250
|
+
onEmpty,
|
|
251
|
+
hideError,
|
|
252
|
+
hideLoadingState,
|
|
253
|
+
usersStatusVisibility = true,
|
|
254
|
+
showBackButton = false,
|
|
255
|
+
searchKeyword = "",
|
|
186
256
|
searchRequestBuilder,
|
|
187
257
|
hideHeader,
|
|
188
258
|
onSelection,
|
|
259
|
+
onSubmit,
|
|
189
260
|
searchPlaceholderText = localize("SEARCH"),
|
|
190
261
|
...newProps
|
|
191
262
|
} = props;
|
|
192
263
|
const userRef = useRef<CometChatUsersActionsInterface>(null);
|
|
193
264
|
const mergedStyle = deepMerge(theme.userStyles, style);
|
|
194
265
|
|
|
195
|
-
|
|
266
|
+
// ----- Tooltip functionality for users -----
|
|
267
|
+
const [tooltipVisible, setTooltipVisible] = useState(false);
|
|
268
|
+
const [selectedUser, setSelectedUser] = useState<CometChat.User | null>(null);
|
|
269
|
+
const tooltipPosition = useRef({ pageX: 0, pageY: 0 });
|
|
270
|
+
|
|
271
|
+
const buildMenuItems = (user: CometChat.User): MenuItemInterface[] => {
|
|
272
|
+
if (options) return options(user);
|
|
273
|
+
if (addOptions) return addOptions(user);
|
|
274
|
+
return [];
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const handleItemLongPress = (user: CometChat.User, e?: any) => {
|
|
278
|
+
if (props.onItemLongPress) {
|
|
279
|
+
props.onItemLongPress(user);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
const items = buildMenuItems(user);
|
|
283
|
+
if (items.length === 0) return;
|
|
284
|
+
if (e && e.nativeEvent) {
|
|
285
|
+
tooltipPosition.current = {
|
|
286
|
+
pageX: e.nativeEvent.pageX,
|
|
287
|
+
pageY: e.nativeEvent.pageY,
|
|
288
|
+
};
|
|
289
|
+
} else {
|
|
290
|
+
tooltipPosition.current = { pageX: 200, pageY: 100 };
|
|
291
|
+
}
|
|
292
|
+
setSelectedUser(user);
|
|
293
|
+
setTooltipVisible(true);
|
|
294
|
+
};
|
|
196
295
|
|
|
197
296
|
useEffect(() => {
|
|
198
297
|
// Listen for changes in user online/offline status.
|
|
199
298
|
CometChat.addUserListener(
|
|
200
299
|
userListenerId,
|
|
201
300
|
new CometChat.UserListener({
|
|
202
|
-
/**
|
|
203
|
-
* Callback when a user comes online.
|
|
204
|
-
*
|
|
205
|
-
* @param {CometChat.User} onlineUser - The user who is online.
|
|
206
|
-
*/
|
|
207
301
|
onUserOnline: (onlineUser: CometChat.User) => {
|
|
208
302
|
if (!onlineUser.getBlockedByMe()) {
|
|
209
303
|
userRef.current!.updateList(onlineUser);
|
|
210
304
|
}
|
|
211
305
|
},
|
|
212
|
-
/**
|
|
213
|
-
* Callback when a user goes offline.
|
|
214
|
-
*
|
|
215
|
-
* @param {CometChat.User} offlineUser - The user who is offline.
|
|
216
|
-
*/
|
|
217
306
|
onUserOffline: (offlineUser: CometChat.User) => {
|
|
218
307
|
if (!offlineUser.getBlockedByMe()) {
|
|
219
308
|
userRef.current!.updateList(offlineUser);
|
|
@@ -268,6 +357,9 @@ export const CometChatUsers = React.forwardRef<
|
|
|
268
357
|
* @returns {JSX.Element} The empty state view.
|
|
269
358
|
*/
|
|
270
359
|
const EmptyStateView = useCallback(() => {
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
onEmpty?.();
|
|
362
|
+
}, []);
|
|
271
363
|
return (
|
|
272
364
|
<KeyboardAvoidingView
|
|
273
365
|
keyboardVerticalOffset={Platform.OS === "ios" ? 90 : 0}
|
|
@@ -316,16 +408,15 @@ export const CometChatUsers = React.forwardRef<
|
|
|
316
408
|
<ErrorEmptyView
|
|
317
409
|
title={localize("OOPS")}
|
|
318
410
|
subTitle={localize("SOMETHING_WENT_WRONG")}
|
|
411
|
+
tertiaryTitle={localize("WRONG_TEXT_TRY_AGAIN")}
|
|
319
412
|
Icon={
|
|
320
413
|
<Icon
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
height: 120,
|
|
324
|
-
width: 120,
|
|
325
|
-
}}
|
|
414
|
+
name='error-state'
|
|
415
|
+
size={theme.spacing.margin.m15 << 1}
|
|
326
416
|
containerStyle={{
|
|
327
417
|
marginBottom: theme.spacing.margin.m5,
|
|
328
418
|
}}
|
|
419
|
+
icon={mergedStyle.errorStateStyle.icon}
|
|
329
420
|
/>
|
|
330
421
|
}
|
|
331
422
|
containerStyle={{
|
|
@@ -347,32 +438,93 @@ export const CometChatUsers = React.forwardRef<
|
|
|
347
438
|
hideHeader={hideHeader ?? hideHeader}
|
|
348
439
|
searchPlaceholderText={searchPlaceholderText}
|
|
349
440
|
searchRequestBuilder={searchRequestBuilder}
|
|
350
|
-
hideBackButton={
|
|
441
|
+
hideBackButton={!showBackButton}
|
|
442
|
+
hideError={hideError}
|
|
351
443
|
hideSubmitButton={props.hideSubmitButton}
|
|
352
444
|
AppBarOptions={AppBarOptions}
|
|
353
|
-
title={localize("USERS")}
|
|
445
|
+
title={title ? title : localize("USERS")}
|
|
446
|
+
onError={onError}
|
|
447
|
+
TrailingView={TrailingView}
|
|
354
448
|
selectionMode={selectionMode}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
449
|
+
LeadingView={LeadingView}
|
|
450
|
+
onSelection={onSelection}
|
|
451
|
+
onSubmit={onSubmit}
|
|
452
|
+
// Pass our custom long press handler which shows tooltip if options exist.
|
|
453
|
+
onItemLongPress={(user: CometChat.User, e: any) => handleItemLongPress(user, e)}
|
|
359
454
|
ItemView={props.ItemView}
|
|
455
|
+
onListFetched={(users: CometChat.User[]) => {
|
|
456
|
+
if (users.length === 0) {
|
|
457
|
+
onEmpty?.();
|
|
458
|
+
} else {
|
|
459
|
+
onLoad?.(users);
|
|
460
|
+
}
|
|
461
|
+
}}
|
|
360
462
|
ref={userRef}
|
|
361
463
|
hideSearch={hideSearch ? hideSearch : hideSearchError}
|
|
362
|
-
requestBuilder={
|
|
464
|
+
requestBuilder={
|
|
465
|
+
(usersRequestBuilder && usersRequestBuilder.setSearchKeyword(searchKeyword)) ||
|
|
466
|
+
new CometChat.UsersRequestBuilder()
|
|
467
|
+
.setLimit(30)
|
|
468
|
+
.hideBlockedUsers(false)
|
|
469
|
+
.setRoles([])
|
|
470
|
+
.friendsOnly(false)
|
|
471
|
+
.setStatus("")
|
|
472
|
+
.setTags([])
|
|
473
|
+
.setUIDs([])
|
|
474
|
+
.setSearchKeyword(searchKeyword)
|
|
475
|
+
}
|
|
363
476
|
listStyle={mergedStyle}
|
|
477
|
+
hideStickyHeader={!stickyHeaderVisibility}
|
|
364
478
|
listItemKey='uid'
|
|
365
|
-
LoadingView={
|
|
479
|
+
LoadingView={
|
|
480
|
+
hideLoadingState
|
|
481
|
+
? () => <></> // will not render anything if true
|
|
482
|
+
: LoadingView
|
|
483
|
+
? LoadingView
|
|
484
|
+
: () => <Skeleton style={mergedStyle.skeletonStyle} />
|
|
485
|
+
}
|
|
366
486
|
EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
|
|
367
487
|
ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
|
|
368
|
-
statusIndicatorType={(user: CometChat.User) =>
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
488
|
+
statusIndicatorType={(user: CometChat.User) =>
|
|
489
|
+
usersStatusVisibility
|
|
490
|
+
? user?.getBlockedByMe()
|
|
491
|
+
? "offline"
|
|
492
|
+
: (user?.getStatus() as CometChatStatusIndicatorInterface["type"])
|
|
493
|
+
: null
|
|
494
|
+
}
|
|
374
495
|
{...newProps}
|
|
375
496
|
/>
|
|
497
|
+
|
|
498
|
+
{/* Tooltip Menu: shows on long press if options exist and selectionMode is "none" */}
|
|
499
|
+
{selectedUser && selectionMode === "none" && tooltipVisible && (
|
|
500
|
+
<View
|
|
501
|
+
style={{
|
|
502
|
+
position: "absolute",
|
|
503
|
+
top: tooltipPosition.current.pageY,
|
|
504
|
+
left: tooltipPosition.current.pageX,
|
|
505
|
+
zIndex: 9999,
|
|
506
|
+
}}
|
|
507
|
+
>
|
|
508
|
+
<CometChatTooltipMenu
|
|
509
|
+
visible={tooltipVisible}
|
|
510
|
+
onClose={() => setTooltipVisible(false)}
|
|
511
|
+
onDismiss={() => setTooltipVisible(false)}
|
|
512
|
+
event={{
|
|
513
|
+
nativeEvent: tooltipPosition.current,
|
|
514
|
+
}}
|
|
515
|
+
menuItems={buildMenuItems(selectedUser).map((menuItem) => ({
|
|
516
|
+
text: menuItem.text,
|
|
517
|
+
onPress: () => {
|
|
518
|
+
menuItem.onPress();
|
|
519
|
+
setTooltipVisible(false);
|
|
520
|
+
},
|
|
521
|
+
textColor: menuItem.textColor,
|
|
522
|
+
iconColor: menuItem.iconColor,
|
|
523
|
+
disabled: menuItem.disabled,
|
|
524
|
+
}))}
|
|
525
|
+
/>
|
|
526
|
+
</View>
|
|
527
|
+
)}
|
|
376
528
|
</View>
|
|
377
529
|
);
|
|
378
530
|
});
|