@cometchat/chat-uikit-react-native 5.2.8 → 5.2.9

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 (49) hide show
  1. package/package.json +1 -1
  2. package/src/CometChatConversations/CometChatConversations.tsx +8 -1
  3. package/src/CometChatGroups/CometChatGroups.tsx +5 -3
  4. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +55 -8
  5. package/src/CometChatMessageList/CometChatMessageList.tsx +1169 -548
  6. package/src/CometChatMessageList/components/MessageListItem.tsx +127 -0
  7. package/src/CometChatMessageList/components/MessageModals.tsx +60 -0
  8. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +130 -0
  9. package/src/CometChatMessageList/components/ReactionModals.tsx +70 -0
  10. package/src/CometChatUsers/CometChatUsers.tsx +4 -1
  11. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +27 -36
  12. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +13 -9
  13. package/src/shared/base/Types.ts +1 -0
  14. package/src/shared/constants/UIKitConstants.ts +1 -0
  15. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +4 -0
  16. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -1
  17. package/src/shared/events/conversations.ts +1 -0
  18. package/src/shared/framework/MessageDataSource.tsx +79 -17
  19. package/src/shared/index.ts +2 -0
  20. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +3 -1
  21. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +3 -1
  22. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +3 -1
  23. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +3 -1
  24. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +3 -1
  25. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +3 -1
  26. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +3 -1
  27. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +3 -1
  28. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +3 -1
  29. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +3 -1
  30. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +3 -1
  31. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +3 -1
  32. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +3 -1
  33. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +3 -1
  34. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +3 -1
  35. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +3 -1
  36. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +3 -1
  37. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +3 -1
  38. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +7 -4
  39. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +20 -12
  40. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +6 -3
  41. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +2 -1
  42. package/src/shared/views/CometChatList/CometChatList.tsx +20 -1
  43. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +2 -3
  44. package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +55 -0
  45. package/src/shared/views/CometChatNewMessageIndicator/index.ts +3 -0
  46. package/src/shared/views/CometChatNewMessageIndicator/styles.ts +33 -0
  47. package/src/shared/views/CometChatRetryButton/CometChatRetryButton.tsx +54 -0
  48. package/src/shared/views/CometChatRetryButton/index.ts +3 -0
  49. package/src/shared/views/index.ts +15 -0
@@ -0,0 +1,55 @@
1
+ import React, { useMemo } from "react";
2
+ import { Text, View } from "react-native";
3
+ import { useTheme } from "../../../theme";
4
+ import { deepMerge } from "../../helper/helperFunctions";
5
+ import { NewMessageIndicatorStyle, getNewMessageIndicatorStyle } from "./styles";
6
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
7
+
8
+ /**
9
+ * Props for the CometChatNewMessageIndicator component.
10
+ */
11
+ export interface CometChatNewMessageIndicatorInterface {
12
+ /**
13
+ * Custom styles for the new message indicator component.
14
+ */
15
+ style?: NewMessageIndicatorStyle;
16
+ /**
17
+ * Text to display in the indicator.
18
+ * Default: "New Messages"
19
+ */
20
+ text?: string;
21
+ /**
22
+ * Custom component to render instead of the default indicator.
23
+ */
24
+ NewMessageIndicatorView?: React.ComponentType<any>;
25
+ }
26
+
27
+ /**
28
+ * CometChatNewMessageIndicator is a component for displaying a "New Messages" separator.
29
+ *
30
+ * It renders a horizontal line with a text label in the center.
31
+ * The component is fully customizable via styles or by providing a custom view.
32
+ */
33
+ export const CometChatNewMessageIndicator = React.memo((props: CometChatNewMessageIndicatorInterface) => {
34
+ const { style = {}, text, NewMessageIndicatorView } = props;
35
+ const theme = useTheme();
36
+ const { t } = useCometChatTranslation();
37
+
38
+ // Merge default styles with any custom style overrides.
39
+ const indicatorStyles = useMemo(() => {
40
+ const defaultStyles = getNewMessageIndicatorStyle(theme);
41
+ return deepMerge(defaultStyles, style);
42
+ }, [theme, style]);
43
+
44
+ if (NewMessageIndicatorView) {
45
+ return <NewMessageIndicatorView {...props} />;
46
+ }
47
+
48
+ return (
49
+ <View style={indicatorStyles.containerStyle}>
50
+ <View style={indicatorStyles.lineStyle} />
51
+ <Text style={indicatorStyles.textStyle} numberOfLines={1}>{text || t("NEW")}</Text>
52
+ <View style={indicatorStyles.lineStyle} />
53
+ </View>
54
+ );
55
+ });
@@ -0,0 +1,3 @@
1
+ export { CometChatNewMessageIndicator } from "./CometChatNewMessageIndicator";
2
+ export type { CometChatNewMessageIndicatorInterface } from "./CometChatNewMessageIndicator";
3
+ export type { NewMessageIndicatorStyle } from "./styles";
@@ -0,0 +1,33 @@
1
+ import { StyleSheet, TextStyle, ViewStyle } from "react-native";
2
+ import { CometChatTheme } from "../../../theme/type";
3
+
4
+ export type NewMessageIndicatorStyle = {
5
+ containerStyle?: ViewStyle;
6
+ textStyle?: TextStyle;
7
+ lineStyle?: ViewStyle;
8
+ };
9
+
10
+ export const getNewMessageIndicatorStyle = (
11
+ theme: CometChatTheme
12
+ ): NewMessageIndicatorStyle => {
13
+ return StyleSheet.create({
14
+ containerStyle: {
15
+ flexDirection: "row",
16
+ alignItems: "center",
17
+ justifyContent: "center",
18
+ marginVertical: 8,
19
+ width: "100%",
20
+ },
21
+ textStyle: {
22
+ color: theme.color.error,
23
+ ...theme.typography.caption1.medium,
24
+ marginHorizontal: 8,
25
+ },
26
+ lineStyle: {
27
+ flex: 1,
28
+ height: 1,
29
+ backgroundColor: theme.color.error,
30
+ opacity: 0.5,
31
+ },
32
+ });
33
+ };
@@ -0,0 +1,54 @@
1
+ import React from "react";
2
+ import { Text, TouchableOpacity } from "react-native";
3
+ import { useTheme } from "../../../theme";
4
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
5
+
6
+ /**
7
+ * Props for the CometChatRetryButton component.
8
+ */
9
+ export interface CometChatRetryButtonProps {
10
+ /**
11
+ * Callback function to execute when the retry button is pressed.
12
+ */
13
+ onPress: () => void;
14
+ }
15
+
16
+ /**
17
+ * CometChatRetryButton is a reusable component that renders a styled retry button.
18
+ * It is commonly used in error states to allow users to retry failed operations.
19
+ *
20
+ * @param props - The props for the component.
21
+ * @returns The rendered retry button element.
22
+ */
23
+ export const CometChatRetryButton = (props: CometChatRetryButtonProps) => {
24
+ const { onPress } = props;
25
+ const theme = useTheme();
26
+ const { t } = useCometChatTranslation();
27
+
28
+ const retryText = t("RETRY");
29
+
30
+ return (
31
+ <TouchableOpacity
32
+ onPress={onPress}
33
+ accessibilityRole='button'
34
+ accessibilityLabel={retryText}
35
+ style={{
36
+ backgroundColor: theme.color.primary,
37
+ paddingVertical: theme.spacing.spacing.s3,
38
+ paddingHorizontal: theme.spacing.spacing.s10,
39
+ borderRadius: theme.spacing.radius.r2,
40
+ marginTop: theme.spacing.spacing.s5,
41
+ }}
42
+ >
43
+ <Text
44
+ style={{
45
+ color: theme.color.primaryButtonIcon,
46
+ ...theme.typography.button.medium,
47
+ }}
48
+ >
49
+ {retryText}
50
+ </Text>
51
+ </TouchableOpacity>
52
+ );
53
+ };
54
+
@@ -0,0 +1,3 @@
1
+ export { CometChatRetryButton } from "./CometChatRetryButton";
2
+ export type { CometChatRetryButtonProps } from "./CometChatRetryButton";
3
+
@@ -70,6 +70,10 @@ import {
70
70
  CometChatReactions,
71
71
  CometChatReactionsInterface,
72
72
  } from "./CometChatReactions";
73
+ import {
74
+ CometChatRetryButton,
75
+ CometChatRetryButtonProps,
76
+ } from "./CometChatRetryButton";
73
77
 
74
78
  import { CometChatEmojiKeyboard } from "./CometChatEmojiKeyboard";
75
79
 
@@ -86,6 +90,12 @@ import {
86
90
  CometChatReportDialogInterface,
87
91
  } from "./CometChatReportDialog";
88
92
 
93
+ import {
94
+ CometChatNewMessageIndicator,
95
+ CometChatNewMessageIndicatorInterface,
96
+ NewMessageIndicatorStyle,
97
+ } from "./CometChatNewMessageIndicator";
98
+
89
99
  export type {
90
100
  CometChatConfirmDialogInterface,
91
101
  CometChatReportDialogInterface,
@@ -102,10 +112,12 @@ export type {
102
112
  CometChatMessageInputInterface,
103
113
  CometChatReactionListInterface,
104
114
  CometChatReactionsInterface,
115
+ CometChatRetryButtonProps,
105
116
  CometChatStatusIndicatorInterface,
106
117
  CometChatSuggestionListInterface,
107
118
  CometChatVideoBubbleInterface,
108
119
  CometChatTextBubbleInterface,
120
+ CometChatNewMessageIndicatorInterface,
109
121
  };
110
122
 
111
123
  export {
@@ -127,11 +139,13 @@ export {
127
139
  CometChatQuickReactions,
128
140
  CometChatReactionList,
129
141
  CometChatReactions,
142
+ CometChatRetryButton,
130
143
  CometChatStatusIndicator,
131
144
  CometChatSuggestionList,
132
145
  CometChatTextBubble,
133
146
  CometChatVideoBubble,
134
147
  SuggestionItem,
148
+ CometChatNewMessageIndicator,
135
149
  };
136
150
 
137
151
 
@@ -140,4 +154,5 @@ export type {
140
154
  CometChatListProps,
141
155
  DateStyle,
142
156
  MenuItemInterface,
157
+ NewMessageIndicatorStyle,
143
158
  };