@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
|
@@ -1,195 +1,210 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from "react";
|
|
1
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
2
2
|
import { Animated, Dimensions, Easing, ScrollView, StyleSheet, View } from "react-native";
|
|
3
3
|
import Svg, { Circle, Defs, LinearGradient, Rect, Stop } from "react-native-svg";
|
|
4
4
|
import { useTheme } from "../theme";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
import type { ColorValue } from "react-native";
|
|
6
|
+
import { CometChatTheme } from "../theme/type";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Animated skeleton placeholder mimicking a *user list* in CometChat UI‑Kit.
|
|
10
|
+
*
|
|
11
|
+
* The component respects the defaults provided by `theme.userStyles.skeletonStyle`,
|
|
12
|
+
* but every visual property can be **overridden per instance** using the
|
|
13
|
+
* `style` prop.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <Skeleton
|
|
18
|
+
* style={{
|
|
19
|
+
* linearGradientColors: ["#4c669f", "#3b5998"],
|
|
20
|
+
* shimmerOpacity: 0.4,
|
|
21
|
+
* }}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export interface SkeletonProps {
|
|
26
|
+
/** Partial style overrides (theme fallback for omitted keys). */
|
|
27
|
+
style?: Partial<SkeletonStyle>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Alias for the skeleton style slice inside the theme. */
|
|
31
|
+
type SkeletonStyle = CometChatTheme["userStyles"]["skeletonStyle"];
|
|
32
|
+
|
|
33
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
34
|
+
// Utility helpers
|
|
35
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
function getStyleValue<K extends keyof SkeletonStyle>(
|
|
38
|
+
key: K,
|
|
39
|
+
overrides: Partial<SkeletonStyle> | undefined,
|
|
40
|
+
theme: CometChatTheme
|
|
41
|
+
): NonNullable<SkeletonStyle[K]> {
|
|
42
|
+
// Guaranteed fallback to theme defaults; cast is safe as UI‑Kit defines them.
|
|
43
|
+
return ((overrides?.[key] as SkeletonStyle[K]) ??
|
|
44
|
+
theme.userStyles.skeletonStyle[key]) as NonNullable<SkeletonStyle[K]>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
48
|
+
// Layout constants – tweak here if the design changes
|
|
49
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
const { width: SCREEN_WIDTH } = Dimensions.get("window");
|
|
52
|
+
|
|
53
|
+
const PADDING = 20;
|
|
54
|
+
const AVATAR_RADIUS = 25;
|
|
55
|
+
const LIST_ITEM_HEIGHT = 25;
|
|
56
|
+
const LIST_ITEM_SPACING = 54; // gap between items (includes avatar & text)
|
|
57
|
+
const LIST_ITEM_COUNT = 14;
|
|
58
|
+
|
|
59
|
+
/** Total height required for the SVG canvas */
|
|
60
|
+
const TOTAL_HEIGHT = PADDING + LIST_ITEM_COUNT * (LIST_ITEM_HEIGHT + LIST_ITEM_SPACING);
|
|
61
|
+
|
|
62
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
63
|
+
// SVG rows factory (memoized for perf)
|
|
64
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
65
|
+
|
|
66
|
+
const useRows = (fill: ColorValue) =>
|
|
67
|
+
useMemo(
|
|
68
|
+
() =>
|
|
69
|
+
Array.from({ length: LIST_ITEM_COUNT }).map((_, index) => {
|
|
70
|
+
const y = PADDING + index * (LIST_ITEM_HEIGHT + LIST_ITEM_SPACING) - 20;
|
|
27
71
|
return (
|
|
72
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
28
73
|
<React.Fragment key={index}>
|
|
29
|
-
{/* Avatar Circle */}
|
|
30
74
|
<Circle
|
|
31
|
-
cx={
|
|
32
|
-
cy={
|
|
33
|
-
r={
|
|
34
|
-
fill=
|
|
75
|
+
cx={PADDING + AVATAR_RADIUS}
|
|
76
|
+
cy={y + AVATAR_RADIUS}
|
|
77
|
+
r={AVATAR_RADIUS}
|
|
78
|
+
fill={fill as string}
|
|
35
79
|
/>
|
|
36
|
-
|
|
37
|
-
{/* Username Rectangle */}
|
|
38
80
|
<Rect
|
|
39
|
-
x={
|
|
40
|
-
y={
|
|
41
|
-
width={
|
|
42
|
-
height={
|
|
43
|
-
rx={
|
|
44
|
-
fill=
|
|
81
|
+
x={PADDING + AVATAR_RADIUS * 2 + 12}
|
|
82
|
+
y={y + 12}
|
|
83
|
+
width={SCREEN_WIDTH - (PADDING + AVATAR_RADIUS * 2 + 12 + PADDING)}
|
|
84
|
+
height={LIST_ITEM_HEIGHT}
|
|
85
|
+
rx={LIST_ITEM_HEIGHT / 2}
|
|
86
|
+
fill={fill as string}
|
|
45
87
|
/>
|
|
46
88
|
</React.Fragment>
|
|
47
89
|
);
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
{/* Gradient Definition */}
|
|
51
|
-
<Defs>
|
|
52
|
-
<LinearGradient
|
|
53
|
-
id='paint0_linear'
|
|
54
|
-
x1='0'
|
|
55
|
-
y1='0'
|
|
56
|
-
x2={screenWidth}
|
|
57
|
-
y2='0'
|
|
58
|
-
gradientUnits='userSpaceOnUse'
|
|
59
|
-
>
|
|
60
|
-
<Stop stopColor={theme.userStyles.skeletonStyle.linearGradientColors[0]} />
|
|
61
|
-
<Stop offset='1' stopColor={theme.userStyles.skeletonStyle.linearGradientColors[1]} />
|
|
62
|
-
</LinearGradient>
|
|
63
|
-
</Defs>
|
|
64
|
-
</Svg>
|
|
90
|
+
}),
|
|
91
|
+
[fill]
|
|
65
92
|
);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const SkeletonItemTop = () => {
|
|
69
|
-
const theme = useTheme();
|
|
70
|
-
|
|
71
|
-
// Calculate the total height needed for the SVG
|
|
72
|
-
const totalHeight = padding + listItemCount * (listItemHeight + listItemSpacing);
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<Svg height={totalHeight} width={screenWidth} fill='none' preserveAspectRatio='xMidYMid meet'>
|
|
76
|
-
{/* List Items */}
|
|
77
|
-
{Array.from({ length: listItemCount }).map((_, index) => {
|
|
78
|
-
const itemY = padding + index * (listItemHeight + listItemSpacing) - 20;
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<React.Fragment key={index}>
|
|
82
|
-
{/* Avatar Circle */}
|
|
83
|
-
<Circle
|
|
84
|
-
cx={padding + avatarRadius}
|
|
85
|
-
cy={itemY + avatarRadius}
|
|
86
|
-
r={avatarRadius}
|
|
87
|
-
fill={theme.userStyles.skeletonStyle.backgroundColor}
|
|
88
|
-
/>
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
y={itemY + 12}
|
|
94
|
-
width={screenWidth - (padding + 2 * avatarRadius + 12 + padding)}
|
|
95
|
-
height={listItemHeight}
|
|
96
|
-
rx={listItemHeight / 2} // Rounded corners matching height
|
|
97
|
-
fill={theme.userStyles.skeletonStyle.backgroundColor}
|
|
98
|
-
/>
|
|
99
|
-
</React.Fragment>
|
|
100
|
-
);
|
|
101
|
-
})}
|
|
102
|
-
</Svg>
|
|
103
|
-
);
|
|
104
|
-
};
|
|
94
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
95
|
+
// Component Implementation
|
|
96
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
105
97
|
|
|
106
|
-
export const Skeleton = () => {
|
|
98
|
+
export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
107
99
|
const theme = useTheme();
|
|
108
|
-
const
|
|
100
|
+
const get = <K extends keyof SkeletonStyle>(key: K) => getStyleValue(key, style, theme);
|
|
101
|
+
|
|
102
|
+
// Shimmer animation ------------------------------------------
|
|
103
|
+
const translate = useRef(new Animated.Value(0)).current;
|
|
109
104
|
|
|
110
105
|
useEffect(() => {
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}, [
|
|
125
|
-
|
|
126
|
-
const
|
|
106
|
+
const speed = get("speed");
|
|
107
|
+
const duration = 1000 / speed;
|
|
108
|
+
const loop = Animated.loop(
|
|
109
|
+
Animated.timing(translate, {
|
|
110
|
+
toValue: 1,
|
|
111
|
+
duration,
|
|
112
|
+
easing: Easing.linear,
|
|
113
|
+
useNativeDriver: false, // SVG not yet compatible with native driver
|
|
114
|
+
})
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
loop.start();
|
|
118
|
+
return () => loop.stop();
|
|
119
|
+
}, [get("speed"), translate]);
|
|
120
|
+
|
|
121
|
+
const translateX = translate.interpolate({
|
|
127
122
|
inputRange: [0, 1],
|
|
128
|
-
outputRange: [-
|
|
123
|
+
outputRange: [-SCREEN_WIDTH * 2, SCREEN_WIDTH],
|
|
129
124
|
});
|
|
130
125
|
|
|
126
|
+
// Pre‑build row shapes (bottom gradient + top mask)
|
|
127
|
+
const rowsGradient = useRows("url(#gradient)");
|
|
128
|
+
const rowsSolid = useRows(String(get("backgroundColor")));
|
|
129
|
+
|
|
131
130
|
return (
|
|
132
131
|
<ScrollView
|
|
133
132
|
scrollEnabled={false}
|
|
134
133
|
showsVerticalScrollIndicator={false}
|
|
135
|
-
style={{ backgroundColor:
|
|
134
|
+
style={{ backgroundColor: get("containerBackgroundColor") }}
|
|
136
135
|
>
|
|
137
|
-
|
|
138
|
-
<
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
{ translateY: -20 },
|
|
144
|
-
{ rotate: "15deg" },
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
styles.animatedView,
|
|
148
|
-
{
|
|
149
|
-
backgroundColor: theme.userStyles.skeletonStyle.shimmerBackgroundColor,
|
|
150
|
-
opacity: theme.userStyles.skeletonStyle.shimmerOpacity,
|
|
151
|
-
},
|
|
152
|
-
]}
|
|
153
|
-
/>
|
|
154
|
-
<Animated.View
|
|
155
|
-
style={[
|
|
156
|
-
{
|
|
157
|
-
transform: [
|
|
158
|
-
{
|
|
159
|
-
translateX: Animated.add(shimmerTranslateX, screenWidth / 2),
|
|
160
|
-
},
|
|
161
|
-
{ translateY: -20 },
|
|
162
|
-
{ rotate: "15deg" },
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
styles.animatedView,
|
|
166
|
-
{
|
|
167
|
-
backgroundColor: theme.userStyles.skeletonStyle.shimmerBackgroundColor,
|
|
168
|
-
opacity: theme.userStyles.skeletonStyle.shimmerOpacity,
|
|
169
|
-
},
|
|
170
|
-
]}
|
|
171
|
-
/>
|
|
172
|
-
<View
|
|
173
|
-
style={{
|
|
174
|
-
position: "absolute",
|
|
175
|
-
top: 0,
|
|
176
|
-
left: 0,
|
|
177
|
-
right: 0,
|
|
178
|
-
bottom: 0,
|
|
179
|
-
}}
|
|
136
|
+
{/* Bottom layer (gradient fill) */}
|
|
137
|
+
<Svg
|
|
138
|
+
height={TOTAL_HEIGHT}
|
|
139
|
+
width={SCREEN_WIDTH}
|
|
140
|
+
fill='none'
|
|
141
|
+
preserveAspectRatio='xMidYMid meet'
|
|
180
142
|
>
|
|
181
|
-
<
|
|
143
|
+
<Defs>
|
|
144
|
+
<LinearGradient
|
|
145
|
+
id='gradient'
|
|
146
|
+
x1='0'
|
|
147
|
+
y1='0'
|
|
148
|
+
x2={SCREEN_WIDTH}
|
|
149
|
+
y2='0'
|
|
150
|
+
gradientUnits='userSpaceOnUse'
|
|
151
|
+
>
|
|
152
|
+
{(() => {
|
|
153
|
+
const colors = get("linearGradientColors");
|
|
154
|
+
return [
|
|
155
|
+
<Stop key={0} stopColor={colors[0]} />,
|
|
156
|
+
<Stop key={1} offset='1' stopColor={colors[1]} />,
|
|
157
|
+
];
|
|
158
|
+
})()}
|
|
159
|
+
</LinearGradient>
|
|
160
|
+
</Defs>
|
|
161
|
+
{rowsGradient}
|
|
162
|
+
</Svg>
|
|
163
|
+
|
|
164
|
+
{/* Moving shimmer highlight (rendered twice for coverage) */}
|
|
165
|
+
{[0, SCREEN_WIDTH / 2].map((offset) => (
|
|
166
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
167
|
+
<Animated.View
|
|
168
|
+
key={offset}
|
|
169
|
+
style={[
|
|
170
|
+
styles.shimmer,
|
|
171
|
+
{
|
|
172
|
+
transform: [
|
|
173
|
+
{ translateX: Animated.add(translateX, offset) },
|
|
174
|
+
{ translateY: -20 },
|
|
175
|
+
{ rotate: "15deg" },
|
|
176
|
+
],
|
|
177
|
+
backgroundColor: get("shimmerBackgroundColor"),
|
|
178
|
+
opacity: get("shimmerOpacity"),
|
|
179
|
+
},
|
|
180
|
+
]}
|
|
181
|
+
/>
|
|
182
|
+
))}
|
|
183
|
+
|
|
184
|
+
{/* Top mask – solid shapes clip the shimmer to list items */}
|
|
185
|
+
<View style={StyleSheet.absoluteFill} pointerEvents='none'>
|
|
186
|
+
<Svg
|
|
187
|
+
height={TOTAL_HEIGHT}
|
|
188
|
+
width={SCREEN_WIDTH}
|
|
189
|
+
fill='none'
|
|
190
|
+
preserveAspectRatio='xMidYMid meet'
|
|
191
|
+
>
|
|
192
|
+
{rowsSolid}
|
|
193
|
+
</Svg>
|
|
182
194
|
</View>
|
|
183
195
|
</ScrollView>
|
|
184
196
|
);
|
|
185
197
|
};
|
|
186
198
|
|
|
199
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
200
|
+
// Styles
|
|
201
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
202
|
+
|
|
187
203
|
const styles = StyleSheet.create({
|
|
188
|
-
|
|
189
|
-
|
|
204
|
+
shimmer: {
|
|
205
|
+
position: "absolute",
|
|
206
|
+
width: "25%", // thin bar for highlight
|
|
190
207
|
top: 0,
|
|
191
208
|
bottom: 0,
|
|
192
|
-
position: "absolute",
|
|
193
209
|
},
|
|
194
210
|
});
|
|
195
|
-
|
|
@@ -6,11 +6,12 @@ import { DeepPartial } from "../shared/helper/types";
|
|
|
6
6
|
|
|
7
7
|
export type UserStyle = CometChatListStylesInterface & {
|
|
8
8
|
skeletonStyle: {
|
|
9
|
-
backgroundColor
|
|
10
|
-
linearGradientColors
|
|
11
|
-
shimmerBackgroundColor
|
|
12
|
-
shimmerOpacity
|
|
13
|
-
speed
|
|
9
|
+
backgroundColor?: ColorValue;
|
|
10
|
+
linearGradientColors?: [string, string];
|
|
11
|
+
shimmerBackgroundColor?: ColorValue;
|
|
12
|
+
shimmerOpacity?: number;
|
|
13
|
+
speed?: number;
|
|
14
|
+
containerBackgroundColor?: ColorValue;
|
|
14
15
|
};
|
|
15
16
|
headerContainerStyle: ViewStyle;
|
|
16
17
|
};
|
|
@@ -63,14 +64,12 @@ export const getUserListStyleLight = (
|
|
|
63
64
|
},
|
|
64
65
|
headViewContainerStyle: {},
|
|
65
66
|
titleSubtitleContainerStyle: {
|
|
66
|
-
alignSelf:
|
|
67
|
+
alignSelf: "center",
|
|
67
68
|
},
|
|
68
69
|
trailingViewContainerStyle: {},
|
|
69
70
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
cancellationIcon: undefined,
|
|
73
|
-
cancellationIconStyle: {},
|
|
71
|
+
confirmSelectionStyle: {},
|
|
72
|
+
selectionCancelStyle: undefined,
|
|
74
73
|
loadingIconTint: color.primary,
|
|
75
74
|
sectionHeaderTextStyle: {
|
|
76
75
|
marginHorizontal: spacing.spacing.s5,
|
|
@@ -138,6 +137,13 @@ export const getUserListStyleLight = (
|
|
|
138
137
|
},
|
|
139
138
|
},
|
|
140
139
|
errorStateStyle: {
|
|
140
|
+
containerStyle: {
|
|
141
|
+
flex: 1,
|
|
142
|
+
justifyContent: "center",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
paddingHorizontal: "10%",
|
|
145
|
+
flexDirection: "column",
|
|
146
|
+
},
|
|
141
147
|
titleStyle: {
|
|
142
148
|
color: color.textPrimary,
|
|
143
149
|
...typography.heading3.bold,
|
|
@@ -145,21 +151,17 @@ export const getUserListStyleLight = (
|
|
|
145
151
|
},
|
|
146
152
|
subTitleStyle: {
|
|
147
153
|
color: color.textSecondary,
|
|
148
|
-
textAlign: "center"
|
|
154
|
+
textAlign: "center",
|
|
149
155
|
...typography.body.regular,
|
|
150
156
|
},
|
|
151
|
-
containerStyle: {
|
|
152
|
-
justifyContent: "center",
|
|
153
|
-
alignItems: "center",
|
|
154
|
-
padding: spacing.padding.p3,
|
|
155
|
-
},
|
|
156
157
|
},
|
|
157
158
|
skeletonStyle: {
|
|
158
|
-
backgroundColor:
|
|
159
|
+
backgroundColor: "transparent",
|
|
159
160
|
linearGradientColors: ["#E8E8E8", "#F5F5F5"] as [string, string],
|
|
160
161
|
shimmerBackgroundColor: color.staticBlack,
|
|
161
162
|
shimmerOpacity: 0.01,
|
|
162
163
|
speed: 1,
|
|
164
|
+
containerBackgroundColor: color.background1,
|
|
163
165
|
},
|
|
164
166
|
};
|
|
165
167
|
};
|
|
@@ -171,11 +173,12 @@ export const getUserListStyleDark = (
|
|
|
171
173
|
): DeepPartial<UserStyle> => {
|
|
172
174
|
return deepMerge(getUserListStyleLight(color, spacing, typography), {
|
|
173
175
|
skeletonStyle: {
|
|
174
|
-
backgroundColor:
|
|
176
|
+
backgroundColor: "transparent",
|
|
175
177
|
linearGradientColors: ["#383838", "#272727"] as [string, string],
|
|
176
178
|
shimmerBackgroundColor: color.staticWhite,
|
|
177
179
|
shimmerOpacity: 0.01,
|
|
178
180
|
speed: 1,
|
|
181
|
+
containerBackgroundColor: color.background1,
|
|
179
182
|
},
|
|
180
183
|
});
|
|
181
184
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import { CometChatCallButtonConfiguration } from "./CometChatCallButtons";
|
|
3
|
-
|
|
3
|
+
import { CallingPackage } from "./CallingPackage";
|
|
4
|
+
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
4
5
|
export class CallingConfiguration {
|
|
5
6
|
callButtonsConfiguration?: CometChatCallButtonConfiguration;
|
|
6
7
|
groupCallSettingsBuilder?: (
|
|
7
8
|
user?: CometChat.User,
|
|
8
9
|
group?: CometChat.Group,
|
|
9
10
|
isAudioOnly?: boolean
|
|
10
|
-
) =>
|
|
11
|
+
) => typeof CometChatCalls.CallSettingsBuilder;
|
|
11
12
|
|
|
12
13
|
constructor(params: {
|
|
13
14
|
callButtonsConfiguration?: CometChatCallButtonConfiguration;
|
|
@@ -15,7 +16,7 @@ export class CallingConfiguration {
|
|
|
15
16
|
user?: CometChat.User,
|
|
16
17
|
group?: CometChat.Group,
|
|
17
18
|
isAudioOnly?: boolean
|
|
18
|
-
) =>
|
|
19
|
+
) => typeof CometChatCalls.CallSettingsBuilder;
|
|
19
20
|
}) {
|
|
20
21
|
this.callButtonsConfiguration = params.callButtonsConfiguration;
|
|
21
22
|
this.groupCallSettingsBuilder = params.groupCallSettingsBuilder;
|
|
@@ -2,7 +2,7 @@ import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Modal, View } from "react-native";
|
|
4
4
|
import { ChatConfigurator, CometChatUIEventHandler, CometChatUIKit } from "../shared";
|
|
5
|
-
import { AdditionalParams } from "../shared/base/Types";
|
|
5
|
+
import { AdditionalAuxiliaryHeaderOptionsParams, AdditionalParams } from "../shared/base/Types";
|
|
6
6
|
import {
|
|
7
7
|
CallContstatnts,
|
|
8
8
|
MessageCategoryConstants,
|
|
@@ -333,7 +333,7 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
333
333
|
getAuxiliaryHeaderAppbarOptions(
|
|
334
334
|
user?: CometChat.User,
|
|
335
335
|
group?: CometChat.Group,
|
|
336
|
-
|
|
336
|
+
additionalAuxiliaryHeaderOptionsParams?: AdditionalAuxiliaryHeaderOptionsParams
|
|
337
337
|
) {
|
|
338
338
|
// For one-to-one chats: if a user exists and is blocked, don't render the call buttons.
|
|
339
339
|
if (user && !group && user.getBlockedByMe()) {
|
|
@@ -346,7 +346,9 @@ export class CallingExtensionDecorator extends DataSourceDecorator {
|
|
|
346
346
|
user={user}
|
|
347
347
|
group={group}
|
|
348
348
|
{...this.configuration?.callButtonsConfiguration}
|
|
349
|
-
style={
|
|
349
|
+
style={additionalAuxiliaryHeaderOptionsParams?.callButtonStyle}
|
|
350
|
+
hideVoiceCallButton={additionalAuxiliaryHeaderOptionsParams?.hideVoiceCallButton}
|
|
351
|
+
hideVideoCallButton={additionalAuxiliaryHeaderOptionsParams?.hideVideoCallButton}
|
|
350
352
|
/>
|
|
351
353
|
</View>
|
|
352
354
|
);
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
2
2
|
import { OutgoingCallConfiguration } from "../CometChatOutgoingCall";
|
|
3
|
+
import { CallingPackage } from "../CallingPackage";
|
|
4
|
+
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
3
5
|
|
|
4
6
|
export interface CometChatCallButtonConfigurationInterface {
|
|
5
7
|
callSettingsBuilder?: (
|
|
6
8
|
user?: CometChat.User,
|
|
7
9
|
group?: CometChat.Group,
|
|
8
10
|
isAudioOnly?: boolean
|
|
9
|
-
) =>
|
|
11
|
+
) => typeof CometChatCalls.CallSettingsBuilder;
|
|
10
12
|
outgoingCallConfiguration?: OutgoingCallConfiguration;
|
|
11
13
|
}
|
|
12
14
|
|
|
@@ -15,7 +17,7 @@ export class CometChatCallButtonConfiguration implements CometChatCallButtonConf
|
|
|
15
17
|
user?: CometChat.User,
|
|
16
18
|
group?: CometChat.Group,
|
|
17
19
|
isAudioOnly?: boolean
|
|
18
|
-
) =>
|
|
20
|
+
) => typeof CometChatCalls.CallSettingsBuilder;
|
|
19
21
|
|
|
20
22
|
constructor({ callSettingsBuilder }: CometChatCallButtonConfigurationInterface) {
|
|
21
23
|
this.callSettingsBuilder = callSettingsBuilder;
|
|
@@ -22,6 +22,8 @@ import { CallUIEvents } from "../CallEvents";
|
|
|
22
22
|
import { CometChatOutgoingCall, OutgoingCallConfiguration } from "../CometChatOutgoingCall";
|
|
23
23
|
import { CallButtonStyle } from "./style";
|
|
24
24
|
import { DeepPartial } from "../../shared/helper/types";
|
|
25
|
+
import { CallingPackage } from "../CallingPackage";
|
|
26
|
+
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
25
27
|
|
|
26
28
|
const listenerId = "callEventListener_" + new Date().getTime();
|
|
27
29
|
|
|
@@ -42,11 +44,11 @@ export interface CometChatCallButtonsInterface {
|
|
|
42
44
|
/**
|
|
43
45
|
* Should the voice call icon be shown.
|
|
44
46
|
*/
|
|
45
|
-
|
|
47
|
+
hideVoiceCallButton?: boolean;
|
|
46
48
|
/**
|
|
47
49
|
* Should the video call icon be shown.
|
|
48
50
|
*/
|
|
49
|
-
|
|
51
|
+
hideVideoCallButton?: boolean;
|
|
50
52
|
/**
|
|
51
53
|
* Callback to handle errors.
|
|
52
54
|
*
|
|
@@ -59,13 +61,13 @@ export interface CometChatCallButtonsInterface {
|
|
|
59
61
|
* @param {CometChat.User} [user] - The user object.
|
|
60
62
|
* @param {CometChat.Group} [group] - The group object.
|
|
61
63
|
* @param {boolean} [isAudioOnly] - Flag indicating if the call is audio only.
|
|
62
|
-
* @returns {
|
|
64
|
+
* @returns {CometChatCalls.CallSettingsBuilder} The call settings builder.
|
|
63
65
|
*/
|
|
64
66
|
callSettingsBuilder?: (
|
|
65
67
|
user?: CometChat.User,
|
|
66
68
|
group?: CometChat.Group,
|
|
67
69
|
isAudioOnly?: boolean
|
|
68
|
-
) =>
|
|
70
|
+
) => typeof CometChatCalls.CallSettingsBuilder;
|
|
69
71
|
/**
|
|
70
72
|
* Configuration for outgoing calls.
|
|
71
73
|
*/
|
|
@@ -89,8 +91,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
89
91
|
const {
|
|
90
92
|
user,
|
|
91
93
|
group,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
hideVoiceCallButton = false,
|
|
95
|
+
hideVideoCallButton = false,
|
|
94
96
|
onError,
|
|
95
97
|
callSettingsBuilder,
|
|
96
98
|
outgoingCallConfiguration,
|
|
@@ -292,7 +294,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
292
294
|
|
|
293
295
|
return (
|
|
294
296
|
<View style={callButtonStyles.containerStyle as ViewStyle}>
|
|
295
|
-
{!
|
|
297
|
+
{!hideVoiceCallButton && (
|
|
296
298
|
<TouchableOpacity onPress={() => makeVoiceCall()}>
|
|
297
299
|
<Icon
|
|
298
300
|
name='call'
|
|
@@ -305,7 +307,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
305
307
|
/>
|
|
306
308
|
</TouchableOpacity>
|
|
307
309
|
)}
|
|
308
|
-
{!
|
|
310
|
+
{!hideVideoCallButton && (
|
|
309
311
|
<TouchableOpacity onPress={() => makeVideoCall()}>
|
|
310
312
|
<Icon
|
|
311
313
|
name='videocam'
|