@cometchat/chat-uikit-react-native 4.3.20 → 4.3.22

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 (47) hide show
  1. package/package.json +1 -1
  2. package/src/AI/AIConversationSummary/AIConversationSummaryView.tsx +171 -167
  3. package/src/AI/CardView.tsx +55 -53
  4. package/src/CometChatCreateGroup/CometChatCreateGroup.tsx +8 -13
  5. package/src/CometChatGroups/CometChatGroups.tsx +545 -514
  6. package/src/CometChatJoinProtectedGroup/CometChatJoinProtectedGroup.tsx +5 -8
  7. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +544 -378
  8. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +90 -72
  9. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +3 -8
  10. package/src/CometChatTransferOwnership/CometChatTransferOwnership.tsx +11 -13
  11. package/src/CometChatUsers/CometChatUsers.tsx +24 -23
  12. package/src/extensions/CollaborativeBubble/CometChatCollaborativeBubble.tsx +24 -25
  13. package/src/extensions/Polls/Polls.tsx +8 -16
  14. package/src/extensions/Polls/PollsBubble.tsx +5 -10
  15. package/src/extensions/SmartReplies/SmartRepliesView.tsx +16 -22
  16. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +51 -51
  17. package/src/shared/libs/datePickerModal/DateTimePickerModal.android.js +1 -7
  18. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.js +38 -46
  19. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +19 -19
  20. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +8 -20
  21. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -14
  22. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +141 -140
  23. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +47 -51
  24. package/src/shared/views/CometChatDate/CometChatDate.tsx +18 -17
  25. package/src/shared/views/CometChatDateTimePicker/CometChatDateTimePicker.tsx +65 -51
  26. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +76 -72
  27. package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +3 -8
  28. package/src/shared/views/CometChatList/CometChatList.tsx +133 -134
  29. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +62 -61
  30. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +20 -10
  31. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +3 -8
  32. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +24 -23
  33. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +107 -53
  34. package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +22 -14
  35. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +15 -8
  36. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +2 -6
  37. package/src/shared/views/SwipeRow/SwipeRow.tsx +6 -14
  38. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  39. package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
  40. package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
  41. package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
  42. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  43. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  44. package/android/.gradle/7.4/gc.properties +0 -0
  45. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  46. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  47. package/android/.gradle/vcs-1/gc.properties +0 -0
@@ -6,30 +6,35 @@ import {
6
6
  TouchableOpacity,
7
7
  Platform,
8
8
  TextStyle,
9
- } from "react-native";
10
- import React, { useState, useContext, useLayoutEffect } from "react";
11
- import DateTimePickerModal from "../../libs/datePickerModal";
12
- import { ICONS } from "../../assets/images";
13
- import { CometChatContextType } from "../../base";
14
- import { CometChatContext } from "../../CometChatContext";
9
+ } from 'react-native';
10
+ import React, { useState, useContext, useLayoutEffect } from 'react';
11
+ import DateTimePickerModal from '../../libs/datePickerModal';
12
+ import { ICONS } from '../../assets/images';
13
+ import { CometChatContextType } from '../../base';
14
+ import { CometChatContext } from '../../CometChatContext';
15
15
  //@ts-ignore
16
- import { DateTime } from "../../libs/luxon/src/luxon";
17
- import { convertToATimeZone } from "../../utils/SchedulerUtils";
16
+ import { DateTime } from '../../libs/luxon/src/luxon';
17
+ import { convertToATimeZone } from '../../utils/SchedulerUtils';
18
18
  //@ts-ignore
19
- import DateTimePicker from "@react-native-community/datetimepicker";
20
- import { DatePickerStyleInterface, styles } from "./DateTimePickerStyle";
21
- import { DateTimeElement } from "../../modals";
19
+ import DateTimePicker from '@react-native-community/datetimepicker';
20
+ import { DatePickerStyleInterface, styles } from './DateTimePickerStyle';
21
+ import { DateTimeElement } from '../../modals';
22
22
 
23
23
  export interface CometChatDateTimePickerInterface {
24
24
  style: DatePickerStyleInterface;
25
- data: DateTimeElement;
25
+ data?: DateTimeElement;
26
26
  showError: boolean;
27
- onChange: (selectedDateTime: string) => void;
27
+ onChange?: (selectedDateTime: string) => void;
28
28
  }
29
29
  export const CometChatDateTimePicker = (
30
30
  props: CometChatDateTimePickerInterface
31
31
  ) => {
32
- const { style, showError, data, onChange } = props;
32
+ const {
33
+ data,
34
+ onChange,
35
+ style = {},
36
+ showError = true,
37
+ } = props;
33
38
  const mode = data.getMode();
34
39
  const format = data.getDateTimeFormat();
35
40
  const timeZone = data.getTimeZone();
@@ -38,28 +43,32 @@ export const CometChatDateTimePicker = (
38
43
 
39
44
  const [isDatePickerVisible, setDatePickerVisibility] = useState(false);
40
45
 
41
- const [defaultTime, setDefaultTime] = useState<string | DateTime>(data.getDefaultValue() ?? "");
46
+ const [defaultTime, setDefaultTime] = useState<string | DateTime>(
47
+ data.getDefaultValue() ?? ''
48
+ );
42
49
  const [selectedDate, setSelectedDate] = useState<string | DateTime | Date>();
43
50
  const [fromDateTime, setFromDateTime] = useState<string | DateTime>(
44
- data.getFromDateTime() ?? ""
51
+ data.getFromDateTime() ?? ''
52
+ );
53
+ const [toDateTime, setToDateTime] = useState<string | DateTime>(
54
+ data.getToDateTime() ?? ''
45
55
  );
46
- const [toDateTime, setToDateTime] = useState<string | DateTime>(data.getToDateTime() ?? "");
47
56
 
48
57
  const onDateSelected = (e: any) => {
49
58
  setSelectedDate(() => {
50
- if (mode === "time" && Platform.OS === "ios") {
59
+ if (mode === 'time' && Platform.OS === 'ios') {
51
60
  return selectedDate;
52
61
  } else return e;
53
62
  });
54
63
  e = DateTime.fromJSDate(e).setZone();
55
64
  setDatePickerVisibility(false);
56
- if (mode === "date") {
57
- e = DateTime.fromISO(e).toFormat("yyyy-MM-dd");
65
+ if (mode === 'date') {
66
+ e = DateTime.fromISO(e).toFormat('yyyy-MM-dd');
58
67
  }
59
- if (mode === "time") {
60
- if (Platform.OS === "ios") {
61
- e = DateTime.fromJSDate(selectedDate as Date).toFormat("HH:mm");
62
- } else e = DateTime.fromISO(e).toFormat("HH:mm");
68
+ if (mode === 'time') {
69
+ if (Platform.OS === 'ios') {
70
+ e = DateTime.fromJSDate(selectedDate as Date).toFormat('HH:mm');
71
+ } else e = DateTime.fromISO(e).toFormat('HH:mm');
63
72
  }
64
73
 
65
74
  onChange && onChange(e);
@@ -71,23 +80,23 @@ export const CometChatDateTimePicker = (
71
80
  return DateTime.fromJSDate(new Date(time)).toFormat(format);
72
81
  return DateTime.fromISO(time).toFormat(format);
73
82
  }
74
- return "";
83
+ return '';
75
84
  };
76
85
 
77
86
  const convertToATimeZoneWithModes = (time: any) => {
78
87
  switch (mode) {
79
- case "dateTime":
80
- return convertToATimeZone(time, timeZone, "toISO", "fromISO");
81
- case "date":
88
+ case 'dateTime':
89
+ return convertToATimeZone(time, timeZone, 'toISO', 'fromISO');
90
+ case 'date':
82
91
  return convertToATimeZone(
83
92
  `${time}T00:00:00`,
84
93
  timeZone,
85
- "toISO",
86
- "fromISO"
94
+ 'toISO',
95
+ 'fromISO'
87
96
  );
88
- case "time":
89
- time = time?.split(":");
90
- if(time && time.length) {
97
+ case 'time':
98
+ time = time?.split(':');
99
+ if (time && time.length) {
91
100
  let dateTime = new Date();
92
101
  dateTime.setHours(time[0]);
93
102
  dateTime.setMinutes(time[1]);
@@ -99,13 +108,13 @@ export const CometChatDateTimePicker = (
99
108
  return convertToATimeZone(
100
109
  dateTime.toISOString(),
101
110
  timeZone,
102
- "toISO",
103
- "fromISO"
111
+ 'toISO',
112
+ 'fromISO'
104
113
  );
105
114
  }
106
- return "";
115
+ return '';
107
116
  default:
108
- return "";
117
+ return '';
109
118
  }
110
119
  };
111
120
  useLayoutEffect(() => {
@@ -124,15 +133,19 @@ export const CometChatDateTimePicker = (
124
133
  <DateTimePickerModal
125
134
  isVisible={isDatePickerVisible}
126
135
  date={
127
- selectedDate instanceof Date ? selectedDate : new Date(selectedDate as string)
136
+ selectedDate instanceof Date
137
+ ? selectedDate
138
+ : new Date(selectedDate as string)
139
+ }
140
+ mode={
141
+ (mode?.toLowerCase() || 'datetime') as 'date' | 'time' | 'datetime'
128
142
  }
129
- mode={(mode?.toLowerCase() || "datetime") as "date" | "time" | "datetime"}
130
143
  onConfirm={onDateSelected}
131
144
  onCancel={() => setDatePickerVisibility(false)}
132
145
  minimumDate={new Date(fromDateTime as string)}
133
146
  maximumDate={new Date(toDateTime as string)}
134
- display={Platform.OS === "ios" ? "inline" : "default"}
135
- {...(Platform.OS === "ios" && mode?.toLowerCase() === "time"
147
+ display={Platform.OS === 'ios' ? 'inline' : 'default'}
148
+ {...(Platform.OS === 'ios' && mode?.toLowerCase() === 'time'
136
149
  ? {
137
150
  customPickerIOS: () => (
138
151
  <DateTimePicker
@@ -154,14 +167,19 @@ export const CometChatDateTimePicker = (
154
167
  />
155
168
  )}
156
169
  <Text
157
- style={[
158
- theme.typography.subtitle1,
159
- { color: theme.palette.getAccent800() ?? style.titleColor, marginBottom: 4 },
160
- style.titleFont || {},
161
- ] as TextStyle}
170
+ style={
171
+ [
172
+ theme.typography.subtitle1,
173
+ {
174
+ color: theme.palette.getAccent800() ?? style.titleColor,
175
+ marginBottom: 4,
176
+ },
177
+ style.titleFont || {},
178
+ ] as TextStyle[]
179
+ }
162
180
  >
163
181
  {data.getLabel()}
164
- {!data.getOptional() && "*"}
182
+ {!data.getOptional() && '*'}
165
183
  </Text>
166
184
 
167
185
  <TouchableOpacity
@@ -186,7 +204,3 @@ export const CometChatDateTimePicker = (
186
204
  </View>
187
205
  );
188
206
  };
189
-
190
- CometChatDateTimePicker.defaultProps = {
191
- style: {},
192
- };
@@ -1,4 +1,10 @@
1
- import React, { useCallback, useImperativeHandle, useRef, useState, useContext } from 'react';
1
+ import React, {
2
+ useCallback,
3
+ useImperativeHandle,
4
+ useRef,
5
+ useState,
6
+ useContext,
7
+ } from 'react';
2
8
  import PropTypes from 'prop-types';
3
9
  import { Emojis } from './emojis';
4
10
  import { Styles } from './style';
@@ -18,65 +24,64 @@ const emojiValues = Object.values(Emojis);
18
24
 
19
25
  const viewConfig = {
20
26
  waitForInteraction: true,
21
- viewAreaCoveragePercentThreshold: 30
22
- }
27
+ viewAreaCoveragePercentThreshold: 30,
28
+ };
23
29
 
24
30
  type CategoryListInterface = {
25
- theme: CometChatTheme,
26
- onCategorySelected: (id: string, index: number) => void,
31
+ theme: CometChatTheme;
32
+ onCategorySelected: (id: string, index: number) => void;
27
33
  style?: {
28
- categoryIconTint?: string
29
- selectedCategoryIconTint?: string
30
- }
31
- }
34
+ categoryIconTint?: string;
35
+ selectedCategoryIconTint?: string;
36
+ };
37
+ };
32
38
 
33
39
  type CategoryListActions = {
34
- updateCategory: (newCateory: string, index: number) => void
35
- }
40
+ updateCategory: (newCateory: string, index: number) => void;
41
+ };
36
42
 
37
43
  const CategoryList = React.forwardRef<
38
44
  CategoryListActions,
39
45
  CategoryListInterface
40
- >((
41
- { theme, onCategorySelected, style }, ref) => {
46
+ >(({ theme, onCategorySelected, style }, ref) => {
42
47
  const [activeCategory, setActiveCategory] = useState('people');
43
48
 
44
49
  useImperativeHandle(ref, () => {
45
50
  return {
46
- updateCategory: updateCategory
47
- }
51
+ updateCategory: updateCategory,
52
+ };
48
53
  });
49
54
  const updateCategory = (newCategory: any, index: any) => {
50
55
  setActiveCategory(newCategory);
51
- }
56
+ };
52
57
 
53
58
  return (
54
59
  <>
55
- {
56
- Emojis.map((value, index) => {
57
- let emojiCategory = Object.values(value)[0];
58
- return (
59
- <TouchableOpacity
60
- style={[Styles.getListStyle]}
61
- key={emojiCategory.id}
62
- onPress={() => {
63
- onCategorySelected && onCategorySelected(emojiCategory.id, index);
60
+ {Emojis.map((value, index) => {
61
+ let emojiCategory = Object.values(value)[0];
62
+ return (
63
+ <TouchableOpacity
64
+ style={[Styles.getListStyle]}
65
+ key={emojiCategory.id}
66
+ onPress={() => {
67
+ onCategorySelected && onCategorySelected(emojiCategory.id, index);
68
+ }}
69
+ >
70
+ <Image
71
+ style={{
72
+ tintColor:
73
+ activeCategory == emojiCategory.id
74
+ ? style?.selectedCategoryIconTint ||
75
+ theme?.palette?.getPrimary()
76
+ : style?.categoryIconTint || theme?.palette?.getAccent600(),
64
77
  }}
65
- >
66
- <Image
67
- style={{
68
- tintColor: activeCategory == emojiCategory.id
69
- ? (style?.selectedCategoryIconTint || theme?.palette?.getPrimary())
70
- : (style?.categoryIconTint || theme?.palette?.getAccent600()),
71
- }}
72
- source={emojiCategory.symbol}
73
- />
74
- </TouchableOpacity>
75
- );
76
- })
77
- }
78
+ source={emojiCategory.symbol}
79
+ />
80
+ </TouchableOpacity>
81
+ );
82
+ })}
78
83
  </>
79
- )
84
+ );
80
85
  });
81
86
 
82
87
  /**
@@ -94,7 +99,15 @@ const CategoryList = React.forwardRef<
94
99
  const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
95
100
  const theme: CometChatTheme = new CometChatTheme(props?.theme ?? {});
96
101
 
97
- const { onClick, style } = props;
102
+ const {
103
+ onClick = () => {},
104
+ style = {
105
+ width: '100%',
106
+ height: 310,
107
+ border: {},
108
+ borderRadius: 8,
109
+ },
110
+ } = props;
98
111
 
99
112
  const emojiRef = useRef<any>(null);
100
113
  const categoryRef = useRef<any>(null);
@@ -116,18 +129,19 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
116
129
  Styles.listStyle,
117
130
  {
118
131
  backgroundColor:
119
- style?.backgroundColor ||
120
- theme?.palette?.getBackgroundColor(),
132
+ style?.backgroundColor || theme?.palette?.getBackgroundColor(),
121
133
  },
122
134
  ]}
123
135
  >
124
136
  <Text
125
- style={[
126
- theme?.typography?.heading,
127
- {
128
- color: theme?.palette?.getPrimary(),
129
- },
130
- ] as TextStyle}
137
+ style={
138
+ [
139
+ theme?.typography?.heading,
140
+ {
141
+ color: theme?.palette?.getPrimary(),
142
+ },
143
+ ] as TextStyle[]
144
+ }
131
145
  >
132
146
  {item.char}
133
147
  </Text>
@@ -143,12 +157,17 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
143
157
  return (
144
158
  <View key={id} style={Styles.emojiCategoryWrapper}>
145
159
  <Text
146
- style={[
147
- Styles.emojiCategoryTitle,
148
- theme?.typography?.caption1,
149
- style?.sectionHeaderFont,
150
- { color: style?.sectionHeaderColor || theme?.palette?.getAccent500() },
151
- ] as TextStyle}
160
+ style={
161
+ [
162
+ Styles.emojiCategoryTitle,
163
+ theme?.typography?.caption1,
164
+ style?.sectionHeaderFont,
165
+ {
166
+ color:
167
+ style?.sectionHeaderColor || theme?.palette?.getAccent500(),
168
+ },
169
+ ] as TextStyle[]
170
+ }
152
171
  >
153
172
  {name}
154
173
  </Text>
@@ -176,8 +195,7 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
176
195
  width: style?.width,
177
196
  height: style?.height,
178
197
  backgroundColor:
179
- style?.backgroundColor ||
180
- theme?.palette?.getBackgroundColor(),
198
+ style?.backgroundColor || theme?.palette?.getBackgroundColor(),
181
199
  } as ViewProps,
182
200
  ]}
183
201
  >
@@ -200,7 +218,7 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
200
218
  }
201
219
  }}
202
220
  windowSize={50}
203
- onScrollToIndexFailed={(error) => { }}
221
+ onScrollToIndexFailed={(error) => {}}
204
222
  renderItem={emojiListRender}
205
223
  />
206
224
  <View
@@ -209,8 +227,7 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
209
227
  {
210
228
  width: style?.width,
211
229
  backgroundColor:
212
- style?.categoryBackground ||
213
- theme?.palette?.getBackgroundColor(),
230
+ style?.categoryBackground || theme?.palette?.getBackgroundColor(),
214
231
  } as ViewProps,
215
232
  ]}
216
233
  >
@@ -228,20 +245,7 @@ const CometChatEmojiKeyboard = (props: EmojiKeyboardConfiguration) => {
228
245
  );
229
246
  };
230
247
 
231
- // Specifies the default values for props:
232
- CometChatEmojiKeyboard.defaultProps = {
233
- // hideSearch: false,
234
- onClick: () => { },
235
- style: {
236
- width: '100%',
237
- height: 310,
238
- border: {},
239
- borderRadius: 8,
240
- },
241
- };
242
-
243
248
  CometChatEmojiKeyboard.propTypes = {
244
- // hideSearch: PropTypes.bool,
245
249
  onClick: PropTypes.func,
246
250
  style: PropTypes.object,
247
251
  };
@@ -505,7 +505,7 @@ export const CometChatFormBubble = memo((props: CometChatFormBubbleInterface) =>
505
505
  subtitle={message.getTitle()}
506
506
  quickViewStyle={quickViewStyle}
507
507
  />
508
- <Text style={[{ marginTop: 10, color: goalCompletionTextColor }, goalCompletionTextFont] as TextStyle}>{message.getGoalCompletionText() || localize("FORM_COMPLETION_MESSAGE")}</Text>
508
+ <Text style={[{ marginTop: 10, color: goalCompletionTextColor }, goalCompletionTextFont] as TextStyle[]}>{message.getGoalCompletionText() || localize("FORM_COMPLETION_MESSAGE")}</Text>
509
509
  </View>
510
510
  :
511
511
  <View style={{
@@ -524,7 +524,7 @@ export const CometChatFormBubble = memo((props: CometChatFormBubbleInterface) =>
524
524
  color: titleColor,
525
525
  },
526
526
  titleFont,
527
- ] as TextStyle}
527
+ ] as TextStyle[]}
528
528
  >{message.getTitle()}</Text>
529
529
  </View>
530
530
  }
@@ -539,9 +539,4 @@ export const CometChatFormBubble = memo((props: CometChatFormBubbleInterface) =>
539
539
  </View>
540
540
  }
541
541
  </View>
542
- })
543
-
544
- //@ts-ignore
545
- CometChatFormBubble.defaultProps = {
546
- message: {}
547
- }
542
+ })