@cometchat/chat-uikit-react-native 5.2.7 → 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 (56) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/package.json +1 -1
  7. package/src/CometChatConversations/CometChatConversations.tsx +8 -1
  8. package/src/CometChatGroups/CometChatGroups.tsx +5 -3
  9. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +55 -8
  10. package/src/CometChatMessageList/CometChatMessageList.tsx +1169 -548
  11. package/src/CometChatMessageList/components/MessageListItem.tsx +127 -0
  12. package/src/CometChatMessageList/components/MessageModals.tsx +60 -0
  13. package/src/CometChatMessageList/components/MessageOptionsSheet.tsx +130 -0
  14. package/src/CometChatMessageList/components/ReactionModals.tsx +70 -0
  15. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +23 -1
  16. package/src/CometChatUsers/CometChatUsers.tsx +4 -1
  17. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +27 -36
  18. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +21 -12
  19. package/src/shared/base/Types.ts +1 -0
  20. package/src/shared/constants/UIKitConstants.ts +1 -1
  21. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +4 -0
  22. package/src/shared/events/CometChatUIEventHandler/Listener.ts +4 -1
  23. package/src/shared/events/conversations.ts +1 -0
  24. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +23 -15
  25. package/src/shared/framework/MessageDataSource.tsx +79 -17
  26. package/src/shared/index.ts +2 -0
  27. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +3 -1
  28. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +3 -1
  29. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +3 -1
  30. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +3 -1
  31. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +3 -1
  32. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +3 -1
  33. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +3 -1
  34. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +3 -1
  35. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +3 -1
  36. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +3 -1
  37. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +3 -1
  38. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +3 -1
  39. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +3 -1
  40. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +3 -1
  41. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +3 -1
  42. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +3 -1
  43. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +3 -1
  44. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +3 -1
  45. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +7 -4
  46. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +20 -12
  47. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +6 -3
  48. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +2 -1
  49. package/src/shared/views/CometChatList/CometChatList.tsx +20 -1
  50. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +2 -3
  51. package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +55 -0
  52. package/src/shared/views/CometChatNewMessageIndicator/index.ts +3 -0
  53. package/src/shared/views/CometChatNewMessageIndicator/styles.ts +33 -0
  54. package/src/shared/views/CometChatRetryButton/CometChatRetryButton.tsx +54 -0
  55. package/src/shared/views/CometChatRetryButton/index.ts +3 -0
  56. package/src/shared/views/index.ts +15 -0
@@ -38,6 +38,7 @@ export interface CometChatListActionsInterface {
38
38
  getListItem: (itemId: string | number) => any;
39
39
  getSelectedItems: () => Array<any>;
40
40
  getAllListItems: () => Array<any>;
41
+ reload: () => void;
41
42
  }
42
43
 
43
44
  export interface CometChatListStylesInterface {
@@ -212,6 +213,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
212
213
  updateAndMoveToFirst,
213
214
  getSelectedItems,
214
215
  getAllListItems,
216
+ reload,
215
217
  };
216
218
  });
217
219
 
@@ -491,7 +493,7 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
491
493
  if (newlist.length === 0) setHasMoreData(false);
492
494
  }
493
495
 
494
- // If we *did* get results but less than a full “page”, also stop further loads
496
+ // If we *did* get results but less than a full "page", also stop further loads
495
497
  if (newlist.length === 0) setHasMoreData(false);
496
498
 
497
499
  props.onListFetched?.(finalList);
@@ -508,6 +510,23 @@ export const CometChatList = React.forwardRef<CometChatListActionsInterface, Com
508
510
  });
509
511
  };
510
512
 
513
+ /**
514
+ * Reloads the list by fetching fresh data (matches Calls tab behavior)
515
+ */
516
+ const reload = () => {
517
+ // Prevent multiple reloads if a load operation is already in progress
518
+ if (isLoadingMore) return;
519
+
520
+ setDataLoadingStatus(LOADING);
521
+ setHasMoreData(true);
522
+ if (requestBuilder) {
523
+ if (searchInputRef.current)
524
+ listHandlerRef.current = requestBuilder.setSearchKeyword(searchInputRef.current).build();
525
+ else listHandlerRef.current = requestBuilder.build();
526
+ }
527
+ handleList(true);
528
+ };
529
+
511
530
  const renderFooter = useCallback(() => {
512
531
  if (!isLoadingMore || !hasMoreData) return null;
513
532
  return (
@@ -133,15 +133,14 @@ export const CometChatMessageInput = (props: CometChatMessageInputInterface) =>
133
133
  placeholder={placeHolderText}
134
134
  onSelectionChange={onSelectionChange}
135
135
  selection={selection}
136
+ value={text}
136
137
  onFocus={() => {
137
138
  CometChatUIEventHandler.emitUIEvent(CometChatUIEvents.hidePanel, {
138
139
  alignment: ViewAlignment.composerBottom,
139
140
  child: () => null, // Hide the panel content.
140
141
  });
141
142
  }}
142
- >
143
- {text}
144
- </TextInput>
143
+ />
145
144
  <View style={style?.dividerStyle as ViewStyle} />
146
145
  <View
147
146
  style={{
@@ -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
  };