@cometchat/chat-uikit-react-native 4.3.20 → 4.3.22-t1
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/AI/AIConversationSummary/AIConversationSummaryView.tsx +171 -167
- package/src/AI/CardView.tsx +55 -53
- package/src/CometChatCreateGroup/CometChatCreateGroup.tsx +8 -13
- package/src/CometChatGroups/CometChatGroups.tsx +545 -514
- package/src/CometChatJoinProtectedGroup/CometChatJoinProtectedGroup.tsx +5 -8
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +544 -378
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +103 -78
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +3 -8
- package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +11 -13
- package/src/CometChatUsers/CometChatUsers.tsx +24 -23
- package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +24 -25
- package/src/extensions/Polls/Polls.tsx +8 -16
- package/src/extensions/Polls/PollsBubble.tsx +5 -10
- package/src/extensions/SmartReplies/SmartRepliesView.tsx +16 -22
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +51 -51
- package/src/shared/libs/datePickerModal/DateTimePickerModal.android.js +1 -7
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +38 -46
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +19 -19
- package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +8 -20
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -14
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +141 -140
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +47 -51
- package/src/shared/views/CometChatDate/CometChatDate.tsx +18 -17
- package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +65 -51
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +76 -72
- package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +3 -8
- package/src/shared/views/CometChatList/CometChatList.tsx +133 -134
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +65 -64
- package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +20 -10
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +3 -8
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +24 -23
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +107 -53
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +22 -14
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +15 -8
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +2 -6
- package/src/shared/views/SwipeRow/SwipeRow.tsx +6 -14
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
|
@@ -9,7 +9,13 @@ import {
|
|
|
9
9
|
ViewProps,
|
|
10
10
|
//@ts-ignore
|
|
11
11
|
} from 'react-native';
|
|
12
|
-
import React, {
|
|
12
|
+
import React, {
|
|
13
|
+
useEffect,
|
|
14
|
+
useState,
|
|
15
|
+
useRef,
|
|
16
|
+
useContext,
|
|
17
|
+
useCallback,
|
|
18
|
+
} from 'react';
|
|
13
19
|
import { AvatarStyle, CometChatContext, CometChatListItem } from '../shared';
|
|
14
20
|
import { localize } from '../shared';
|
|
15
21
|
import { ICONS } from './resources';
|
|
@@ -176,7 +182,6 @@ export interface CometChatMessageHeaderInterface {
|
|
|
176
182
|
tailViewContainerStyle?: StyleProp<ViewStyle>;
|
|
177
183
|
}
|
|
178
184
|
|
|
179
|
-
|
|
180
185
|
export const CometChatMessageHeader = (
|
|
181
186
|
props: CometChatMessageHeaderInterface
|
|
182
187
|
) => {
|
|
@@ -192,9 +197,6 @@ export const CometChatMessageHeader = (
|
|
|
192
197
|
protectedGroupIcon,
|
|
193
198
|
privateGroupIcon,
|
|
194
199
|
AppBarOptions,
|
|
195
|
-
style,
|
|
196
|
-
user,
|
|
197
|
-
group,
|
|
198
200
|
backButtonIcon,
|
|
199
201
|
hideBackIcon,
|
|
200
202
|
ListItemView,
|
|
@@ -205,25 +207,31 @@ export const CometChatMessageHeader = (
|
|
|
205
207
|
headViewContainerStyle,
|
|
206
208
|
bodyViewContainerStyle,
|
|
207
209
|
tailViewContainerStyle,
|
|
210
|
+
|
|
211
|
+
user = null,
|
|
212
|
+
group = null,
|
|
213
|
+
style = {},
|
|
208
214
|
} = props;
|
|
209
215
|
|
|
210
216
|
const _avatarStyle = new AvatarStyle({
|
|
211
217
|
backgroundColor: theme?.palette?.getAccent600(),
|
|
212
218
|
nameTextColor: theme?.palette?.getAccent(),
|
|
213
219
|
nameTextFont: theme?.typography.body,
|
|
214
|
-
...
|
|
220
|
+
...avatarStyle,
|
|
215
221
|
});
|
|
216
222
|
|
|
217
223
|
const [groupObj, setGroupObj] = useState(group);
|
|
218
|
-
const [userStatus, setUserStatus] = useState(
|
|
224
|
+
const [userStatus, setUserStatus] = useState(
|
|
225
|
+
user && user.getStatus ? user.getStatus() : ''
|
|
226
|
+
);
|
|
219
227
|
const [typingText, setTypingText] = useState('');
|
|
220
228
|
|
|
221
229
|
const receiverTypeRef = useRef(
|
|
222
230
|
user
|
|
223
231
|
? CometChat.RECEIVER_TYPE.USER
|
|
224
232
|
: group
|
|
225
|
-
|
|
226
|
-
|
|
233
|
+
? CometChat.RECEIVER_TYPE.GROUP
|
|
234
|
+
: null
|
|
227
235
|
);
|
|
228
236
|
|
|
229
237
|
useEffect(() => {
|
|
@@ -243,8 +251,8 @@ export const CometChatMessageHeader = (
|
|
|
243
251
|
? { uri: backButtonIcon }
|
|
244
252
|
: typeof backButtonIcon == 'object' ||
|
|
245
253
|
typeof backButtonIcon == 'number'
|
|
246
|
-
|
|
247
|
-
|
|
254
|
+
? backButtonIcon
|
|
255
|
+
: ICONS.BACK
|
|
248
256
|
}
|
|
249
257
|
style={[
|
|
250
258
|
styles.backButtonIconStyle,
|
|
@@ -259,13 +267,16 @@ export const CometChatMessageHeader = (
|
|
|
259
267
|
if (!disableTyping && typingText !== '')
|
|
260
268
|
return (
|
|
261
269
|
<Text
|
|
262
|
-
style={
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
270
|
+
style={
|
|
271
|
+
[
|
|
272
|
+
{
|
|
273
|
+
color:
|
|
274
|
+
style?.typingIndicatorTextColor ??
|
|
275
|
+
theme.palette.getAccent600(),
|
|
276
|
+
},
|
|
277
|
+
style?.typingIndicatorTextFont ?? theme.typography.text1,
|
|
278
|
+
] as TextStyle[]
|
|
279
|
+
}
|
|
269
280
|
>
|
|
270
281
|
{typingText}
|
|
271
282
|
</Text>
|
|
@@ -273,19 +284,21 @@ export const CometChatMessageHeader = (
|
|
|
273
284
|
if (disableUsersPresence) return null;
|
|
274
285
|
return (
|
|
275
286
|
<Text
|
|
276
|
-
style={
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
287
|
+
style={
|
|
288
|
+
[
|
|
289
|
+
{ color: style?.subtitleTextColor ?? theme.palette.getAccent600() },
|
|
290
|
+
style?.subtitleTextFont ?? theme.typography.text1,
|
|
291
|
+
] as TextStyle[]
|
|
292
|
+
}
|
|
280
293
|
>
|
|
281
294
|
{receiverTypeRef.current === CometChat.RECEIVER_TYPE.GROUP &&
|
|
282
|
-
|
|
295
|
+
(groupObj?.['membersCount'] || groupObj?.['membersCount'] === 0)
|
|
283
296
|
? `${groupObj['membersCount']} ${localize('MEMBERS')}`
|
|
284
297
|
: receiverTypeRef.current === CometChat.RECEIVER_TYPE.USER
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
298
|
+
? userStatus === UserStatusConstants.online
|
|
299
|
+
? localize('ONLINE')
|
|
300
|
+
: localize('OFFLINE')
|
|
301
|
+
: ''}
|
|
289
302
|
</Text>
|
|
290
303
|
);
|
|
291
304
|
};
|
|
@@ -315,7 +328,10 @@ export const CometChatMessageHeader = (
|
|
|
315
328
|
};
|
|
316
329
|
|
|
317
330
|
const handleGroupListener = (groupDetails: any) => {
|
|
318
|
-
if (
|
|
331
|
+
if (
|
|
332
|
+
groupDetails?.guid === groupObj?.getGuid() &&
|
|
333
|
+
groupDetails.membersCount
|
|
334
|
+
) {
|
|
319
335
|
setGroupObj(groupDetails);
|
|
320
336
|
}
|
|
321
337
|
};
|
|
@@ -390,19 +406,32 @@ export const CometChatMessageHeader = (
|
|
|
390
406
|
};
|
|
391
407
|
}, []);
|
|
392
408
|
|
|
409
|
+
const AppBarOptionsComp = useCallback(() => {
|
|
410
|
+
if (AppBarOptions) {
|
|
411
|
+
return (
|
|
412
|
+
<AppBarOptions
|
|
413
|
+
{...(user ? { user } : groupObj ? { group: groupObj } : {})}
|
|
414
|
+
/>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
return null;
|
|
418
|
+
}, [user?.getUid(), groupObj?.getGuid()]);
|
|
419
|
+
|
|
393
420
|
return (
|
|
394
421
|
<View
|
|
395
|
-
style={
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
422
|
+
style={
|
|
423
|
+
[
|
|
424
|
+
{ flexDirection: 'row' },
|
|
425
|
+
{
|
|
426
|
+
width: style?.width ?? 'auto',
|
|
427
|
+
height: style?.height ?? 'auto',
|
|
428
|
+
backgroundColor:
|
|
429
|
+
style?.backgroundColor ?? theme.palette.getBackgroundColor(),
|
|
430
|
+
borderRadius: style?.borderRadius ?? 0,
|
|
431
|
+
},
|
|
432
|
+
style?.border ?? {},
|
|
433
|
+
] as ViewProps
|
|
434
|
+
}
|
|
406
435
|
>
|
|
407
436
|
{!hideBackIcon && <BackButton />}
|
|
408
437
|
<View style={{ flex: 1 }}>
|
|
@@ -412,19 +441,31 @@ export const CometChatMessageHeader = (
|
|
|
412
441
|
<CometChatListItem
|
|
413
442
|
id={user ? user.getUid() : groupObj ? groupObj.getGuid() : ''}
|
|
414
443
|
title={user ? user.getName() : groupObj ? groupObj.getName() : ''}
|
|
415
|
-
avatarName={
|
|
416
|
-
|
|
444
|
+
avatarName={
|
|
445
|
+
user ? user.getName() : groupObj ? groupObj.getName() : ''
|
|
446
|
+
}
|
|
447
|
+
avatarURL={
|
|
448
|
+
user
|
|
449
|
+
? user.getAvatar()
|
|
450
|
+
? { uri: user.getAvatar() }
|
|
451
|
+
: undefined
|
|
452
|
+
: groupObj
|
|
453
|
+
? groupObj.getIcon()
|
|
454
|
+
? { uri: groupObj.getIcon() }
|
|
455
|
+
: undefined
|
|
456
|
+
: undefined
|
|
457
|
+
}
|
|
417
458
|
SubtitleView={
|
|
418
459
|
SubtitleView
|
|
419
460
|
? () => (
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
461
|
+
<SubtitleView
|
|
462
|
+
{...(user
|
|
463
|
+
? { user }
|
|
464
|
+
: groupObj
|
|
424
465
|
? { group: groupObj }
|
|
425
466
|
: {})}
|
|
426
|
-
|
|
427
|
-
|
|
467
|
+
/>
|
|
468
|
+
)
|
|
428
469
|
: SubtitleViewFnc
|
|
429
470
|
}
|
|
430
471
|
bodyViewContainerStyle={{
|
|
@@ -440,23 +481,23 @@ export const CometChatMessageHeader = (
|
|
|
440
481
|
disableUsersPresence
|
|
441
482
|
? 'transparent'
|
|
442
483
|
: user && userStatus === UserStatusConstants.online
|
|
443
|
-
|
|
444
|
-
|
|
484
|
+
? style?.onlineStatusColor || theme.palette.getSuccess()
|
|
485
|
+
: 'transparent'
|
|
445
486
|
}
|
|
446
487
|
statusIndicatorStyle={
|
|
447
488
|
(groupObj
|
|
448
489
|
? {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
490
|
+
height: 15,
|
|
491
|
+
width: 15,
|
|
492
|
+
backgroundColor:
|
|
493
|
+
groupObj.getType() === CometChat.GROUP_TYPE.PASSWORD
|
|
494
|
+
? PASSWORD_GROUP_COLOR // Note: Need to add this in palette
|
|
495
|
+
: groupObj.getType() === CometChat.GROUP_TYPE.PRIVATE
|
|
455
496
|
? PRIVATE_GROUP_COLOR // Note: Need to add this in palette
|
|
456
497
|
: '',
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
498
|
+
borderRadius: 15,
|
|
499
|
+
...statusIndicatorStyle,
|
|
500
|
+
}
|
|
460
501
|
: { ...statusIndicatorStyle }) as ViewProps
|
|
461
502
|
}
|
|
462
503
|
statusIndicatorIcon={
|
|
@@ -466,26 +507,16 @@ export const CometChatMessageHeader = (
|
|
|
466
507
|
? protectedGroupIcon
|
|
467
508
|
: ICONS.PROTECTED
|
|
468
509
|
: groupObj.getType() === CometChat.GROUP_TYPE.PRIVATE
|
|
510
|
+
? privateGroupIcon
|
|
469
511
|
? privateGroupIcon
|
|
470
512
|
? privateGroupIcon
|
|
471
|
-
|
|
472
|
-
: ICONS.PRIVATE
|
|
473
|
-
: null
|
|
513
|
+
: ICONS.PRIVATE
|
|
474
514
|
: null
|
|
515
|
+
: null
|
|
475
516
|
: null
|
|
476
517
|
}
|
|
477
518
|
TailView={
|
|
478
|
-
|
|
479
|
-
? () => (
|
|
480
|
-
<AppBarOptions
|
|
481
|
-
{...(user
|
|
482
|
-
? { user }
|
|
483
|
-
: groupObj
|
|
484
|
-
? { group: groupObj }
|
|
485
|
-
: {})}
|
|
486
|
-
/>
|
|
487
|
-
)
|
|
488
|
-
: null
|
|
519
|
+
AppBarOptionsComp
|
|
489
520
|
}
|
|
490
521
|
headViewContainerStyle={headViewContainerStyle}
|
|
491
522
|
tailViewContainerStyle={tailViewContainerStyle}
|
|
@@ -496,9 +527,3 @@ export const CometChatMessageHeader = (
|
|
|
496
527
|
</View>
|
|
497
528
|
);
|
|
498
529
|
};
|
|
499
|
-
|
|
500
|
-
CometChatMessageHeader.defaultProps = {
|
|
501
|
-
user: null,
|
|
502
|
-
group: null,
|
|
503
|
-
style: {},
|
|
504
|
-
};
|
|
@@ -125,7 +125,6 @@ export const CometChatThreadedMessages = (
|
|
|
125
125
|
|
|
126
126
|
const {
|
|
127
127
|
parentMessage,
|
|
128
|
-
title,
|
|
129
128
|
closeIcon,
|
|
130
129
|
BubbleView,
|
|
131
130
|
MessageActionView,
|
|
@@ -136,7 +135,8 @@ export const CometChatThreadedMessages = (
|
|
|
136
135
|
threadedMessagesStyle,
|
|
137
136
|
hideMessageComposer,
|
|
138
137
|
MessageComposerView,
|
|
139
|
-
MessageListView
|
|
138
|
+
MessageListView,
|
|
139
|
+
title= localize('THREAD'),
|
|
140
140
|
} = props;
|
|
141
141
|
|
|
142
142
|
const loggedInUser = useRef<CometChat.User | null>(null);
|
|
@@ -286,7 +286,7 @@ export const CometChatThreadedMessages = (
|
|
|
286
286
|
{
|
|
287
287
|
color: theme.palette.getAccent600(),
|
|
288
288
|
},
|
|
289
|
-
] as TextStyle}
|
|
289
|
+
] as TextStyle[]}
|
|
290
290
|
>
|
|
291
291
|
{replyCount ?? 0} {replyCount > 1 ? localize("REPLIES") : localize("REPLY")}
|
|
292
292
|
</Text>
|
|
@@ -343,8 +343,3 @@ export const CometChatThreadedMessages = (
|
|
|
343
343
|
</View>
|
|
344
344
|
);
|
|
345
345
|
};
|
|
346
|
-
CometChatThreadedMessages.defaultProps = {
|
|
347
|
-
title: localize('THREAD'),
|
|
348
|
-
threadedMessagesStyle: {},
|
|
349
|
-
parentMessage: {},
|
|
350
|
-
};
|
|
@@ -65,7 +65,7 @@ export const CometChatTransferOwnership = (
|
|
|
65
65
|
const { theme } = useContext(CometChatContext);
|
|
66
66
|
|
|
67
67
|
const {
|
|
68
|
-
title = localize(
|
|
68
|
+
title = localize('TRANSFER_OWNERSHIP'),
|
|
69
69
|
group,
|
|
70
70
|
onTransferOwnership,
|
|
71
71
|
transferOwnershipStyle,
|
|
@@ -76,7 +76,7 @@ export const CometChatTransferOwnership = (
|
|
|
76
76
|
const [loggedInUser, setLoggedInUser] = useState<CometChat.User | null>();
|
|
77
77
|
|
|
78
78
|
const transferOwnership = (members: string | any[]) => {
|
|
79
|
-
if(!members.length) return
|
|
79
|
+
if (!members.length) return;
|
|
80
80
|
let member = members[0];
|
|
81
81
|
let GUID: string = member.guid;
|
|
82
82
|
let UID: string = member.uid;
|
|
@@ -89,12 +89,15 @@ export const CometChatTransferOwnership = (
|
|
|
89
89
|
group['scope'] = GroupMemberScope.admin;
|
|
90
90
|
group['owner'] = UID;
|
|
91
91
|
onTransferOwnership && onTransferOwnership(group, member);
|
|
92
|
-
|
|
92
|
+
|
|
93
93
|
//message parameter removed
|
|
94
|
-
CometChatUIEventHandler.emitGroupEvent(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
CometChatUIEventHandler.emitGroupEvent(
|
|
95
|
+
CometChatUIEvents.ccOwnershipChanged,
|
|
96
|
+
{
|
|
97
|
+
group,
|
|
98
|
+
newOwner: member,
|
|
99
|
+
}
|
|
100
|
+
);
|
|
98
101
|
onBack && onBack();
|
|
99
102
|
},
|
|
100
103
|
(error: any) => {
|
|
@@ -123,7 +126,7 @@ export const CometChatTransferOwnership = (
|
|
|
123
126
|
TailView={(item: any) => {
|
|
124
127
|
return (
|
|
125
128
|
<View>
|
|
126
|
-
<Text style={{color: theme?.palette?.getAccent()}}>
|
|
129
|
+
<Text style={{ color: theme?.palette?.getAccent() }}>
|
|
127
130
|
{loggedInUser?.getUid() === item.owner
|
|
128
131
|
? GroupMemberScope.owner
|
|
129
132
|
: item.scope}
|
|
@@ -140,8 +143,3 @@ export const CometChatTransferOwnership = (
|
|
|
140
143
|
</View>
|
|
141
144
|
);
|
|
142
145
|
};
|
|
143
|
-
|
|
144
|
-
CometChatTransferOwnership.defaultProps = {
|
|
145
|
-
group: {},
|
|
146
|
-
title: localize("Transfer Ownership"), // Note: Update after localization is updated
|
|
147
|
-
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
CometChatListStylesInterface,
|
|
14
14
|
CometChatOptions,
|
|
15
15
|
} from '../shared';
|
|
16
|
-
import {UsersStyle, UsersStyleInterface} from './UsersStyle'
|
|
16
|
+
import { UsersStyle, UsersStyleInterface } from './UsersStyle';
|
|
17
17
|
import { CometChatUIEventHandler } from '../shared/events/CometChatUIEventHandler/CometChatUIEventHandler';
|
|
18
18
|
|
|
19
19
|
export interface CometChatUsersInterface
|
|
@@ -31,8 +31,6 @@ export interface CometChatUsersInterface
|
|
|
31
31
|
| 'listItemKey'
|
|
32
32
|
| 'onSelection'
|
|
33
33
|
> {
|
|
34
|
-
|
|
35
|
-
|
|
36
34
|
/**
|
|
37
35
|
*
|
|
38
36
|
*
|
|
@@ -106,7 +104,18 @@ export const CometChatUsers = React.forwardRef<
|
|
|
106
104
|
const ccUserBlockedId = 'ccUserBlocked_' + new Date().getTime();
|
|
107
105
|
const ccUserUnBlockedId = 'ccUserBlocked_' + new Date().getTime();
|
|
108
106
|
|
|
109
|
-
const {
|
|
107
|
+
const {
|
|
108
|
+
usersRequestBuilder = new CometChat.UsersRequestBuilder()
|
|
109
|
+
.setLimit(30)
|
|
110
|
+
.hideBlockedUsers(false)
|
|
111
|
+
.setRoles([])
|
|
112
|
+
.friendsOnly(false)
|
|
113
|
+
.setStatus('')
|
|
114
|
+
.setTags([])
|
|
115
|
+
.setUIDs([]),
|
|
116
|
+
usersStyle,
|
|
117
|
+
...newProps
|
|
118
|
+
} = props;
|
|
110
119
|
|
|
111
120
|
//context values
|
|
112
121
|
const { theme } = React.useContext<CometChatContextType>(CometChatContext);
|
|
@@ -122,8 +131,8 @@ export const CometChatUsers = React.forwardRef<
|
|
|
122
131
|
errorTextFont: theme?.typography.subtitle1,
|
|
123
132
|
searchBackgroundColor: theme?.palette.getAccent600(),
|
|
124
133
|
searchBorder: new BorderStyle({
|
|
125
|
-
|
|
126
|
-
|
|
134
|
+
borderColor: theme?.palette.getAccent700(),
|
|
135
|
+
...usersStyle?.border,
|
|
127
136
|
}),
|
|
128
137
|
separatorColor: theme?.palette.getAccent100(),
|
|
129
138
|
subtitleTextColor: theme?.palette.getAccent600(),
|
|
@@ -131,9 +140,9 @@ export const CometChatUsers = React.forwardRef<
|
|
|
131
140
|
titleColor: theme?.palette.getAccent(),
|
|
132
141
|
titleFont: theme?.typography.title1,
|
|
133
142
|
loadingIconTint: theme?.palette.getPrimary(),
|
|
134
|
-
...usersStyle
|
|
135
|
-
});
|
|
136
|
-
|
|
143
|
+
...usersStyle,
|
|
144
|
+
});
|
|
145
|
+
|
|
137
146
|
useImperativeHandle(ref, () => {
|
|
138
147
|
return {
|
|
139
148
|
updateList: userRef.current!.updateList,
|
|
@@ -143,7 +152,7 @@ export const CometChatUsers = React.forwardRef<
|
|
|
143
152
|
updateAndMoveToFirst: userRef.current!.updateAndMoveToFirst,
|
|
144
153
|
getSelectedItems: userRef.current!.getSelectedItems,
|
|
145
154
|
getAllListItems: userRef.current!.getAllListItems,
|
|
146
|
-
clearSelection: userRef.current!.clearSelection
|
|
155
|
+
clearSelection: userRef.current!.clearSelection,
|
|
147
156
|
};
|
|
148
157
|
});
|
|
149
158
|
|
|
@@ -195,21 +204,13 @@ export const CometChatUsers = React.forwardRef<
|
|
|
195
204
|
ref={userRef}
|
|
196
205
|
title={'Users'}
|
|
197
206
|
requestBuilder={usersRequestBuilder}
|
|
198
|
-
listStyle={{
|
|
199
|
-
|
|
207
|
+
listStyle={{
|
|
208
|
+
..._usersStyle,
|
|
209
|
+
background: _usersStyle.backgroundColor,
|
|
210
|
+
}}
|
|
211
|
+
{...(newProps as CometChatListProps)}
|
|
200
212
|
listItemKey="uid"
|
|
201
213
|
/>
|
|
202
214
|
</View>
|
|
203
215
|
);
|
|
204
216
|
});
|
|
205
|
-
|
|
206
|
-
CometChatUsers.defaultProps = {
|
|
207
|
-
usersRequestBuilder: new CometChat.UsersRequestBuilder()
|
|
208
|
-
.setLimit(30)
|
|
209
|
-
.hideBlockedUsers(false)
|
|
210
|
-
.setRoles([])
|
|
211
|
-
.friendsOnly(false)
|
|
212
|
-
.setStatus('')
|
|
213
|
-
.setTags([])
|
|
214
|
-
.setUIDs([]),
|
|
215
|
-
};
|
|
@@ -44,44 +44,53 @@ interface CollaborativeBubbleProps {
|
|
|
44
44
|
|
|
45
45
|
export const CometChatCollaborativeBubble = (props: CollaborativeBubbleProps) => {
|
|
46
46
|
|
|
47
|
+
const {
|
|
48
|
+
title= "",
|
|
49
|
+
subTitle= "",
|
|
50
|
+
buttonText= "",
|
|
51
|
+
icon= undefined,
|
|
52
|
+
style= new CollaborativeBubbleStyle({}),
|
|
53
|
+
url= undefined,
|
|
54
|
+
onPress
|
|
55
|
+
} = props;
|
|
56
|
+
|
|
47
57
|
|
|
48
58
|
const openLink = () => {
|
|
49
59
|
|
|
50
|
-
if (
|
|
51
|
-
if(
|
|
52
|
-
|
|
60
|
+
if (url != "")
|
|
61
|
+
if(onPress!=undefined){
|
|
62
|
+
onPress(url)
|
|
53
63
|
} else {
|
|
54
|
-
console.log("opening uRL , ",
|
|
55
|
-
WebView.openUrl(
|
|
64
|
+
console.log("opening uRL , ", url);
|
|
65
|
+
WebView.openUrl(url);
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
}
|
|
59
69
|
|
|
60
70
|
const getIcon = () => {
|
|
61
|
-
if (
|
|
62
|
-
if (typeof
|
|
63
|
-
return
|
|
64
|
-
if (typeof
|
|
65
|
-
return {uri:
|
|
71
|
+
if (icon) {
|
|
72
|
+
if (typeof icon == 'number')
|
|
73
|
+
return icon
|
|
74
|
+
if (typeof icon == 'string')
|
|
75
|
+
return {uri: icon}
|
|
66
76
|
}
|
|
67
77
|
return whiteboard
|
|
68
78
|
}
|
|
69
79
|
|
|
70
80
|
const getButtonText = () => {
|
|
71
|
-
if (
|
|
72
|
-
return
|
|
81
|
+
if (buttonText && buttonText.trim().length > 0) {
|
|
82
|
+
return buttonText;
|
|
73
83
|
}
|
|
74
84
|
return "";
|
|
75
85
|
}
|
|
76
86
|
|
|
77
|
-
const {style} = props;
|
|
78
87
|
|
|
79
88
|
return (
|
|
80
89
|
<View style={Styles(style).containerStyle}>
|
|
81
90
|
<View style={Styles(style).rowStyle}>
|
|
82
91
|
<View style={{ flex: 1 }}>
|
|
83
|
-
<Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).titleStyle}>{
|
|
84
|
-
<Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).subtitleStyle}>{
|
|
92
|
+
<Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).titleStyle}>{title}</Text>
|
|
93
|
+
<Text numberOfLines={2} ellipsizeMode={"tail"} style={Styles(style).subtitleStyle}>{subTitle}</Text>
|
|
85
94
|
</View>
|
|
86
95
|
<View style={Styles(style).imageContainerStyle}>
|
|
87
96
|
<Image source={getIcon()} style={Styles(style).imageStyle} />
|
|
@@ -95,13 +104,3 @@ export const CometChatCollaborativeBubble = (props: CollaborativeBubbleProps) =>
|
|
|
95
104
|
);
|
|
96
105
|
}
|
|
97
106
|
|
|
98
|
-
CometChatCollaborativeBubble.defaultProps = {
|
|
99
|
-
title: "",
|
|
100
|
-
subTitle: "",
|
|
101
|
-
buttonText: "",
|
|
102
|
-
icon: undefined,
|
|
103
|
-
whiteboardURL: "",
|
|
104
|
-
loggedInUser: undefined,
|
|
105
|
-
style: new CollaborativeBubbleStyle({}),
|
|
106
|
-
}
|
|
107
|
-
|
|
@@ -161,21 +161,21 @@ export interface CometChatCreatePollInterface {
|
|
|
161
161
|
export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
162
162
|
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
163
163
|
const {
|
|
164
|
-
title,
|
|
165
164
|
closeIcon,
|
|
166
165
|
createIcon,
|
|
167
|
-
questionPlaceholderText,
|
|
168
166
|
onError,
|
|
169
|
-
createPollsStyle,
|
|
170
167
|
user,
|
|
171
168
|
group,
|
|
172
169
|
onClose,
|
|
173
|
-
answerPlaceholderText,
|
|
174
170
|
answerHelpText,
|
|
175
171
|
addAnswerText,
|
|
176
172
|
deleteIcon,
|
|
177
173
|
createPollIcon,
|
|
178
|
-
|
|
174
|
+
title= localize('CREATE_POLL'),
|
|
175
|
+
questionPlaceholderText= localize('NAME'),
|
|
176
|
+
answerPlaceholderText= localize('ANSWER'),
|
|
177
|
+
createPollsStyle= {},
|
|
178
|
+
defaultAnswers= 2,
|
|
179
179
|
} = props;
|
|
180
180
|
|
|
181
181
|
const [question, setQuestion] = React.useState('');
|
|
@@ -256,7 +256,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
256
256
|
styles.errorTextTitle,
|
|
257
257
|
theme.typography.body,
|
|
258
258
|
{ color: theme.palette.getError() },
|
|
259
|
-
] as TextStyle}
|
|
259
|
+
] as TextStyle[]}
|
|
260
260
|
>
|
|
261
261
|
{error?.length > 0 ? error : ''}
|
|
262
262
|
</Text>
|
|
@@ -265,7 +265,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
265
265
|
styles.errorText,
|
|
266
266
|
theme.typography.body,
|
|
267
267
|
{ color: theme.palette.getError() },
|
|
268
|
-
] as TextStyle}
|
|
268
|
+
] as TextStyle[]}
|
|
269
269
|
>
|
|
270
270
|
{localize('TRY_AGAIN_LATER')}
|
|
271
271
|
</Text>
|
|
@@ -353,7 +353,7 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
353
353
|
{
|
|
354
354
|
color: theme.palette.getPrimary(),
|
|
355
355
|
},
|
|
356
|
-
] as TextStyle}
|
|
356
|
+
] as TextStyle[]}
|
|
357
357
|
>
|
|
358
358
|
{addAnswerText ?? localize('ADD_ANOTHER_ANSWER')}
|
|
359
359
|
</Text>
|
|
@@ -481,11 +481,3 @@ export const CometChatCreatePoll = (props: CometChatCreatePollInterface) => {
|
|
|
481
481
|
</KeyboardAvoidingView>
|
|
482
482
|
);
|
|
483
483
|
};
|
|
484
|
-
|
|
485
|
-
CometChatCreatePoll.defaultProps = {
|
|
486
|
-
title: 'Create Polls',
|
|
487
|
-
questionPlaceholderText: localize('NAME'),
|
|
488
|
-
answerPlaceholderText: localize('ANSWER'),
|
|
489
|
-
createPollsStyle: {},
|
|
490
|
-
defaultAnswers: 2,
|
|
491
|
-
};
|
|
@@ -190,7 +190,7 @@ export const PollsBubble = (props: PollsBubbleInterface) => {
|
|
|
190
190
|
},
|
|
191
191
|
theme.typography.subtitle1,
|
|
192
192
|
pollsBubbleStyle?.pollOptionsTextStyle,
|
|
193
|
-
] as TextStyle}
|
|
193
|
+
] as TextStyle[]}
|
|
194
194
|
>
|
|
195
195
|
{value}
|
|
196
196
|
</Text>
|
|
@@ -204,7 +204,7 @@ export const PollsBubble = (props: PollsBubbleInterface) => {
|
|
|
204
204
|
},
|
|
205
205
|
theme.typography.subtitle1,
|
|
206
206
|
pollsBubbleStyle?.pollOptionsTextStyle,
|
|
207
|
-
] as TextStyle}>
|
|
207
|
+
] as TextStyle[]}>
|
|
208
208
|
{optionsMetaData.results.options[id].count}
|
|
209
209
|
</Text>
|
|
210
210
|
</TouchableOpacity>
|
|
@@ -260,7 +260,7 @@ export const PollsBubble = (props: PollsBubbleInterface) => {
|
|
|
260
260
|
},
|
|
261
261
|
style.questionText,
|
|
262
262
|
pollsBubbleStyle?.questionTextStyle,
|
|
263
|
-
] as TextStyle}
|
|
263
|
+
] as TextStyle[]}
|
|
264
264
|
>
|
|
265
265
|
{pollQuestion}
|
|
266
266
|
</Text>
|
|
@@ -278,7 +278,7 @@ export const PollsBubble = (props: PollsBubbleInterface) => {
|
|
|
278
278
|
theme.palette.getAccent600(),
|
|
279
279
|
},
|
|
280
280
|
pollsBubbleStyle?.voteCountTextStyle,
|
|
281
|
-
] as TextStyle}
|
|
281
|
+
] as TextStyle[]}
|
|
282
282
|
>
|
|
283
283
|
{optionsMetaData.results?.total} people voted
|
|
284
284
|
</Text>
|
|
@@ -342,9 +342,4 @@ const style = StyleSheet.create({
|
|
|
342
342
|
alignItems: "center",
|
|
343
343
|
zIndex: 1,
|
|
344
344
|
}
|
|
345
|
-
});
|
|
346
|
-
PollsBubble.defaultProps = {
|
|
347
|
-
options: {},
|
|
348
|
-
loggedInUser: {},
|
|
349
|
-
pollsBubbleStyle: {},
|
|
350
|
-
};
|
|
345
|
+
});
|