@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
|
@@ -5,15 +5,35 @@ import { SuggestionItem } from "./SuggestionItem";
|
|
|
5
5
|
import { SuggestionListStyle } from "../../../theme/type";
|
|
6
6
|
import { Skeleton } from "./Skeleton";
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Props for the CometChatSuggestionList component.
|
|
10
|
+
*/
|
|
8
11
|
export interface CometChatSuggestionListInterface {
|
|
12
|
+
/**
|
|
13
|
+
* Color for the separator between suggestion items.
|
|
14
|
+
*/
|
|
9
15
|
separatorColor?: string;
|
|
10
16
|
/**
|
|
11
|
-
* Array of
|
|
17
|
+
* Array of suggestion items to be displayed.
|
|
12
18
|
*/
|
|
13
19
|
data: Array<SuggestionItem>;
|
|
20
|
+
/**
|
|
21
|
+
* Custom styles for the suggestion list.
|
|
22
|
+
*/
|
|
14
23
|
listStyle: SuggestionListStyle;
|
|
24
|
+
/**
|
|
25
|
+
* Callback function invoked when a suggestion item is pressed.
|
|
26
|
+
*
|
|
27
|
+
* @param item - The suggestion item that was pressed.
|
|
28
|
+
*/
|
|
15
29
|
onPress: (item: SuggestionItem) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Optional callback function invoked when the end of the list is reached.
|
|
32
|
+
*/
|
|
16
33
|
onEndReached?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Indicates whether the suggestion list is currently loading.
|
|
36
|
+
*/
|
|
17
37
|
loading?: boolean;
|
|
18
38
|
}
|
|
19
39
|
|
|
@@ -39,6 +59,9 @@ export const CometChatSuggestionList = (props: CometChatSuggestionListInterface)
|
|
|
39
59
|
containerStyle={listStyle?.listItemStyle.containerStyle}
|
|
40
60
|
titleStyle={listStyle?.listItemStyle.titleStyle}
|
|
41
61
|
avatarStyle={listStyle?.listItemStyle.avatarStyle}
|
|
62
|
+
titleSubtitleContainerStyle={{
|
|
63
|
+
alignSelf: "center",
|
|
64
|
+
}}
|
|
42
65
|
onPress={() => onPress(item)}
|
|
43
66
|
{...shouldLoadAvatarName}
|
|
44
67
|
/>
|
|
@@ -46,7 +69,7 @@ export const CometChatSuggestionList = (props: CometChatSuggestionListInterface)
|
|
|
46
69
|
};
|
|
47
70
|
|
|
48
71
|
return (
|
|
49
|
-
<View
|
|
72
|
+
<View>
|
|
50
73
|
{initialLoad ? (
|
|
51
74
|
<View>
|
|
52
75
|
<Skeleton />
|
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import React, { useLayoutEffect, useState } from "react";
|
|
2
|
-
import {
|
|
1
|
+
import React, { useLayoutEffect, useState, useEffect } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Platform,
|
|
4
|
+
StyleProp,
|
|
5
|
+
Text,
|
|
6
|
+
TextStyle,
|
|
7
|
+
View,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
TouchableOpacity,
|
|
10
|
+
} from "react-native";
|
|
3
11
|
import {
|
|
4
12
|
CometChatMentionsFormatter,
|
|
5
13
|
CometChatTextFormatter,
|
|
6
14
|
CometChatUrlsFormatter,
|
|
7
15
|
} from "../../formatters";
|
|
16
|
+
import { localize } from "../../resources";
|
|
8
17
|
|
|
9
18
|
export interface CometChatTextBubbleInterface {
|
|
10
19
|
/**
|
|
11
|
-
*
|
|
20
|
+
* Text to be shown
|
|
12
21
|
*/
|
|
13
22
|
text?: string;
|
|
14
23
|
textStyle?: StyleProp<TextStyle>;
|
|
15
24
|
/**
|
|
16
|
-
*
|
|
25
|
+
* Text container style
|
|
17
26
|
*/
|
|
18
27
|
textContainerStyle?: StyleProp<ViewStyle>;
|
|
19
28
|
textFormatters?: Array<
|
|
@@ -21,10 +30,8 @@ export interface CometChatTextBubbleInterface {
|
|
|
21
30
|
>;
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
//toDoM How will use theme here since we don't have alrignment here?
|
|
25
33
|
export const CometChatTextBubble = (props: CometChatTextBubbleInterface) => {
|
|
26
34
|
const { textContainerStyle } = props;
|
|
27
|
-
|
|
28
35
|
return (
|
|
29
36
|
<View style={textContainerStyle}>
|
|
30
37
|
<CometChatTextBubbleText {...props} />
|
|
@@ -36,19 +43,92 @@ export const CometChatTextBubbleText = (
|
|
|
36
43
|
props: Omit<CometChatTextBubbleInterface, "textContainerStyle">
|
|
37
44
|
) => {
|
|
38
45
|
const { text = "", textFormatters, textStyle } = props;
|
|
39
|
-
const [formattedText, setFormattedText] = useState<string>();
|
|
46
|
+
const [formattedText, setFormattedText] = useState<string>("");
|
|
47
|
+
// This flag will be set if the text exceeds 4 lines in collapsed mode.
|
|
48
|
+
const [isTruncated, setIsTruncated] = useState<boolean>(false);
|
|
49
|
+
const [expanded, setExpanded] = useState<boolean>(false);
|
|
50
|
+
// States to store measured heights for iOS fallback.
|
|
51
|
+
const [fullHeight, setFullHeight] = useState<number>(0);
|
|
52
|
+
const [collapsedHeight, setCollapsedHeight] = useState<number>(0);
|
|
40
53
|
|
|
54
|
+
// Format text if any formatters are provided.
|
|
41
55
|
useLayoutEffect(() => {
|
|
42
56
|
let finalText = text;
|
|
43
57
|
if (textFormatters && textFormatters.length) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
finalText = textFormatters[i].getFormattedText(finalText);
|
|
47
|
-
}
|
|
58
|
+
for (let i = 0; i < textFormatters.length; i++) {
|
|
59
|
+
finalText = textFormatters[i].getFormattedText(finalText);
|
|
48
60
|
}
|
|
49
61
|
}
|
|
50
|
-
setFormattedText(finalText
|
|
51
|
-
|
|
62
|
+
setFormattedText(finalText);
|
|
63
|
+
// Reset the truncated flag when text changes.
|
|
64
|
+
setIsTruncated(false);
|
|
65
|
+
}, [text, textFormatters]);
|
|
66
|
+
|
|
67
|
+
// For Android, onTextLayout reliably provides the number of lines.
|
|
68
|
+
const handleTextLayout = (event: any) => {
|
|
69
|
+
const { lines } = event.nativeEvent;
|
|
70
|
+
if (lines.length > 4) {
|
|
71
|
+
setIsTruncated(true);
|
|
72
|
+
} else {
|
|
73
|
+
setIsTruncated(false);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// onLayout callback for the collapsed text (iOS)
|
|
78
|
+
const handleCollapsedLayout = (event: any) => {
|
|
79
|
+
setCollapsedHeight(event.nativeEvent.layout.height);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// onLayout callback for the hidden full text (iOS)
|
|
83
|
+
const handleFullTextLayout = (event: any) => {
|
|
84
|
+
setFullHeight(event.nativeEvent.layout.height);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// For iOS, when not expanded, compare the hidden full height with the collapsed text height.
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (Platform.OS === "ios" && !expanded && fullHeight && collapsedHeight) {
|
|
90
|
+
setIsTruncated(fullHeight > collapsedHeight);
|
|
91
|
+
}
|
|
92
|
+
// Do not update isTruncated when expanded is true so that the toggle remains.
|
|
93
|
+
}, [fullHeight, collapsedHeight, expanded]);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<View>
|
|
97
|
+
<Text
|
|
98
|
+
key={expanded ? "expanded" : "collapsed"} // Force re-render when expanded toggles
|
|
99
|
+
style={textStyle}
|
|
100
|
+
// Android uses onTextLayout for measuring lines.
|
|
101
|
+
onTextLayout={Platform.OS !== "ios" ? handleTextLayout : undefined}
|
|
102
|
+
// iOS: only measure collapsed height when not expanded.
|
|
103
|
+
onLayout={Platform.OS === "ios" && !expanded ? handleCollapsedLayout : undefined}
|
|
104
|
+
numberOfLines={expanded ? undefined : 4}
|
|
105
|
+
ellipsizeMode="tail"
|
|
106
|
+
>
|
|
107
|
+
{formattedText}
|
|
108
|
+
</Text>
|
|
109
|
+
|
|
110
|
+
{/* Hidden full text for iOS measurement */}
|
|
111
|
+
{Platform.OS === "ios" && (
|
|
112
|
+
<Text
|
|
113
|
+
style={[textStyle, { position: "absolute", opacity: 0, zIndex: -1 }]}
|
|
114
|
+
onLayout={handleFullTextLayout}
|
|
115
|
+
>
|
|
116
|
+
{formattedText}
|
|
117
|
+
</Text>
|
|
118
|
+
)}
|
|
52
119
|
|
|
53
|
-
|
|
120
|
+
{/* Only show the toggle if the text was truncated in collapsed mode */}
|
|
121
|
+
{isTruncated && (
|
|
122
|
+
<View style={{ alignItems: "flex-end", marginTop: 8 }}>
|
|
123
|
+
<TouchableOpacity onPress={() => setExpanded(!expanded)}>
|
|
124
|
+
<Text style={textStyle}>
|
|
125
|
+
{expanded ? localize("SHOW_LESS") : localize("READ_MORE")}
|
|
126
|
+
</Text>
|
|
127
|
+
</TouchableOpacity>
|
|
128
|
+
</View>
|
|
129
|
+
)}
|
|
130
|
+
</View>
|
|
131
|
+
);
|
|
54
132
|
};
|
|
133
|
+
|
|
134
|
+
export default CometChatTextBubble;
|
|
@@ -3,38 +3,72 @@ import {
|
|
|
3
3
|
ColorValue,
|
|
4
4
|
Dimensions,
|
|
5
5
|
ImageSourcePropType,
|
|
6
|
+
ImageStyle,
|
|
6
7
|
Modal,
|
|
7
8
|
StyleSheet,
|
|
8
9
|
Text,
|
|
10
|
+
TextStyle,
|
|
9
11
|
TouchableOpacity,
|
|
10
12
|
TouchableWithoutFeedback,
|
|
11
13
|
View,
|
|
14
|
+
ViewStyle,
|
|
12
15
|
} from "react-native";
|
|
13
16
|
import { useTheme } from "../../../theme";
|
|
14
17
|
import { Icon } from "../../icons/Icon";
|
|
15
18
|
|
|
16
19
|
const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
|
|
17
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Interface for the menu items (tooltip actions).
|
|
23
|
+
*/
|
|
24
|
+
export interface MenuItemInterface {
|
|
25
|
+
text: string;
|
|
26
|
+
onPress: () => void;
|
|
27
|
+
icon?: ImageSourcePropType | JSX.Element;
|
|
28
|
+
textStyle?: TextStyle;
|
|
29
|
+
iconStyle?: ImageStyle;
|
|
30
|
+
iconContainerStyle?: ViewStyle;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Props for the CometChatTooltipMenu component.
|
|
36
|
+
*/
|
|
18
37
|
type CometChatTooltipMenuProps = {
|
|
38
|
+
/**
|
|
39
|
+
* Controls the visibility of the tooltip menu.
|
|
40
|
+
*/
|
|
19
41
|
visible?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Callback function invoked when the tooltip menu is dismissed.
|
|
44
|
+
*/
|
|
20
45
|
onDismiss?: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* Callback function invoked when the tooltip menu is closed.
|
|
48
|
+
*/
|
|
21
49
|
onClose?: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* The event object containing the coordinates where the tooltip menu should appear.
|
|
52
|
+
*/
|
|
22
53
|
event: {
|
|
23
54
|
nativeEvent: {
|
|
55
|
+
/**
|
|
56
|
+
* The X coordinate of the event.
|
|
57
|
+
*/
|
|
24
58
|
pageX: number;
|
|
59
|
+
/**
|
|
60
|
+
* The Y coordinate of the event.
|
|
61
|
+
*/
|
|
25
62
|
pageY: number;
|
|
26
63
|
};
|
|
27
64
|
};
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
iconColor?: ColorValue;
|
|
33
|
-
icon?: ImageSourcePropType | JSX.Element;
|
|
34
|
-
}[];
|
|
65
|
+
/**
|
|
66
|
+
* An array of menu item objects that define the options in the tooltip menu.
|
|
67
|
+
*/
|
|
68
|
+
menuItems: MenuItemInterface[];
|
|
35
69
|
};
|
|
36
70
|
|
|
37
|
-
export const
|
|
71
|
+
export const CometChatTooltipMenu = (props: CometChatTooltipMenuProps) => {
|
|
38
72
|
const { visible = false, onDismiss = () => null, onClose = () => null, event, menuItems } = props;
|
|
39
73
|
const theme = useTheme();
|
|
40
74
|
|
|
@@ -118,17 +152,19 @@ export const TooltipMenu = (props: CometChatTooltipMenuProps) => {
|
|
|
118
152
|
]}
|
|
119
153
|
>
|
|
120
154
|
<Icon
|
|
121
|
-
color={item
|
|
122
|
-
size={theme.spacing.spacing.s6}
|
|
155
|
+
color={item?.iconStyle?.tintColor ?? theme.color.textSecondary}
|
|
156
|
+
size={item?.iconStyle?.height ?? theme.spacing.spacing.s6}
|
|
157
|
+
height={item?.iconStyle?.height ?? theme.spacing.spacing.s6}
|
|
158
|
+
width={item?.iconStyle?.width ?? theme.spacing.spacing.s6}
|
|
123
159
|
icon={item.icon}
|
|
160
|
+
containerStyle={item?.iconContainerStyle}
|
|
124
161
|
/>
|
|
125
162
|
<Text
|
|
126
|
-
style={
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
]}
|
|
163
|
+
style={{
|
|
164
|
+
color: theme.color.textPrimary,
|
|
165
|
+
...theme.typography.heading4.regular,
|
|
166
|
+
...item?.textStyle,
|
|
167
|
+
}}
|
|
132
168
|
>
|
|
133
169
|
{item.text}
|
|
134
170
|
</Text>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, {useEffect, useRef, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
ActivityIndicator,
|
|
4
4
|
EmitterSubscription,
|
|
@@ -20,33 +20,53 @@ import { CommonUtils } from "../../utils/CommonUtils";
|
|
|
20
20
|
const { FileManager } = NativeModules;
|
|
21
21
|
const eventEmitter = new NativeEventEmitter(FileManager);
|
|
22
22
|
let statusListener: EmitterSubscription;
|
|
23
|
+
/**
|
|
24
|
+
* Props for the CometChatVideoBubble component.
|
|
25
|
+
*/
|
|
23
26
|
export interface CometChatVideoBubbleInterface {
|
|
24
27
|
/**
|
|
25
|
-
*
|
|
28
|
+
* URL for the video.
|
|
26
29
|
*/
|
|
27
30
|
videoUrl: string;
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
32
|
+
* Thumbnail URL for the video bubble.
|
|
30
33
|
*/
|
|
31
34
|
thumbnailUrl?: ImageSourcePropType;
|
|
32
35
|
/**
|
|
33
|
-
*
|
|
36
|
+
* Placeholder image to display while the video is loading.
|
|
34
37
|
*/
|
|
35
38
|
placeholderImage?: ImageSourcePropType;
|
|
36
|
-
|
|
37
39
|
/**
|
|
38
|
-
*
|
|
40
|
+
* Custom play icon, which can be a JSX element or an image source.
|
|
39
41
|
*/
|
|
40
42
|
playIcon?: JSX.Element | ImageSourcePropType;
|
|
41
43
|
/**
|
|
42
|
-
*
|
|
43
|
-
* function
|
|
44
|
+
* Callback function executed when the play button is clicked.
|
|
45
|
+
* The function receives the video URL as a parameter.
|
|
46
|
+
*
|
|
47
|
+
* @param videoUrl - The URL of the video.
|
|
44
48
|
*/
|
|
45
49
|
onPress?: Function;
|
|
50
|
+
/**
|
|
51
|
+
* Custom style for the video thumbnail image.
|
|
52
|
+
*/
|
|
46
53
|
imageStyle?: ImageStyle;
|
|
54
|
+
/**
|
|
55
|
+
* Custom style for the play icon.
|
|
56
|
+
*/
|
|
47
57
|
playIconStyle?: ImageStyle;
|
|
58
|
+
/**
|
|
59
|
+
* Custom style for the container of the play icon.
|
|
60
|
+
*/
|
|
48
61
|
playIconContainerStyle?: ViewStyle;
|
|
49
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* CometChatVideoBubble is a component that displays a video bubble with a thumbnail image
|
|
65
|
+
* and a play icon. It handles video playback when the play icon is clicked.
|
|
66
|
+
*
|
|
67
|
+
* @param props - Props for the component.
|
|
68
|
+
* @returns The rendered video bubble.
|
|
69
|
+
*/
|
|
50
70
|
|
|
51
71
|
export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
52
72
|
const {
|
|
@@ -168,4 +188,4 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
|
|
|
168
188
|
</ImageBackground>
|
|
169
189
|
</>
|
|
170
190
|
);
|
|
171
|
-
};
|
|
191
|
+
};
|
|
@@ -13,11 +13,29 @@ import {
|
|
|
13
13
|
import Video from "react-native-video";
|
|
14
14
|
import { Icon } from "../../icons/Icon";
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Props for the CometChatVideoPlayer component.
|
|
18
|
+
*/
|
|
19
|
+
export interface CometChatVideoPlayerProps {
|
|
20
|
+
/**
|
|
21
|
+
* URI of the video to play.
|
|
22
|
+
*/
|
|
17
23
|
videoUri: string;
|
|
24
|
+
/**
|
|
25
|
+
* Flag indicating whether the video player is visible.
|
|
26
|
+
*/
|
|
18
27
|
isVisible: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Callback function invoked when the video player is closed.
|
|
30
|
+
*/
|
|
19
31
|
onClose: () => void;
|
|
32
|
+
/**
|
|
33
|
+
* Callback function invoked when the video has loaded.
|
|
34
|
+
*/
|
|
20
35
|
onLoad: () => void;
|
|
36
|
+
/**
|
|
37
|
+
* Optional color for the loading icon.
|
|
38
|
+
*/
|
|
21
39
|
loadingIconColor?: string;
|
|
22
40
|
}
|
|
23
41
|
|
|
@@ -176,4 +194,4 @@ const styles = StyleSheet.create({
|
|
|
176
194
|
alignItems: "center",
|
|
177
195
|
zIndex: 1,
|
|
178
196
|
},
|
|
179
|
-
});
|
|
197
|
+
});
|
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
import { StyleProp, Text, TextStyle, View, ViewStyle } from "react-native";
|
|
2
|
-
import { RequireAtLeastOne } from "../../helper/types";
|
|
3
|
-
|
|
4
|
-
// type ErrorEmptyViewProps = RequireAtLeastOne<{
|
|
5
|
-
// title: string;
|
|
6
|
-
// subTitle: string;
|
|
7
|
-
// Icon?: JSX.Element;
|
|
8
|
-
// tertiaryTitle?: string;
|
|
9
|
-
// }> & {
|
|
10
|
-
// containerStyle?: StyleProp<ViewStyle>;
|
|
11
|
-
// titleStyle?: StyleProp<TextStyle>;
|
|
12
|
-
// subTitleStyle?: StyleProp<TextStyle>;
|
|
13
|
-
// RetryView?: JSX.Element;
|
|
14
|
-
// };
|
|
15
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Props for the ErrorEmptyView component.
|
|
5
|
+
*/
|
|
16
6
|
type ErrorEmptyViewProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The title text to display in the error/empty view.
|
|
9
|
+
*/
|
|
17
10
|
title?: string;
|
|
11
|
+
/**
|
|
12
|
+
* The subtitle text to display in the error/empty view.
|
|
13
|
+
*/
|
|
18
14
|
subTitle?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A JSX element to display as an icon.
|
|
17
|
+
*/
|
|
19
18
|
Icon?: JSX.Element;
|
|
19
|
+
/**
|
|
20
|
+
* An optional tertiary title for additional context.
|
|
21
|
+
*/
|
|
20
22
|
tertiaryTitle?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Custom style for the container of the error/empty view.
|
|
25
|
+
*/
|
|
21
26
|
containerStyle?: StyleProp<ViewStyle>;
|
|
27
|
+
/**
|
|
28
|
+
* Custom style for the title text.
|
|
29
|
+
*/
|
|
22
30
|
titleStyle?: StyleProp<TextStyle>;
|
|
31
|
+
/**
|
|
32
|
+
* Custom style for the subtitle text.
|
|
33
|
+
*/
|
|
23
34
|
subTitleStyle?: StyleProp<TextStyle>;
|
|
35
|
+
/**
|
|
36
|
+
* A custom JSX element to render for a retry action.
|
|
37
|
+
*/
|
|
24
38
|
RetryView?: JSX.Element;
|
|
25
39
|
};
|
|
26
40
|
|
|
41
|
+
|
|
27
42
|
export const ErrorEmptyView = (props: ErrorEmptyViewProps) => {
|
|
28
43
|
const {
|
|
29
44
|
title,
|
|
@@ -44,4 +59,4 @@ export const ErrorEmptyView = (props: ErrorEmptyViewProps) => {
|
|
|
44
59
|
{RetryView}
|
|
45
60
|
</View>
|
|
46
61
|
);
|
|
47
|
-
};
|
|
62
|
+
};
|
|
@@ -80,6 +80,7 @@ import {
|
|
|
80
80
|
} from "./CometChatSuggestionList";
|
|
81
81
|
import { CometChatAvatar } from "./CometChatAvatar";
|
|
82
82
|
import { BadgeStyle, CometChatBadge } from "./CometChatBadge";
|
|
83
|
+
import { MenuItemInterface } from "./CometChatTooltipMenu";
|
|
83
84
|
|
|
84
85
|
export type {
|
|
85
86
|
CometChatConfirmDialogInterface,
|
|
@@ -132,4 +133,5 @@ export type {
|
|
|
132
133
|
BadgeStyle,
|
|
133
134
|
CometChatListProps,
|
|
134
135
|
DateStyle,
|
|
136
|
+
MenuItemInterface,
|
|
135
137
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCallButtonStyle } from "../../calls/CometChatCallButtons/style";
|
|
2
|
-
import { getCallLogsItemStyle,
|
|
2
|
+
import { getCallLogsItemStyle, getCallLogsStyleLight, getCallLogsStyleDark } from "../../calls/CometChatCallLogs/style";
|
|
3
3
|
import { getIncomingCallStyle } from "../../calls/CometChatIncomingCall/style";
|
|
4
4
|
import { getOutgoingCallStyle } from "../../calls/CometChatOutgoingCall";
|
|
5
5
|
import {
|
|
@@ -153,7 +153,7 @@ export const lightThemeMaker = (
|
|
|
153
153
|
typography: typography,
|
|
154
154
|
avatarStyle: getAvatarStyle(color, spacing, typography),
|
|
155
155
|
receiptStyles: getMessageReceiptStyle(color, spacing, typography),
|
|
156
|
-
|
|
156
|
+
statusIndicatorStyle: getStatusIndicatorStyles(color, spacing, typography),
|
|
157
157
|
badgeStyle: getBadgeStyle(color, spacing, typography),
|
|
158
158
|
dateStyles: getDateStyleLight(color, spacing, typography),
|
|
159
159
|
dateSeparatorStyles: getDateSeparatorStyleLight(color, spacing, typography),
|
|
@@ -177,7 +177,7 @@ export const lightThemeMaker = (
|
|
|
177
177
|
quickReactionStyle: getQuickReactionStyleLight(color, spacing, typography),
|
|
178
178
|
outgoingCallStyle: getOutgoingCallStyle(color, spacing, typography),
|
|
179
179
|
incomingCallStyle: getIncomingCallStyle(color, spacing, typography),
|
|
180
|
-
callLogsStyles:
|
|
180
|
+
callLogsStyles: getCallLogsStyleLight(color, spacing, typography),
|
|
181
181
|
callLogsItemStyle: getCallLogsItemStyle(color, spacing, typography),
|
|
182
182
|
mediaRecorderStyle: getMediaRecorderStyle(color, spacing, typography),
|
|
183
183
|
};
|
|
@@ -195,7 +195,7 @@ export const darkThemeMaker = (
|
|
|
195
195
|
typography: typography,
|
|
196
196
|
avatarStyle: getAvatarStyle(color, spacing, typography),
|
|
197
197
|
receiptStyles: getMessageReceiptStyle(color, spacing, typography),
|
|
198
|
-
|
|
198
|
+
statusIndicatorStyle: getStatusIndicatorStyles(color, spacing, typography),
|
|
199
199
|
badgeStyle: getBadgeStyle(color, spacing, typography),
|
|
200
200
|
dateStyles: getDateStyleDark(color, spacing, typography),
|
|
201
201
|
dateSeparatorStyles: getDateSeparatorStyleDark(color, spacing, typography),
|
|
@@ -219,7 +219,7 @@ export const darkThemeMaker = (
|
|
|
219
219
|
quickReactionStyle: getQuickReactionStyleDark(color, spacing, typography),
|
|
220
220
|
outgoingCallStyle: getOutgoingCallStyle(color, spacing, typography),
|
|
221
221
|
incomingCallStyle: getIncomingCallStyle(color, spacing, typography),
|
|
222
|
-
callLogsStyles:
|
|
222
|
+
callLogsStyles: getCallLogsStyleDark(color, spacing, typography),
|
|
223
223
|
callLogsItemStyle: getCallLogsItemStyle(color, spacing, typography),
|
|
224
224
|
mediaRecorderStyle: getMediaRecorderStyle(color, spacing, typography),
|
|
225
225
|
};
|
package/src/theme/type.ts
CHANGED
|
@@ -259,7 +259,7 @@ export interface CometChatTheme {
|
|
|
259
259
|
threadHeaderStyles: {
|
|
260
260
|
containerStyle: ViewStyle;
|
|
261
261
|
messageBubbleContainerStyle: ViewStyle;
|
|
262
|
-
|
|
262
|
+
replyCountBarStyle: ViewStyle;
|
|
263
263
|
replyCountTextStyle: TextStyle;
|
|
264
264
|
incomingMessageBubbleStyles: DeepPartial<BubbleStyles>;
|
|
265
265
|
outgoingMessageBubbleStyles: DeepPartial<BubbleStyles>;
|
|
@@ -434,7 +434,7 @@ export interface CometChatTheme {
|
|
|
434
434
|
messageOptionsStyles: DeepPartial<ActionSheetStyle>;
|
|
435
435
|
};
|
|
436
436
|
avatarStyle: Partial<AvatarStyle>;
|
|
437
|
-
|
|
437
|
+
statusIndicatorStyle: StatusIndicatorStyles;
|
|
438
438
|
badgeStyle: BadgeStyle;
|
|
439
439
|
callLogsStyles: CallLogsStyle;
|
|
440
440
|
conversationStyles: ConversationStyle;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// import React, { useContext } from "react";
|
|
2
|
-
// import { Image, Text, TouchableOpacity, View } from "react-native";
|
|
3
|
-
// import { CometChatContext } from "../../CometChatContext";
|
|
4
|
-
// import { PanelStyle, PanelStyleInterface } from "./PanelStyle";
|
|
5
|
-
// import { CloseIcon } from "./resources";
|
|
6
|
-
|
|
7
|
-
// export interface CometChatPanelInterface {
|
|
8
|
-
// title: string;
|
|
9
|
-
// hideCloseButton?: boolean;
|
|
10
|
-
// style?: PanelStyleInterface;
|
|
11
|
-
// textContent: string;
|
|
12
|
-
// onClose: () => void;
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// export const CometChatPanel = (props: CometChatPanelInterface) => {
|
|
16
|
-
// const { hideCloseButton, style, textContent, title, onClose } = props;
|
|
17
|
-
|
|
18
|
-
// const { theme } = useContext(CometChatContext);
|
|
19
|
-
|
|
20
|
-
// const {
|
|
21
|
-
// backgroundColor,
|
|
22
|
-
// border,
|
|
23
|
-
// borderRadius,
|
|
24
|
-
// closeIconTint,
|
|
25
|
-
// textColor,
|
|
26
|
-
// textFont,
|
|
27
|
-
// titleColor,
|
|
28
|
-
// titleFont,
|
|
29
|
-
// } = new PanelStyle({
|
|
30
|
-
// closeIconTint: theme.palette.getAccent(),
|
|
31
|
-
// border: { borderWidth: 1, borderColor: theme.palette.getPrimary() },
|
|
32
|
-
// titleFont: theme.typography.title1,
|
|
33
|
-
// titleColor: theme.palette.getAccent(),
|
|
34
|
-
// textColor: theme.palette.getAccent600(),
|
|
35
|
-
// textFont: theme.typography.text1,
|
|
36
|
-
// backgroundColor: theme.palette.getPrimary40(),
|
|
37
|
-
// ...style,
|
|
38
|
-
// });
|
|
39
|
-
|
|
40
|
-
// const _onClose = () => {
|
|
41
|
-
// onClose && onClose();
|
|
42
|
-
// };
|
|
43
|
-
|
|
44
|
-
// return (
|
|
45
|
-
// <View style={[{ backgroundColor: backgroundColor, borderRadius, padding: 10 }, { ...border }]}>
|
|
46
|
-
// <View style={{ flexDirection: "row", justifyContent: "space-between", marginBottom: 10 }}>
|
|
47
|
-
// <Text style={[titleFont, { color: titleColor }]}>{title}</Text>
|
|
48
|
-
// {!hideCloseButton && (
|
|
49
|
-
// <TouchableOpacity onPress={_onClose}>
|
|
50
|
-
// <Image style={{ width: 20, height: 20, tintColor: closeIconTint }} source={CloseIcon} />
|
|
51
|
-
// </TouchableOpacity>
|
|
52
|
-
// )}
|
|
53
|
-
// </View>
|
|
54
|
-
// <Text style={[textFont, { color: textColor }]}>{textContent}</Text>
|
|
55
|
-
// </View>
|
|
56
|
-
// );
|
|
57
|
-
// };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { BaseStyle, FontStyle } from "../../base";
|
|
2
|
-
|
|
3
|
-
export interface PanelStyleInterface extends BaseStyle {
|
|
4
|
-
titleFont?: FontStyle;
|
|
5
|
-
titleColor?: string;
|
|
6
|
-
closeIconTint?: string;
|
|
7
|
-
textFont?: FontStyle;
|
|
8
|
-
textColor?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export class PanelStyle extends BaseStyle {
|
|
12
|
-
titleFont?: FontStyle;
|
|
13
|
-
titleColor?: string;
|
|
14
|
-
closeIconTint?: string;
|
|
15
|
-
textFont?: FontStyle;
|
|
16
|
-
textColor?: string;
|
|
17
|
-
|
|
18
|
-
constructor({
|
|
19
|
-
height,
|
|
20
|
-
width,
|
|
21
|
-
backgroundColor,
|
|
22
|
-
border,
|
|
23
|
-
borderRadius,
|
|
24
|
-
closeIconTint,
|
|
25
|
-
titleFont,
|
|
26
|
-
titleColor,
|
|
27
|
-
textColor,
|
|
28
|
-
textFont,
|
|
29
|
-
}: PanelStyleInterface) {
|
|
30
|
-
super({
|
|
31
|
-
backgroundColor,
|
|
32
|
-
border,
|
|
33
|
-
borderRadius,
|
|
34
|
-
height,
|
|
35
|
-
width,
|
|
36
|
-
});
|
|
37
|
-
this.closeIconTint = closeIconTint;
|
|
38
|
-
this.titleColor = titleColor;
|
|
39
|
-
this.titleFont = titleFont;
|
|
40
|
-
this.textColor = textColor;
|
|
41
|
-
this.textFont = textFont;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
Binary file
|