@cometchat/chat-uikit-react-native 5.2.3 → 5.2.5
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/CometChatConversations/CometChatConversations.tsx +167 -86
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +312 -116
- package/src/CometChatMessageComposer/styles.tsx +2 -1
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +83 -17
- package/src/CometChatMessageList/CometChatMessageList.tsx +675 -122
- package/src/CometChatMessageList/style.ts +4 -2
- package/src/CometChatSearch/CometChatSearch.tsx +2165 -0
- package/src/CometChatSearch/SearchConstants.ts +46 -0
- package/src/CometChatSearch/Skeleton.tsx +192 -0
- package/src/CometChatSearch/index.ts +1 -0
- package/src/CometChatSearch/style.ts +414 -0
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +43 -7
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +45 -7
- package/src/extensions/Polls/Polls.tsx +36 -2
- package/src/extensions/Polls/PollsBubble.tsx +13 -9
- package/src/extensions/Polls/PollsDecorator.tsx +13 -1
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +50 -11
- package/src/extensions/Stickers/style.ts +0 -1
- package/src/index.ts +5 -0
- package/src/shared/base/Types.ts +8 -0
- package/src/shared/constants/UIKitConstants.ts +2 -0
- package/src/shared/events/CometChatMessageEvents/index.ts +8 -7
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +158 -27
- package/src/shared/framework/DataSource.ts +7 -0
- package/src/shared/framework/DataSourceDecorator.tsx +12 -0
- package/src/shared/framework/MessageDataSource.tsx +182 -1
- package/src/shared/helper/functions.js +0 -67
- package/src/shared/helper/helperFunctions.ts +72 -0
- package/src/shared/icons/components/documents.tsx +23 -0
- package/src/shared/icons/components/empty-search.tsx +52 -0
- package/src/shared/icons/components/message-blocked.tsx +1 -1
- package/src/shared/icons/components/unread.tsx +29 -0
- package/src/shared/icons/icon-mapping.tsx +7 -0
- package/src/shared/index.ts +2 -1
- package/src/shared/modals/CometChatMessageTemplate.ts +23 -0
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +4 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +17 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +70 -34
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +60 -24
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +60 -24
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +40 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +38 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +37 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +40 -4
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +274 -23
- package/src/shared/utils/MessageUtils.tsx +0 -1
- package/src/shared/views/CometChatAudioBubble/style.ts +0 -2
- package/src/shared/views/CometChatFileBubble/style.ts +0 -4
- package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
- package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
- package/src/shared/views/CometChatList/Header.tsx +79 -49
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
- package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +390 -0
- package/src/shared/views/CometChatReportDialog/index.ts +3 -0
- package/src/shared/views/CometChatReportDialog/style.ts +164 -0
- package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
- package/src/shared/views/CometChatStatusIndicator/styles.ts +2 -2
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +18 -2
- package/src/shared/views/index.ts +6 -0
- package/src/theme/default/default.ts +3 -0
- package/src/theme/provider.tsx +23 -12
- package/src/theme/type.ts +2 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search related enums and constants for CometChatSearch component
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Enum for different search scopes
|
|
7
|
+
*/
|
|
8
|
+
export enum CometChatSearchScope {
|
|
9
|
+
Conversations = "conversations",
|
|
10
|
+
Messages = "messages",
|
|
11
|
+
All = "all"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Enum for different search filters
|
|
16
|
+
*/
|
|
17
|
+
export enum CometChatSearchFilter {
|
|
18
|
+
Conversations = "conversations",
|
|
19
|
+
Messages = "messages",
|
|
20
|
+
Unread = "unread",
|
|
21
|
+
Groups = "groups",
|
|
22
|
+
Photos = "photos",
|
|
23
|
+
Videos = "videos",
|
|
24
|
+
Audio = "audio",
|
|
25
|
+
Documents = "documents",
|
|
26
|
+
Links = "links"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Enum for component states
|
|
31
|
+
*/
|
|
32
|
+
export enum States {
|
|
33
|
+
loading = "loading",
|
|
34
|
+
loaded = "loaded",
|
|
35
|
+
empty = "empty",
|
|
36
|
+
error = "error"
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Interface for search filter items
|
|
41
|
+
*/
|
|
42
|
+
export interface CometChatSearchFilterItem {
|
|
43
|
+
id: CometChatSearchFilter;
|
|
44
|
+
title: string;
|
|
45
|
+
active?: boolean;
|
|
46
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skeleton.tsx
|
|
3
|
+
*
|
|
4
|
+
* A lightweight, theme-aware shimmer "skeleton" placeholder for
|
|
5
|
+
* CometChat search results (conversations and messages).
|
|
6
|
+
* ––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––
|
|
7
|
+
* • 10 rows (top + bottom layers) drawn with react-native-svg.
|
|
8
|
+
* • Two Animated views slide across on a loop to create
|
|
9
|
+
* the shimmer illusion.
|
|
10
|
+
* • Colours, speed, opacity and gradient come from the active
|
|
11
|
+
* CometChatTheme but can be overridden per-instance via `style`.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import React, { useEffect, useRef } from "react";
|
|
15
|
+
import { Animated, Dimensions, Easing, ScrollView, StyleSheet, View } from "react-native";
|
|
16
|
+
import Svg, { Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
|
|
17
|
+
|
|
18
|
+
import { useTheme } from "@cometchat/chat-uikit-react-native";
|
|
19
|
+
import { CometChatTheme } from "@cometchat/chat-uikit-react-native/src/theme/type";
|
|
20
|
+
|
|
21
|
+
// ───────────────────────────────────────────────────────────────
|
|
22
|
+
// Consts & Types
|
|
23
|
+
// ───────────────────────────────────────────────────────────────
|
|
24
|
+
const { width: screenWidth } = Dimensions.get("window");
|
|
25
|
+
const SKELETON_ROW_COUNT = 10; // How many rows to render for search results
|
|
26
|
+
|
|
27
|
+
type SkeletonStyle = CometChatTheme["conversationStyles"]["skeletonStyle"];
|
|
28
|
+
|
|
29
|
+
interface SkeletonProps {
|
|
30
|
+
style?: SkeletonStyle; // Optional per-instance overrides
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// ───────────────────────────────────────────────────────────────
|
|
34
|
+
// Reusable SVG snippets for search results
|
|
35
|
+
// ───────────────────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Bottom SVG layer – pure grey rectangles that will be *under* the shimmer.
|
|
39
|
+
*/
|
|
40
|
+
const SkeletonItemBottom: React.FC<SkeletonProps> = ({ style }) => {
|
|
41
|
+
const theme = useTheme();
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<Svg
|
|
45
|
+
height={screenWidth / 5}
|
|
46
|
+
viewBox='0 0 360 72'
|
|
47
|
+
fill='none'
|
|
48
|
+
preserveAspectRatio='xMidYMid meet'
|
|
49
|
+
>
|
|
50
|
+
<G>
|
|
51
|
+
{/* Avatar circle */}
|
|
52
|
+
<Path d='M64 12H16V60H64V12Z' fill='url(#paint0_linear)' />
|
|
53
|
+
</G>
|
|
54
|
+
{/* Main content line */}
|
|
55
|
+
<Path d='M236 16.5H76V35.5H236V35.5Z' fill='url(#paint0_linear)' />
|
|
56
|
+
{/* Trailing content (timestamp/badge area) */}
|
|
57
|
+
<Path d='M344 16.5H284V35.5H344V35.5Z' fill='url(#paint0_linear)' />
|
|
58
|
+
{/* Subtitle line */}
|
|
59
|
+
<Path d='M284 43.5H76V55.5H284V55.5Z' fill='url(#paint0_linear)' />
|
|
60
|
+
{/* Preview area for messages (right side) */}
|
|
61
|
+
<Path d='M344 36H304V60H344V36Z' fill='url(#paint0_linear)' />
|
|
62
|
+
|
|
63
|
+
{/* Gradient definition */}
|
|
64
|
+
<Defs>
|
|
65
|
+
<LinearGradient
|
|
66
|
+
id='paint0_linear'
|
|
67
|
+
x1={16}
|
|
68
|
+
y1={36}
|
|
69
|
+
x2={64}
|
|
70
|
+
y2={36}
|
|
71
|
+
gradientUnits='userSpaceOnUse'
|
|
72
|
+
>
|
|
73
|
+
<Stop
|
|
74
|
+
stopColor={
|
|
75
|
+
style?.linearGradientColors?.[0] ??
|
|
76
|
+
theme.conversationStyles.skeletonStyle.linearGradientColors[0]
|
|
77
|
+
}
|
|
78
|
+
/>
|
|
79
|
+
<Stop
|
|
80
|
+
offset={1}
|
|
81
|
+
stopColor={
|
|
82
|
+
style?.linearGradientColors?.[1] ??
|
|
83
|
+
theme.conversationStyles.skeletonStyle.linearGradientColors[1]
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
</LinearGradient>
|
|
87
|
+
</Defs>
|
|
88
|
+
</Svg>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Top SVG "cookie-cutter" layer – punched out shapes that mask out the
|
|
94
|
+
* shimmer where content will eventually appear.
|
|
95
|
+
*/
|
|
96
|
+
const SkeletonItemTop: React.FC<SkeletonProps> = ({ style }) => {
|
|
97
|
+
const theme = useTheme();
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Svg height={screenWidth / 5} viewBox='0 0 360 72' fill='none'>
|
|
101
|
+
{/* The giant path draws avatar circle + text bars + preview area */}
|
|
102
|
+
<Path
|
|
103
|
+
fillRule='evenodd'
|
|
104
|
+
clipRule='evenodd'
|
|
105
|
+
d='M0 0H360V72H0V0ZM16 36C16 22.7452 26.7452 12 40 12C53.2548 12 64 22.7452 64 36C64 49.2548 53.2548 60 40 60C26.7452 60 16 49.2548 16 36ZM84 16.5C79.5817 16.5 76 20.0817 76 24.5V27.5C76 31.9183 79.5817 35.5 84 35.5H228C232.418 35.5 236 31.9183 236 27.5V24.5C236 20.0817 232.418 16.5 228 16.5H84ZM284 24.5C284 20.0817 287.582 16.5 292 16.5H336C340.418 16.5 344 20.0817 344 24.5V27.5C344 31.9183 340.418 35.5 336 35.5H292C287.582 35.5 284 31.9183 284 27.5V24.5ZM82 43.5C78.6863 43.5 76 46.1863 76 49.5C76 52.8137 78.6863 55.5 82 55.5H278C281.314 55.5 284 52.8137 284 49.5C284 46.1863 281.314 43.5 278 43.5H82ZM312 40C308.686 40 306 42.6863 306 46V54C306 57.3137 308.686 60 312 60H336C339.314 60 342 57.3137 342 54V46C342 42.6863 339.314 40 336 40H312Z'
|
|
106
|
+
fill={
|
|
107
|
+
/* Mask must match background so the shimmer underneath shows */
|
|
108
|
+
style?.containerBackgroundColor ||
|
|
109
|
+
theme.conversationStyles.skeletonStyle.containerBackgroundColor
|
|
110
|
+
}
|
|
111
|
+
/>
|
|
112
|
+
</Svg>
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// ───────────────────────────────────────────────────────────────
|
|
117
|
+
// Main Component
|
|
118
|
+
// ───────────────────────────────────────────────────────────────
|
|
119
|
+
export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
120
|
+
const theme = useTheme();
|
|
121
|
+
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
122
|
+
|
|
123
|
+
/* Kick-off the shimmer animation once on mount */
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
animatedValue.setValue(0);
|
|
126
|
+
Animated.loop(
|
|
127
|
+
Animated.timing(animatedValue, {
|
|
128
|
+
toValue: 1,
|
|
129
|
+
duration: (1 / (style?.speed || theme.conversationStyles.skeletonStyle.speed)) * 1000,
|
|
130
|
+
easing: Easing.linear,
|
|
131
|
+
useNativeDriver: false, // translateX is layout-related
|
|
132
|
+
})
|
|
133
|
+
).start();
|
|
134
|
+
}, [animatedValue, style?.speed || theme.conversationStyles.skeletonStyle.speed]);
|
|
135
|
+
|
|
136
|
+
/* Map 0-1 → off-screen-left → off-screen-right */
|
|
137
|
+
const shimmerTranslateX = animatedValue.interpolate({
|
|
138
|
+
inputRange: [0, 1],
|
|
139
|
+
outputRange: [-screenWidth * 2, screenWidth],
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
/* Render ----------------------------------------------------- */
|
|
143
|
+
return (
|
|
144
|
+
<ScrollView showsVerticalScrollIndicator={false} scrollEnabled={false}>
|
|
145
|
+
{/* Bottom layer rectangles */}
|
|
146
|
+
{Array.from({ length: SKELETON_ROW_COUNT }, (_, i) => (
|
|
147
|
+
<SkeletonItemBottom style={style} key={`bottom-${i}`} />
|
|
148
|
+
))}
|
|
149
|
+
|
|
150
|
+
{/* Two angled shimmer bars */}
|
|
151
|
+
{[0, screenWidth / 2].map((offset, i) => (
|
|
152
|
+
<Animated.View
|
|
153
|
+
key={`shimmer-${i}`}
|
|
154
|
+
style={[
|
|
155
|
+
styles.animatedView,
|
|
156
|
+
{
|
|
157
|
+
transform: [
|
|
158
|
+
{ translateX: Animated.add(shimmerTranslateX, offset) },
|
|
159
|
+
{ translateY: -20 },
|
|
160
|
+
{ rotate: "15deg" },
|
|
161
|
+
],
|
|
162
|
+
backgroundColor:
|
|
163
|
+
style?.shimmerBackgroundColor ??
|
|
164
|
+
theme.conversationStyles.skeletonStyle.shimmerBackgroundColor,
|
|
165
|
+
opacity:
|
|
166
|
+
style?.shimmerOpacity ?? theme.conversationStyles.skeletonStyle.shimmerOpacity,
|
|
167
|
+
},
|
|
168
|
+
]}
|
|
169
|
+
/>
|
|
170
|
+
))}
|
|
171
|
+
|
|
172
|
+
{/* Top mask layer – sits above shimmer to carve out shapes */}
|
|
173
|
+
<View style={StyleSheet.absoluteFill}>
|
|
174
|
+
{Array.from({ length: SKELETON_ROW_COUNT }, (_, i) => (
|
|
175
|
+
<SkeletonItemTop style={style} key={`top-${i}`} />
|
|
176
|
+
))}
|
|
177
|
+
</View>
|
|
178
|
+
</ScrollView>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// ───────────────────────────────────────────────────────────────
|
|
183
|
+
// Styles
|
|
184
|
+
// ───────────────────────────────────────────────────────────────
|
|
185
|
+
const styles = StyleSheet.create({
|
|
186
|
+
animatedView: {
|
|
187
|
+
width: "25%", // narrow bar looks nicer at an angle
|
|
188
|
+
top: 0,
|
|
189
|
+
bottom: 0,
|
|
190
|
+
position: "absolute",
|
|
191
|
+
},
|
|
192
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CometChatSearch, default } from './CometChatSearch';
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ColorValue,
|
|
3
|
+
ImageSourcePropType,
|
|
4
|
+
ImageStyle,
|
|
5
|
+
TextStyle,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from "react-native";
|
|
8
|
+
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
9
|
+
import { AvatarStyle, getAvatarStyle } from "../shared/views/CometChatAvatar";
|
|
10
|
+
import { BadgeStyle } from "../shared/views/CometChatBadge";
|
|
11
|
+
import { DateStyle } from "../shared/views/CometChatDate";
|
|
12
|
+
import { CometChatTheme } from "../theme/type";
|
|
13
|
+
import { DeepPartial } from "../shared/helper/types";
|
|
14
|
+
import { JSX } from "react";
|
|
15
|
+
import { BorderStyle } from "../shared/base/BorderStyle";
|
|
16
|
+
|
|
17
|
+
export type SearchStyle = {
|
|
18
|
+
containerStyle: ViewStyle;
|
|
19
|
+
headerStyle: ViewStyle;
|
|
20
|
+
backButtonStyle: ViewStyle;
|
|
21
|
+
backButtonIcon?: ImageSourcePropType | JSX.Element;
|
|
22
|
+
backButtonIconStyle: ImageStyle;
|
|
23
|
+
searchContainerStyle: ViewStyle;
|
|
24
|
+
searchInputContainerStyle: ViewStyle;
|
|
25
|
+
searchInputStyle: TextStyle;
|
|
26
|
+
searchIconStyle: ImageStyle;
|
|
27
|
+
clearButtonStyle: ViewStyle;
|
|
28
|
+
clearButtonIconStyle: ImageStyle;
|
|
29
|
+
filtersContainerStyle: ViewStyle;
|
|
30
|
+
filtersContentStyle: ViewStyle;
|
|
31
|
+
filterButtonStyle: ViewStyle;
|
|
32
|
+
filterButtonActiveStyle: ViewStyle;
|
|
33
|
+
filterButtonContentStyle: ViewStyle;
|
|
34
|
+
filterButtonIconStyle: ImageStyle;
|
|
35
|
+
filterButtonIconActiveStyle: ImageStyle;
|
|
36
|
+
filterButtonTextStyle: TextStyle;
|
|
37
|
+
filterButtonTextActiveStyle: TextStyle;
|
|
38
|
+
emptyStateStyle: {
|
|
39
|
+
containerStyle: ViewStyle;
|
|
40
|
+
titleStyle: TextStyle;
|
|
41
|
+
subtitleStyle: TextStyle;
|
|
42
|
+
iconContainerStyle?: ViewStyle;
|
|
43
|
+
iconStyle?: ImageStyle;
|
|
44
|
+
icon?: ImageSourcePropType | JSX.Element;
|
|
45
|
+
};
|
|
46
|
+
errorStateStyle: {
|
|
47
|
+
containerStyle: ViewStyle;
|
|
48
|
+
titleStyle: TextStyle;
|
|
49
|
+
subtitleStyle: TextStyle;
|
|
50
|
+
iconContainerStyle?: ViewStyle;
|
|
51
|
+
iconStyle?: ImageStyle;
|
|
52
|
+
icon?: ImageSourcePropType | JSX.Element;
|
|
53
|
+
};
|
|
54
|
+
resultsContainerStyle: ViewStyle;
|
|
55
|
+
sectionTitleStyle: TextStyle;
|
|
56
|
+
seeMoreButtonStyle: ViewStyle;
|
|
57
|
+
seeMoreTextStyle: TextStyle;
|
|
58
|
+
conversationItemStyle: {
|
|
59
|
+
containerStyle: ViewStyle;
|
|
60
|
+
contentStyle: ViewStyle;
|
|
61
|
+
titleStyle: TextStyle;
|
|
62
|
+
subtitleStyle: TextStyle;
|
|
63
|
+
avatarStyle: AvatarStyle;
|
|
64
|
+
trailingContainerStyle: ViewStyle;
|
|
65
|
+
badgeStyle: Partial<BadgeStyle>;
|
|
66
|
+
dateStyle: Partial<DateStyle>;
|
|
67
|
+
};
|
|
68
|
+
messageItemStyle: {
|
|
69
|
+
containerStyle: ViewStyle;
|
|
70
|
+
contentStyle: ViewStyle;
|
|
71
|
+
textContainerStyle: ViewStyle;
|
|
72
|
+
titleStyle: TextStyle;
|
|
73
|
+
subtitleStyle: TextStyle;
|
|
74
|
+
iconContainerStyle: ViewStyle;
|
|
75
|
+
trailingContainerStyle: ViewStyle;
|
|
76
|
+
previewContainerStyle: ViewStyle;
|
|
77
|
+
previewImageStyle: ImageStyle;
|
|
78
|
+
previewVideoStyle: ViewStyle;
|
|
79
|
+
videoPlayIconStyle: ViewStyle;
|
|
80
|
+
audioPreviewStyle: ViewStyle;
|
|
81
|
+
filePreviewStyle: ViewStyle;
|
|
82
|
+
linkPreviewImageStyle: ImageStyle;
|
|
83
|
+
};
|
|
84
|
+
skeletonStyle: {
|
|
85
|
+
linearGradientColors: [string, string];
|
|
86
|
+
shimmerBackgroundColor: ColorValue;
|
|
87
|
+
shimmerOpacity: number;
|
|
88
|
+
speed: number;
|
|
89
|
+
containerBackgroundColor: ColorValue;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const getSearchStyleLight = (
|
|
94
|
+
color: CometChatTheme["color"],
|
|
95
|
+
spacing: CometChatTheme["spacing"],
|
|
96
|
+
typography: CometChatTheme["typography"]
|
|
97
|
+
): DeepPartial<SearchStyle> => {
|
|
98
|
+
return {
|
|
99
|
+
containerStyle: {
|
|
100
|
+
flex: 1,
|
|
101
|
+
backgroundColor: color.background1,
|
|
102
|
+
marginVertical: spacing.margin.m3,
|
|
103
|
+
},
|
|
104
|
+
headerStyle: {
|
|
105
|
+
flexDirection: "row",
|
|
106
|
+
alignItems: "center",
|
|
107
|
+
paddingHorizontal: spacing.padding.p4,
|
|
108
|
+
paddingVertical: spacing.padding.p2,
|
|
109
|
+
backgroundColor: color.background1,
|
|
110
|
+
},
|
|
111
|
+
backButtonStyle: {
|
|
112
|
+
width: spacing.spacing.s10,
|
|
113
|
+
height: spacing.spacing.s10,
|
|
114
|
+
justifyContent: "center",
|
|
115
|
+
alignItems: "center",
|
|
116
|
+
marginRight: spacing.margin.m2,
|
|
117
|
+
},
|
|
118
|
+
backButtonIconStyle: {
|
|
119
|
+
tintColor: color.iconSecondary,
|
|
120
|
+
width: spacing.spacing.s6,
|
|
121
|
+
height: spacing.spacing.s6,
|
|
122
|
+
},
|
|
123
|
+
searchContainerStyle: {
|
|
124
|
+
flex: 1,
|
|
125
|
+
},
|
|
126
|
+
searchInputContainerStyle: {
|
|
127
|
+
backgroundColor: color.background3,
|
|
128
|
+
borderRadius: spacing.radius.max,
|
|
129
|
+
borderColor:color.borderDefault,
|
|
130
|
+
borderWidth:1,
|
|
131
|
+
paddingHorizontal: spacing.padding.p3,
|
|
132
|
+
flexDirection: "row",
|
|
133
|
+
alignItems: "center",
|
|
134
|
+
height: spacing.spacing.s12,
|
|
135
|
+
},
|
|
136
|
+
searchInputStyle: {
|
|
137
|
+
flex: 1,
|
|
138
|
+
...typography.heading4.regular,
|
|
139
|
+
color: color.textPrimary,
|
|
140
|
+
paddingVertical: spacing.padding.p1,
|
|
141
|
+
},
|
|
142
|
+
searchIconStyle: {
|
|
143
|
+
tintColor: color.iconSecondary,
|
|
144
|
+
width: spacing.spacing.s6,
|
|
145
|
+
height: spacing.spacing.s6,
|
|
146
|
+
},
|
|
147
|
+
clearButtonStyle: {
|
|
148
|
+
width: spacing.spacing.s6,
|
|
149
|
+
height: spacing.spacing.s6,
|
|
150
|
+
justifyContent: "center",
|
|
151
|
+
alignItems: "center",
|
|
152
|
+
marginLeft: spacing.margin.m2,
|
|
153
|
+
},
|
|
154
|
+
clearButtonIconStyle: {
|
|
155
|
+
tintColor: color.iconSecondary,
|
|
156
|
+
width: spacing.spacing.s4,
|
|
157
|
+
height: spacing.spacing.s4,
|
|
158
|
+
},
|
|
159
|
+
filtersContainerStyle: {
|
|
160
|
+
paddingVertical: spacing.padding.p2,
|
|
161
|
+
paddingHorizontal: spacing.padding.p4,
|
|
162
|
+
backgroundColor: color.background1,
|
|
163
|
+
},
|
|
164
|
+
filtersContentStyle: {
|
|
165
|
+
flexDirection: "row",
|
|
166
|
+
flexWrap: "wrap",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
},
|
|
169
|
+
filterButtonStyle: {
|
|
170
|
+
paddingHorizontal: spacing.padding.p3,
|
|
171
|
+
paddingVertical: spacing.padding.p2,
|
|
172
|
+
marginRight: spacing.margin.m2,
|
|
173
|
+
marginBottom: spacing.margin.m2,
|
|
174
|
+
backgroundColor: color.background3,
|
|
175
|
+
borderRadius: spacing.radius.r5,
|
|
176
|
+
borderWidth: 1,
|
|
177
|
+
borderColor: color.borderLight,
|
|
178
|
+
},
|
|
179
|
+
filterButtonActiveStyle: {
|
|
180
|
+
backgroundColor: color.neutral900,
|
|
181
|
+
borderColor: color.neutral800,
|
|
182
|
+
},
|
|
183
|
+
filterButtonContentStyle: {
|
|
184
|
+
flexDirection: "row",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
gap: spacing.spacing.s1,
|
|
187
|
+
},
|
|
188
|
+
filterButtonIconStyle: {
|
|
189
|
+
width: 16,
|
|
190
|
+
height: 16,
|
|
191
|
+
tintColor: color.textSecondary,
|
|
192
|
+
},
|
|
193
|
+
filterButtonIconActiveStyle: {
|
|
194
|
+
tintColor: color.staticWhite,
|
|
195
|
+
},
|
|
196
|
+
filterButtonTextStyle: {
|
|
197
|
+
...typography.body.regular,
|
|
198
|
+
color: color.textSecondary,
|
|
199
|
+
},
|
|
200
|
+
filterButtonTextActiveStyle: {
|
|
201
|
+
color: color.textWhite,
|
|
202
|
+
},
|
|
203
|
+
emptyStateStyle: {
|
|
204
|
+
containerStyle: {
|
|
205
|
+
flex: 1,
|
|
206
|
+
justifyContent: "center",
|
|
207
|
+
alignItems: "center",
|
|
208
|
+
paddingHorizontal: spacing.padding.p8,
|
|
209
|
+
},
|
|
210
|
+
titleStyle: {
|
|
211
|
+
...typography.heading2.bold,
|
|
212
|
+
color: color.textPrimary,
|
|
213
|
+
marginBottom: spacing.margin.m2,
|
|
214
|
+
textAlign: "center",
|
|
215
|
+
},
|
|
216
|
+
subtitleStyle: {
|
|
217
|
+
...typography.body.regular,
|
|
218
|
+
color: color.textSecondary,
|
|
219
|
+
textAlign: "center",
|
|
220
|
+
},
|
|
221
|
+
iconContainerStyle: {
|
|
222
|
+
marginBottom: spacing.margin.m5,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
errorStateStyle: {
|
|
226
|
+
containerStyle: {
|
|
227
|
+
flex: 1,
|
|
228
|
+
justifyContent: "center",
|
|
229
|
+
alignItems: "center",
|
|
230
|
+
paddingHorizontal: spacing.padding.p8,
|
|
231
|
+
},
|
|
232
|
+
titleStyle: {
|
|
233
|
+
...typography.heading2.bold,
|
|
234
|
+
color: color.textPrimary,
|
|
235
|
+
marginBottom: spacing.margin.m2,
|
|
236
|
+
textAlign: "center",
|
|
237
|
+
},
|
|
238
|
+
subtitleStyle: {
|
|
239
|
+
...typography.body.regular,
|
|
240
|
+
color: color.textSecondary,
|
|
241
|
+
textAlign: "center",
|
|
242
|
+
},
|
|
243
|
+
iconContainerStyle: {
|
|
244
|
+
marginBottom: spacing.margin.m5,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
resultsContainerStyle: {
|
|
248
|
+
flex: 1,
|
|
249
|
+
backgroundColor: color.background1,
|
|
250
|
+
},
|
|
251
|
+
sectionTitleStyle: {
|
|
252
|
+
...typography.caption1.medium,
|
|
253
|
+
color: color.textTertiary,
|
|
254
|
+
paddingTop: spacing.padding.p4,
|
|
255
|
+
},
|
|
256
|
+
seeMoreButtonStyle: {
|
|
257
|
+
paddingVertical: spacing.padding.p2,
|
|
258
|
+
alignItems: 'flex-start',
|
|
259
|
+
},
|
|
260
|
+
seeMoreTextStyle: {
|
|
261
|
+
...typography.body.medium,
|
|
262
|
+
color: color.primary,
|
|
263
|
+
},
|
|
264
|
+
conversationItemStyle: {
|
|
265
|
+
containerStyle: {
|
|
266
|
+
flexDirection: "row",
|
|
267
|
+
alignItems: "center",
|
|
268
|
+
paddingVertical: spacing.padding.p3,
|
|
269
|
+
},
|
|
270
|
+
contentStyle: {
|
|
271
|
+
flex: 1,
|
|
272
|
+
marginLeft: spacing.margin.m3,
|
|
273
|
+
},
|
|
274
|
+
titleStyle: {
|
|
275
|
+
...typography.heading4.medium,
|
|
276
|
+
color: color.textPrimary,
|
|
277
|
+
marginBottom: spacing.margin.m1,
|
|
278
|
+
},
|
|
279
|
+
subtitleStyle: {
|
|
280
|
+
...typography.body.regular,
|
|
281
|
+
color: color.textSecondary,
|
|
282
|
+
},
|
|
283
|
+
avatarStyle: getAvatarStyle(color, spacing, typography),
|
|
284
|
+
trailingContainerStyle: {
|
|
285
|
+
alignItems: "flex-end",
|
|
286
|
+
justifyContent: "flex-start",
|
|
287
|
+
marginLeft: spacing.margin.m2,
|
|
288
|
+
minHeight: spacing.spacing.s12,
|
|
289
|
+
},
|
|
290
|
+
badgeStyle: {
|
|
291
|
+
containerStyle: {
|
|
292
|
+
backgroundColor: color.primary,
|
|
293
|
+
borderRadius: spacing.radius.max,
|
|
294
|
+
minWidth: spacing.spacing.s5,
|
|
295
|
+
maxWidth: spacing.spacing.s12,
|
|
296
|
+
height: spacing.spacing.s5,
|
|
297
|
+
justifyContent: "center",
|
|
298
|
+
alignItems: "center",
|
|
299
|
+
paddingHorizontal: spacing.spacing.s1,
|
|
300
|
+
paddingVertical: spacing.spacing.s0_5,
|
|
301
|
+
alignSelf: "flex-end",
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
dateStyle: {},
|
|
305
|
+
},
|
|
306
|
+
messageItemStyle: {
|
|
307
|
+
containerStyle: {
|
|
308
|
+
flexDirection: "row",
|
|
309
|
+
alignItems: "center",
|
|
310
|
+
paddingVertical: spacing.padding.p3,
|
|
311
|
+
},
|
|
312
|
+
contentStyle: {
|
|
313
|
+
flex: 1,
|
|
314
|
+
maxWidth: '80%',
|
|
315
|
+
},
|
|
316
|
+
textContainerStyle: {
|
|
317
|
+
width: 328,
|
|
318
|
+
height: 80,
|
|
319
|
+
flex: 0,
|
|
320
|
+
},
|
|
321
|
+
titleStyle: {
|
|
322
|
+
...typography.caption1.medium,
|
|
323
|
+
color: color.textSecondary,
|
|
324
|
+
marginBottom: spacing.margin.m0_5,
|
|
325
|
+
},
|
|
326
|
+
subtitleStyle: {
|
|
327
|
+
...typography.body.regular,
|
|
328
|
+
color: color.textPrimary,
|
|
329
|
+
width: '90%',
|
|
330
|
+
},
|
|
331
|
+
iconContainerStyle: {
|
|
332
|
+
marginRight: spacing.margin.m3,
|
|
333
|
+
alignItems: "center",
|
|
334
|
+
justifyContent: "center",
|
|
335
|
+
},
|
|
336
|
+
trailingContainerStyle: {
|
|
337
|
+
alignItems: "flex-end",
|
|
338
|
+
justifyContent: "flex-start",
|
|
339
|
+
marginLeft: spacing.margin.m2,
|
|
340
|
+
minHeight: spacing.spacing.s12,
|
|
341
|
+
},
|
|
342
|
+
previewContainerStyle: {
|
|
343
|
+
width: 80,
|
|
344
|
+
height: 80,
|
|
345
|
+
position: "relative",
|
|
346
|
+
justifyContent: "center",
|
|
347
|
+
alignItems: "flex-end",
|
|
348
|
+
},
|
|
349
|
+
previewImageStyle: {
|
|
350
|
+
width: 80,
|
|
351
|
+
height: 80,
|
|
352
|
+
borderRadius: spacing.radius.r2,
|
|
353
|
+
backgroundColor: color.background3,
|
|
354
|
+
},
|
|
355
|
+
previewVideoStyle: {
|
|
356
|
+
width: 80,
|
|
357
|
+
height: 80,
|
|
358
|
+
borderRadius: spacing.radius.r2,
|
|
359
|
+
backgroundColor: color.background3,
|
|
360
|
+
overflow: "hidden",
|
|
361
|
+
},
|
|
362
|
+
videoPlayIconStyle: {
|
|
363
|
+
position: "absolute",
|
|
364
|
+
top: 28,
|
|
365
|
+
left: 28,
|
|
366
|
+
backgroundColor: "rgba(0,0,0,0.6)",
|
|
367
|
+
borderRadius: spacing.radius.r3,
|
|
368
|
+
width: spacing.spacing.s6,
|
|
369
|
+
height: spacing.spacing.s6,
|
|
370
|
+
justifyContent: "center",
|
|
371
|
+
alignItems: "center",
|
|
372
|
+
},
|
|
373
|
+
audioPreviewStyle: {
|
|
374
|
+
width: spacing.spacing.s12,
|
|
375
|
+
height: spacing.spacing.s12,
|
|
376
|
+
backgroundColor: color.background3,
|
|
377
|
+
borderRadius: spacing.radius.r2,
|
|
378
|
+
justifyContent: "center",
|
|
379
|
+
alignItems: "center",
|
|
380
|
+
},
|
|
381
|
+
filePreviewStyle: {
|
|
382
|
+
width: spacing.spacing.s12,
|
|
383
|
+
height: spacing.spacing.s12,
|
|
384
|
+
backgroundColor: color.background3,
|
|
385
|
+
borderRadius: spacing.radius.r2,
|
|
386
|
+
justifyContent: "center",
|
|
387
|
+
alignItems: "center",
|
|
388
|
+
},
|
|
389
|
+
linkPreviewImageStyle: {
|
|
390
|
+
width: spacing.spacing.s12,
|
|
391
|
+
height: spacing.spacing.s12,
|
|
392
|
+
borderRadius: spacing.radius.r2,
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
skeletonStyle: {
|
|
396
|
+
linearGradientColors: ["#E8E8E8", "#F5F5F5"] as [string, string],
|
|
397
|
+
shimmerBackgroundColor: color.staticBlack,
|
|
398
|
+
shimmerOpacity: 0.01,
|
|
399
|
+
speed: 1,
|
|
400
|
+
containerBackgroundColor: color.background1,
|
|
401
|
+
},
|
|
402
|
+
};
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
export const getSearchStyleDark = (
|
|
406
|
+
color: CometChatTheme["color"],
|
|
407
|
+
spacing: CometChatTheme["spacing"],
|
|
408
|
+
typography: CometChatTheme["typography"]
|
|
409
|
+
): DeepPartial<SearchStyle> => {
|
|
410
|
+
return deepMerge(getSearchStyleLight(color, spacing, typography), {
|
|
411
|
+
// Dark theme specific overrides can be added here if needed
|
|
412
|
+
// Currently, the light theme uses proper color tokens that adapt to dark mode
|
|
413
|
+
});
|
|
414
|
+
};
|