@cometchat/chat-uikit-react-native 5.2.3 → 5.2.4

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.
Files changed (75) hide show
  1. package/package.json +1 -1
  2. package/src/CometChatConversations/CometChatConversations.tsx +167 -86
  3. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +312 -116
  4. package/src/CometChatMessageComposer/styles.tsx +2 -1
  5. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +83 -17
  6. package/src/CometChatMessageList/CometChatMessageList.tsx +549 -70
  7. package/src/CometChatMessageList/style.ts +4 -2
  8. package/src/CometChatSearch/CometChatSearch.tsx +1718 -0
  9. package/src/CometChatSearch/SearchConstants.ts +46 -0
  10. package/src/CometChatSearch/Skeleton.tsx +192 -0
  11. package/src/CometChatSearch/index.ts +1 -0
  12. package/src/CometChatSearch/style.ts +414 -0
  13. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +43 -7
  14. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +45 -7
  15. package/src/extensions/Polls/Polls.tsx +36 -2
  16. package/src/extensions/Polls/PollsBubble.tsx +13 -9
  17. package/src/extensions/Polls/PollsDecorator.tsx +13 -1
  18. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +50 -11
  19. package/src/extensions/Stickers/style.ts +0 -1
  20. package/src/index.ts +5 -0
  21. package/src/shared/base/Types.ts +8 -0
  22. package/src/shared/constants/UIKitConstants.ts +2 -0
  23. package/src/shared/events/CometChatMessageEvents/index.ts +8 -7
  24. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -0
  25. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +158 -27
  26. package/src/shared/framework/DataSource.ts +7 -0
  27. package/src/shared/framework/DataSourceDecorator.tsx +12 -0
  28. package/src/shared/framework/MessageDataSource.tsx +182 -1
  29. package/src/shared/helper/functions.js +0 -67
  30. package/src/shared/helper/helperFunctions.ts +73 -0
  31. package/src/shared/icons/components/documents.tsx +23 -0
  32. package/src/shared/icons/components/empty-search.tsx +52 -0
  33. package/src/shared/icons/components/message-blocked.tsx +1 -1
  34. package/src/shared/icons/components/unread.tsx +29 -0
  35. package/src/shared/icons/icon-mapping.tsx +7 -0
  36. package/src/shared/index.ts +2 -1
  37. package/src/shared/modals/CometChatMessageTemplate.ts +23 -0
  38. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +4 -4
  39. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +17 -1
  40. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +70 -34
  41. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +60 -24
  42. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +37 -1
  43. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +60 -24
  44. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +37 -1
  45. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +37 -1
  46. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +37 -1
  47. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +37 -1
  48. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +40 -4
  49. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +37 -1
  50. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +37 -1
  51. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +37 -1
  52. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +37 -1
  53. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +38 -2
  54. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +37 -1
  55. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +37 -1
  56. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +40 -4
  57. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +274 -23
  58. package/src/shared/utils/MessageUtils.tsx +0 -1
  59. package/src/shared/views/CometChatAudioBubble/style.ts +0 -2
  60. package/src/shared/views/CometChatFileBubble/style.ts +0 -4
  61. package/src/shared/views/CometChatImageBubble/CometChatImageLoader.tsx +1 -0
  62. package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
  63. package/src/shared/views/CometChatList/Header.tsx +79 -49
  64. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
  65. package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +390 -0
  66. package/src/shared/views/CometChatReportDialog/index.ts +3 -0
  67. package/src/shared/views/CometChatReportDialog/style.ts +164 -0
  68. package/src/shared/views/CometChatStatusIndicator/private.png +0 -0
  69. package/src/shared/views/CometChatStatusIndicator/protected.png +0 -0
  70. package/src/shared/views/CometChatStatusIndicator/styles.ts +2 -2
  71. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +18 -2
  72. package/src/shared/views/index.ts +6 -0
  73. package/src/theme/default/default.ts +3 -0
  74. package/src/theme/provider.tsx +7 -5
  75. package/src/theme/type.ts +2 -0
@@ -0,0 +1,390 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import {
3
+ Modal,
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ TextInput,
9
+ StyleProp,
10
+ ViewStyle,
11
+ TextStyle,
12
+ KeyboardAvoidingView,
13
+ Platform,
14
+ ScrollView,
15
+ } from "react-native";
16
+ import { useTheme } from "../../../theme";
17
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
18
+ import { Icon } from "../../icons/Icon";
19
+ import { CometChat } from "@cometchat/chat-sdk-react-native";
20
+ import { useKeyboard } from "../../helper/useKeyboard";
21
+
22
+ export interface CometChatReportDialogInterface {
23
+ /** Controls modal visibility */
24
+ isOpen?: boolean;
25
+ /** Message object to be flagged */
26
+ message?: CometChat.BaseMessage;
27
+ /** Hide remark input field */
28
+ hideFlagRemarkField?: boolean;
29
+ /** Callback for cancel */
30
+ onCancel?: () => void;
31
+ /** Modal dismiss callback */
32
+ onDismiss?: () => void;
33
+ /** Optional custom handler after successful flag (receives SDK payload incl. original message) */
34
+ onReport?: (payload: {
35
+ message: CometChat.BaseMessage;
36
+ reason: CometChat.FlagReason;
37
+ description: string;
38
+ }) => void | Promise<void>;
39
+ /** Override reasons instead of fetching (mainly for testing) */
40
+ reasons?: CometChat.FlagReason[];
41
+ /** Text overrides / translations */
42
+ titleText?: string;
43
+ messageText?: string;
44
+ descriptionPlaceholder?: string;
45
+ cancelButtonText?: string;
46
+ reportButtonText?: string;
47
+ /** Styling overrides */
48
+ containerStyle?: StyleProp<ViewStyle>;
49
+ titleContainerStyle?: StyleProp<ViewStyle>;
50
+ titleTextStyle?: StyleProp<TextStyle>;
51
+ messageTextStyle?: StyleProp<TextStyle>;
52
+ pillsContainerStyle?: StyleProp<ViewStyle>;
53
+ pillStyle?: StyleProp<ViewStyle>;
54
+ pillTextStyle?: StyleProp<TextStyle>;
55
+ textInputContainerStyle?: StyleProp<ViewStyle>;
56
+ sectionTitle?: StyleProp<TextStyle>;
57
+ descriptionTextStyle?: StyleProp<TextStyle>;
58
+ buttonContainerStyle?: StyleProp<ViewStyle>;
59
+ cancelButtonStyle?: StyleProp<ViewStyle>;
60
+ cancelButtonTextStyle?: StyleProp<TextStyle>;
61
+ reportButtonStyle?: StyleProp<ViewStyle>;
62
+ reportButtonTextStyle?: StyleProp<TextStyle>;
63
+ /** Error callback */
64
+ onError?: (error: CometChat.CometChatException) => void;
65
+ }
66
+
67
+ export const CometChatReportDialog = (props: CometChatReportDialogInterface) => {
68
+ const { t } = useCometChatTranslation();
69
+ const keyboardHeight = useKeyboard();
70
+ const {
71
+ isOpen,
72
+ message,
73
+ hideFlagRemarkField = false,
74
+ onCancel,
75
+ onDismiss = () => null,
76
+ onReport,
77
+ reasons,
78
+ titleText = t("Flag_Message_Title"),
79
+ messageText = t("Flag_Message_Subtitle"),
80
+ descriptionPlaceholder = t("Flag_Message_Remark_Placeholder"),
81
+ cancelButtonText = t("Flag_Message_Confirm_No"),
82
+ reportButtonText = t("Flag_Message_Confirm_Yes"),
83
+ containerStyle = {},
84
+ titleContainerStyle = {},
85
+ titleTextStyle = {},
86
+ messageTextStyle = {},
87
+ pillsContainerStyle = {},
88
+ pillStyle = {},
89
+ pillTextStyle = {},
90
+ buttonContainerStyle = {},
91
+ textInputContainerStyle = {},
92
+ sectionTitle = {},
93
+ descriptionTextStyle = {},
94
+ cancelButtonStyle = {},
95
+ cancelButtonTextStyle = {},
96
+ reportButtonStyle = {},
97
+ reportButtonTextStyle = {},
98
+ onError,
99
+ } = props;
100
+
101
+ const theme = useTheme();
102
+ const [flagReasons, setFlagReasons] = useState<CometChat.FlagReason[]>(reasons || []);
103
+ const [isFetchingReasons, setIsFetchingReasons] = useState<boolean>(false);
104
+ const [selectedReason, setSelectedReason] = useState<CometChat.FlagReason | null>(null);
105
+ const [description, setDescription] = useState<string>("");
106
+ const [errorMessage, setErrorMessage] = useState<string>("");
107
+ const [isSubmitting, setIsSubmitting] = useState<boolean>(false);
108
+ const [errorTimeoutId, setErrorTimeoutId] = useState<ReturnType<typeof setTimeout> | null>(null);
109
+ const [isTextInputFocused, setIsTextInputFocused] = useState<boolean>(false);
110
+
111
+ const resetStates = () => {
112
+ setSelectedReason(null);
113
+ setDescription("");
114
+ setErrorMessage("");
115
+ setIsSubmitting(false);
116
+ };
117
+
118
+ useEffect(() => {
119
+ if (isOpen && !reasons) {
120
+ (async () => {
121
+ try {
122
+ setIsFetchingReasons(true);
123
+ const list = await CometChat.getFlagReasons();
124
+ setFlagReasons(list);
125
+ } catch (e: any) {
126
+ onError?.(e);
127
+ showError(t("Flag_Error_Text"));
128
+ } finally {
129
+ setIsFetchingReasons(false);
130
+ }
131
+ })();
132
+ } else if (reasons) {
133
+ setFlagReasons(reasons);
134
+ }
135
+ if (!isOpen) {
136
+ resetStates();
137
+ }
138
+ }, [isOpen, reasons, onError, t]);
139
+
140
+ const handleCancel = () => {
141
+ resetStates();
142
+ onCancel?.();
143
+ };
144
+
145
+ const showError = (message: string) => {
146
+ // Clear any existing timer
147
+ if (errorTimeoutId) {
148
+ clearTimeout(errorTimeoutId);
149
+ }
150
+ setErrorMessage(message);
151
+ const id = setTimeout(() => {
152
+ setErrorMessage("");
153
+ }, 3500); // auto clear after 3.5 seconds
154
+ setErrorTimeoutId(id);
155
+ };
156
+
157
+ const handleReport = async () => {
158
+ // Validation: missing reason
159
+ if (!selectedReason) {
160
+ return;
161
+ }
162
+ if (!message) {
163
+ showError(t("Flag_Error_Text"));
164
+ return;
165
+ }
166
+ setIsSubmitting(true);
167
+ try {
168
+ // Trim remark length (max 100 similar to web)
169
+ const remark = description.trim().substring(0, 100);
170
+ const messageId = String((message as any).getId?.() ?? "");
171
+ if (!messageId) {
172
+ throw new Error("Invalid message id");
173
+ }
174
+ // SDK call
175
+ const sdkResult = await CometChat.flagMessage(messageId, {
176
+ reasonId: selectedReason.id,
177
+ remark: remark.trim().length > 0 ? remark.trim() : undefined,
178
+ });
179
+ console.log("[ReportDialog] flagMessage() success:", sdkResult);
180
+ // Fire optional external callback
181
+ const result = onReport?.({ message, reason: selectedReason, description: remark });
182
+ if (result && typeof (result as Promise<any>).then === "function") {
183
+ await (result as Promise<any>);
184
+ }
185
+ // Show success toast then auto-close after 3s
186
+ setErrorMessage("");
187
+ } catch (e: any) {
188
+ onError?.(e);
189
+ showError(t("Flag_Error_Text"));
190
+ console.log("[ReportDialog] flagMessage() error:", e);
191
+ } finally {
192
+ setIsSubmitting(false);
193
+ }
194
+ };
195
+
196
+ useEffect(() => {
197
+ return () => {
198
+ if (errorTimeoutId) clearTimeout(errorTimeoutId);
199
+ };
200
+ }, [errorTimeoutId]);
201
+
202
+ return (
203
+ <Modal
204
+ animationType='fade'
205
+ transparent
206
+ visible={isOpen}
207
+ onRequestClose={handleCancel}
208
+ onDismiss={onDismiss}
209
+ >
210
+ <KeyboardAvoidingView
211
+ style={styles.keyboardAvoidingView}
212
+ behavior={Platform.OS === "ios" ? "padding" : "height"}
213
+ >
214
+ <ScrollView
215
+ contentContainerStyle={[
216
+ styles.wrapper,
217
+ (keyboardHeight > 0 || isTextInputFocused) && styles.wrapperWithKeyboard,
218
+ ]}
219
+ keyboardShouldPersistTaps='handled'
220
+ showsVerticalScrollIndicator={false}
221
+ >
222
+ <View style={[theme.reportDialogStyles.containerStyle, containerStyle]}>
223
+ <View style={[theme.reportDialogStyles.titleContainerStyle, titleContainerStyle]}>
224
+ <View style={{ flexDirection: "row", justifyContent: "space-between" }}>
225
+ <Text style={[theme.reportDialogStyles.titleTextStyle, titleTextStyle]}>
226
+ {titleText}
227
+ </Text>
228
+ <TouchableOpacity
229
+ onPress={(e) => {
230
+ e.stopPropagation();
231
+ handleCancel();
232
+ }}
233
+ >
234
+ <Icon name='close' size={24} color={theme.color.iconPrimary} />
235
+ </TouchableOpacity>
236
+ </View>
237
+ <Text style={[theme.reportDialogStyles.messageTextStyle, messageTextStyle]}>
238
+ {messageText}
239
+ </Text>
240
+ </View>
241
+
242
+ <View style={[theme.reportDialogStyles.pillsContainerStyle, pillsContainerStyle]}>
243
+ {isFetchingReasons && (
244
+ <Text style={[theme.reportDialogStyles.messageTextStyle, { marginBottom: 8 }]}>
245
+ {"Loading..."}
246
+ </Text>
247
+ )}
248
+ {!isFetchingReasons &&
249
+ flagReasons.map((r) => {
250
+ const active = r.id === selectedReason?.id;
251
+ return (
252
+ <TouchableOpacity
253
+ key={r.id}
254
+ disabled={isSubmitting}
255
+ onPress={(e) => {
256
+ e.stopPropagation();
257
+ // Toggle selection: if already selected, deselect
258
+ setSelectedReason((prev) => (prev?.id === r.id ? null : r));
259
+ setErrorMessage("");
260
+ }}
261
+ style={[
262
+ theme.reportDialogStyles.pillsStyle,
263
+ {
264
+ backgroundColor: active
265
+ ? theme.color.extendedPrimary100
266
+ : theme.color.background1,
267
+ borderColor: active
268
+ ? theme.color.extendedPrimary200
269
+ : theme.color.borderDefault,
270
+ opacity: isSubmitting ? 0.6 : 1,
271
+ },
272
+ pillStyle,
273
+ ]}
274
+ >
275
+ <Text
276
+ numberOfLines={2}
277
+ style={[
278
+ theme.reportDialogStyles.pillsTextStyle,
279
+ pillTextStyle,
280
+ {
281
+ color: active ? theme.color.textHighlight : theme.color.textPrimary,
282
+ },
283
+ ]}
284
+ >
285
+ {r.name}
286
+ </Text>
287
+ </TouchableOpacity>
288
+ );
289
+ })}
290
+ </View>
291
+
292
+ {!hideFlagRemarkField && (
293
+ <View
294
+ style={[theme.reportDialogStyles.textInputContainerStyle, textInputContainerStyle]}
295
+ >
296
+ <Text style={[theme.reportDialogStyles.sectionTitle, sectionTitle]}>
297
+ {t("Flag_Message_Remark_Label")}{" "}
298
+ <Text style={{ color: theme.color.textTertiary }}>
299
+ ({t("Flag_Message_Remark_Optional")})
300
+ </Text>
301
+ </Text>
302
+ <View>
303
+ <TextInput
304
+ placeholder={descriptionPlaceholder}
305
+ placeholderTextColor={theme.color.textTertiary}
306
+ multiline
307
+ value={description}
308
+ onFocus={() => setIsTextInputFocused(true)}
309
+ onBlur={() => setIsTextInputFocused(false)}
310
+ onChangeText={(val) => setDescription(val.substring(0, 100))}
311
+ editable={!isSubmitting}
312
+ style={[theme.reportDialogStyles.descriptionTextStyle, descriptionTextStyle]}
313
+ />
314
+ </View>
315
+ </View>
316
+ )}
317
+
318
+ {!!errorMessage && (
319
+ <Text style={{ color: theme.color.error, marginBottom: 16 }}>{errorMessage}</Text>
320
+ )}
321
+
322
+ <View style={[theme.reportDialogStyles.buttonContainer, buttonContainerStyle]}>
323
+ <TouchableOpacity
324
+ style={[theme.reportDialogStyles.cancelButtonStyle, cancelButtonStyle]}
325
+ disabled={isSubmitting}
326
+ onPress={(e) => {
327
+ e.stopPropagation();
328
+ handleCancel();
329
+ }}
330
+ >
331
+ <Text
332
+ numberOfLines={1}
333
+ style={[theme.reportDialogStyles.cancelButtonTextStyle, cancelButtonTextStyle]}
334
+ >
335
+ {cancelButtonText}
336
+ </Text>
337
+ </TouchableOpacity>
338
+ <TouchableOpacity
339
+ style={[
340
+ theme.reportDialogStyles.confirmButtonStyle,
341
+ {
342
+ backgroundColor:
343
+ !selectedReason || isSubmitting
344
+ ? theme.color.background4
345
+ : theme.color.primary,
346
+ opacity: isSubmitting ? 0.7 : 1,
347
+ },
348
+ reportButtonStyle,
349
+ ]}
350
+ // Allow press even if no reason to surface error
351
+ disabled={!selectedReason || isSubmitting}
352
+ onPress={(e) => {
353
+ e.stopPropagation();
354
+ handleReport();
355
+ }}
356
+ >
357
+ <Text
358
+ numberOfLines={1}
359
+ style={[theme.reportDialogStyles.confirmButtonTextStyle, reportButtonTextStyle]}
360
+ >
361
+ {reportButtonText}
362
+ </Text>
363
+ </TouchableOpacity>
364
+ </View>
365
+ </View>
366
+ </ScrollView>
367
+ </KeyboardAvoidingView>
368
+ </Modal>
369
+ );
370
+ };
371
+
372
+ const styles = StyleSheet.create({
373
+ keyboardAvoidingView: {
374
+ flex: 1,
375
+ },
376
+ wrapper: {
377
+ flexGrow: 1,
378
+ justifyContent: "center",
379
+ alignItems: "center",
380
+ backgroundColor: "#141414CC",
381
+ paddingHorizontal: 20,
382
+ minHeight: "100%",
383
+ },
384
+ wrapperWithKeyboard: {
385
+ justifyContent: "flex-start",
386
+ paddingTop: Platform.OS === "ios" ? 50 : 20,
387
+ },
388
+ });
389
+
390
+ export default CometChatReportDialog;
@@ -0,0 +1,3 @@
1
+ import { CometChatReportDialog, CometChatReportDialogInterface } from "./CometChatReportDialog";
2
+ export { CometChatReportDialog };
3
+ export type { CometChatReportDialogInterface };
@@ -0,0 +1,164 @@
1
+ import { StyleSheet, TextStyle, ViewStyle } from "react-native";
2
+ import { CometChatTheme } from "../../../theme/type";
3
+ import { deepMerge } from "../../helper/helperFunctions";
4
+
5
+ export type ReportDialogStyle = {
6
+ containerStyle: ViewStyle;
7
+ titleContainerStyle: ViewStyle;
8
+ titleTextStyle: TextStyle;
9
+ messageTextStyle: TextStyle;
10
+ pillsContainerStyle: ViewStyle;
11
+ pillsStyle: ViewStyle;
12
+ pillsTextStyle: TextStyle;
13
+ textInputContainerStyle: ViewStyle;
14
+ sectionTitle: TextStyle;
15
+ descriptionTextStyle: TextStyle;
16
+ buttonContainer: ViewStyle;
17
+ cancelButtonStyle: ViewStyle;
18
+ cancelButtonTextStyle: TextStyle;
19
+ confirmButtonStyle: ViewStyle;
20
+ confirmButtonTextStyle: TextStyle;
21
+ };
22
+
23
+ export const getReportDialogStyleLight = (
24
+ color: CometChatTheme["color"],
25
+ spacing: CometChatTheme["spacing"],
26
+ typography: CometChatTheme["typography"]
27
+ ): ReportDialogStyle => {
28
+ return StyleSheet.create({
29
+ containerStyle: {
30
+ backgroundColor: color.background1,
31
+ width: "100%",
32
+ padding: 24,
33
+ maxWidth: 500,
34
+ borderRadius: 16,
35
+ borderColor: color.borderDark,
36
+ shadowColor: "#000",
37
+ shadowOpacity: 0.12,
38
+ shadowRadius: 16,
39
+ shadowOffset: { width: 0, height: 6 },
40
+ elevation: 6,
41
+ },
42
+ titleContainerStyle: {
43
+ borderBottomColor: color.borderLight,
44
+ borderBottomWidth: 1,
45
+ paddingBottom: 16,
46
+ marginBottom: 16,
47
+ gap: 8,
48
+ },
49
+ titleTextStyle: {
50
+ color: color.textPrimary,
51
+ ...typography.heading2.bold,
52
+ },
53
+ messageTextStyle: {
54
+ color: color.textSecondary,
55
+ ...typography.button.regular,
56
+ },
57
+ pillsContainerStyle: {
58
+ width: "100%",
59
+ marginBottom: 16,
60
+ flexDirection: "row",
61
+ flexWrap: "wrap",
62
+ },
63
+ pillsStyle: {
64
+ borderWidth: 1,
65
+ borderRadius: 24,
66
+ borderColor: color.borderDefault,
67
+ paddingVertical: 10,
68
+ paddingHorizontal: 16,
69
+ marginBottom: 8,
70
+ marginRight: 8,
71
+ },
72
+ pillsTextStyle: {
73
+ color: color.textPrimary,
74
+ ...typography.button.regular,
75
+ },
76
+ textInputContainerStyle: {
77
+ width: "100%",
78
+ marginBottom: 24,
79
+ },
80
+ sectionTitle: {
81
+ ...typography.body.medium,
82
+ color: color.textPrimary,
83
+ marginBottom: 8,
84
+ },
85
+ descriptionTextStyle: {
86
+ borderWidth: 1,
87
+ borderRadius: 12,
88
+ minHeight: 100,
89
+ padding: 12,
90
+ textAlignVertical: "top",
91
+ maxHeight: 100,
92
+ borderColor: color.borderLight,
93
+ color: color.textPrimary,
94
+ ...typography.body.regular,
95
+ },
96
+ buttonContainer: {
97
+ flexDirection: "row",
98
+ width: "100%",
99
+ gap: 12,
100
+ },
101
+ cancelButtonStyle: {
102
+ flex: 1,
103
+ borderRadius: spacing.radius.r2,
104
+ height: 40,
105
+ backgroundColor: color.background1,
106
+ justifyContent: "center",
107
+ alignItems: "center",
108
+ borderWidth: 1,
109
+ borderColor: color.borderDark,
110
+ },
111
+ cancelButtonTextStyle: {
112
+ color: color.textPrimary,
113
+ ...typography.button.medium,
114
+ paddingHorizontal: 6,
115
+ textAlign: "center",
116
+ },
117
+ confirmButtonStyle: {
118
+ flex: 1,
119
+ backgroundColor: color.error,
120
+ borderRadius: spacing.radius.r2,
121
+ height: 40,
122
+ justifyContent: "center",
123
+ alignItems: "center",
124
+ },
125
+ confirmButtonTextStyle: {
126
+ color: color.primaryButtonIcon,
127
+ paddingHorizontal: 6,
128
+ textAlign: "center",
129
+ ...typography.button.medium,
130
+ },
131
+ });
132
+ };
133
+
134
+ export const getReportDialogStyleDark = (
135
+ color: CometChatTheme["color"],
136
+ spacing: CometChatTheme["spacing"],
137
+ typography: CometChatTheme["typography"]
138
+ ): ReportDialogStyle => {
139
+ return <ReportDialogStyle>(
140
+ deepMerge(getReportDialogStyleLight(color, spacing, typography), {
141
+ containerStyle: {
142
+ backgroundColor: color.background2,
143
+ },
144
+ titleTextStyle: {
145
+ color: color.textPrimary,
146
+ },
147
+ messageTextStyle: {
148
+ color: color.textSecondary,
149
+ },
150
+ cancelButtonStyle: {
151
+ borderColor: color.borderDark,
152
+ },
153
+ cancelButtonTextStyle: {
154
+ color: color.textPrimary,
155
+ },
156
+ confirmButtonStyle: {
157
+ backgroundColor: color.error,
158
+ },
159
+ confirmButtonTextStyle: {
160
+ color: color.primaryButtonIcon,
161
+ },
162
+ })
163
+ );
164
+ };
@@ -37,7 +37,7 @@ export const getStatusIndicatorStyles = (
37
37
  borderRadius: spacing.radius.max,
38
38
  borderWidth: spacing.spacing.s0_5,
39
39
  borderColor: color.background1,
40
- backgroundColor: color.success,
40
+ backgroundColor: color.warning,
41
41
  justifyContent: "center",
42
42
  alignItems: "center",
43
43
  },
@@ -52,7 +52,7 @@ export const getStatusIndicatorStyles = (
52
52
  borderColor: color.background1,
53
53
  justifyContent: "center",
54
54
  alignItems: "center",
55
- backgroundColor: color.warning,
55
+ backgroundColor: color.success,
56
56
  },
57
57
  imageStylePrivate: { width: spacing.spacing.s2, height: spacing.spacing.s2 },
58
58
  imageStyleProtected: { width: spacing.spacing.s2, height: spacing.spacing.s2 },
@@ -1,9 +1,11 @@
1
1
  import React, { useEffect, useState } from "react";
2
- import { ActivityIndicator, FlatList, ListRenderItemInfo, View } from "react-native";
2
+ import { ActivityIndicator, FlatList, ListRenderItemInfo, View, Text } from "react-native";
3
3
  import { CometChatListItem } from "../CometChatListItem";
4
4
  import { SuggestionItem } from "./SuggestionItem";
5
5
  import { SuggestionListStyle } from "../../../theme/type";
6
6
  import { Skeleton } from "./Skeleton";
7
+ import { useTheme } from "../../../theme";
8
+ import { useCometChatTranslation } from "../..";
7
9
 
8
10
  /**
9
11
  * Props for the CometChatSuggestionList component.
@@ -39,6 +41,8 @@ export interface CometChatSuggestionListInterface {
39
41
 
40
42
  export const CometChatSuggestionList = (props: CometChatSuggestionListInterface) => {
41
43
  const { data, listStyle, onPress, onEndReached, loading } = props;
44
+ const theme = useTheme();
45
+ const { t } = useCometChatTranslation();
42
46
 
43
47
  const [initialLoad, setInitialLoad] = useState(true);
44
48
 
@@ -50,11 +54,23 @@ export const CometChatSuggestionList = (props: CometChatSuggestionListInterface)
50
54
 
51
55
  const _render = ({ item, index }: ListRenderItemInfo<SuggestionItem>) => {
52
56
  let shouldLoadAvatarName = item.hideLeadingIcon ? {} : { avatarName: item.name };
57
+ const isAllAlias = item.underlyingText?.startsWith?.('<@all:');
58
+ const TitleView = isAllAlias ? (
59
+ <Text
60
+ numberOfLines={1}
61
+ ellipsizeMode='tail'
62
+ style={[listStyle?.listItemStyle.titleStyle, { flexShrink: 1 }]}
63
+ >
64
+ <Text style={[listStyle?.listItemStyle.titleStyle, { fontWeight: '700' }]}>@{item.name} </Text>
65
+ <Text style={[theme.typography.caption1.regular, { opacity: 0.7 }]}>{t('MESSAGE_COMPOSER_MENTION_NOTIFY_EVERYONE_LABEL')}</Text>
66
+ </Text>
67
+ ) : undefined;
53
68
  return (
54
69
  <CometChatListItem
55
70
  key={index}
56
71
  id={item.id}
57
- title={item.name}
72
+ title={isAllAlias ? undefined : item.name}
73
+ TitleView={TitleView}
58
74
  avatarURL={item.leadingIconUrl ? { uri: item.leadingIconUrl } : undefined}
59
75
  containerStyle={listStyle?.listItemStyle.containerStyle}
60
76
  titleStyle={listStyle?.listItemStyle.titleStyle}
@@ -81,9 +81,14 @@ import {
81
81
  import { CometChatAvatar } from "./CometChatAvatar";
82
82
  import { BadgeStyle, CometChatBadge } from "./CometChatBadge";
83
83
  import { MenuItemInterface } from "./CometChatTooltipMenu";
84
+ import {
85
+ CometChatReportDialog,
86
+ CometChatReportDialogInterface,
87
+ } from "./CometChatReportDialog";
84
88
 
85
89
  export type {
86
90
  CometChatConfirmDialogInterface,
91
+ CometChatReportDialogInterface,
87
92
  CometChatDateInterface,
88
93
  CometChatFileBubbleInterface,
89
94
  CometChatImageBubbleInterface,
@@ -110,6 +115,7 @@ export {
110
115
  CometChatBadge,
111
116
  CometChatBottomSheet,
112
117
  CometChatConfirmDialog,
118
+ CometChatReportDialog,
113
119
  CometChatDate,
114
120
  CometChatEmojiKeyboard,
115
121
  CometChatFileBubble,
@@ -55,6 +55,7 @@ import { defaultTypography } from "./typography";
55
55
  import { DeepPartial } from "../../shared/helper/types";
56
56
  import { getMediaRecorderStyle } from "../../shared/views/CometChatMediaRecorder/style";
57
57
  import { getDateSeparatorStyleDark, getDateSeparatorStyleLight } from "../../shared/views/CometChatDateSeperator";
58
+ import { getReportDialogStyleDark, getReportDialogStyleLight } from "../../shared/views/CometChatReportDialog/style";
58
59
 
59
60
  const getActionSheetStyle = (
60
61
  color: CometChatTheme["color"],
@@ -130,6 +131,7 @@ export const lightThemeMaker = (
130
131
  dateSeparatorStyles: getDateSeparatorStyleLight(color, spacing, typography),
131
132
  conversationStyles: getConversationStyleLight(color, spacing, typography),
132
133
  confirmDialogStyles: getConfirmDialogStyleLight(color, spacing, typography),
134
+ reportDialogStyles: getReportDialogStyleLight(color, spacing, typography),
133
135
  messageHeaderStyles: getMessageHeaderStyle(color, spacing, typography),
134
136
  messageComposerStyles: getComposerStyle(color, spacing, typography),
135
137
  userStyles: getUserListStyleLight(color, spacing, typography),
@@ -170,6 +172,7 @@ export const darkThemeMaker = (
170
172
  dateSeparatorStyles: getDateSeparatorStyleDark(color, spacing, typography),
171
173
  conversationStyles: getConversationStyleDark(color, spacing, typography),
172
174
  confirmDialogStyles: getConfirmDialogStyleDark(color, spacing, typography),
175
+ reportDialogStyles: getReportDialogStyleDark(color, spacing, typography),
173
176
  messageHeaderStyles: getMessageHeaderStyle(color, spacing, typography),
174
177
  messageComposerStyles: getComposerStyle(color, spacing, typography),
175
178
  userStyles: getUserListStyleDark(color, spacing, typography),