@cometchat/chat-uikit-react-native 4.3.21 → 4.3.22-t1

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 (37) 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 +103 -78
  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 +65 -64
  30. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +2 -6
  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
@@ -7,12 +7,9 @@ import {
7
7
  StyleSheet,
8
8
  Text,
9
9
  } from 'react-native';
10
- import {
11
- FontStyleInterface,
12
- ImageType,
13
- } from '../../shared/base';
14
- import { CometChatSoundManager } from "../../shared/resources";
15
- import { CometChatContext } from "../../shared/CometChatContext";
10
+ import { FontStyleInterface, ImageType } from '../../shared/base';
11
+ import { CometChatSoundManager } from '../../shared/resources';
12
+ import { CometChatContext } from '../../shared/CometChatContext';
16
13
  import { ICONS } from './resources';
17
14
  import { TextStyle } from 'react-native';
18
15
 
@@ -33,13 +30,13 @@ export interface SmartRepliesInterface {
33
30
  }
34
31
  const SmartRepliesView = (props: SmartRepliesInterface) => {
35
32
  const {
36
- customOutgoingMessageSound,
37
- enableSoundForMessages,
38
33
  onClose,
39
- replies,
40
- style,
41
34
  onClick,
42
35
  closeIcon,
36
+ customOutgoingMessageSound = null,
37
+ enableSoundForMessages = false,
38
+ style = {},
39
+ replies = [],
43
40
  } = props;
44
41
  const { theme } = useContext(CometChatContext);
45
42
 
@@ -108,12 +105,14 @@ const SmartRepliesView = (props: SmartRepliesInterface) => {
108
105
  ]}
109
106
  >
110
107
  <Text
111
- style={[
112
- style?.textFont || theme?.typography?.subtitle1,
113
- {
114
- color: style?.textColor || theme?.palette?.getAccent(),
115
- },
116
- ] as TextStyle}
108
+ style={
109
+ [
110
+ style?.textFont || theme?.typography?.subtitle1,
111
+ {
112
+ color: style?.textColor || theme?.palette?.getAccent(),
113
+ },
114
+ ] as TextStyle[]
115
+ }
117
116
  >
118
117
  {option}
119
118
  </Text>
@@ -210,10 +209,5 @@ const Styles = StyleSheet.create({
210
209
  textAlign: 'center',
211
210
  },
212
211
  });
213
- SmartRepliesView.defaultProps = {
214
- customOutgoingMessageSound: null,
215
- enableSoundForMessages: false,
216
- style: {},
217
- replies: [],
218
- };
212
+
219
213
  export { SmartRepliesView };
@@ -1,20 +1,27 @@
1
- import React from "react";
2
- import { View, Text, Image, ScrollView, TouchableOpacity, Dimensions } from "react-native";
3
- import { Hooks } from "./hooks";
4
- import { Styles } from "./style";
5
- import { localize } from "../../../shared/resources/CometChatLocalize";
6
- import { CometChatTheme } from "../../../shared/resources/CometChatTheme";
7
- import { ExtensionConstants } from "../../ExtensionConstants";
1
+ import React from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ Image,
6
+ ScrollView,
7
+ TouchableOpacity,
8
+ Dimensions,
9
+ } from 'react-native';
10
+ import { Hooks } from './hooks';
11
+ import { Styles } from './style';
12
+ import { localize } from '../../../shared/resources/CometChatLocalize';
13
+ import { CometChatTheme } from '../../../shared/resources/CometChatTheme';
14
+ import { ExtensionConstants } from '../../ExtensionConstants';
8
15
  //@ts-ignore
9
- import { CometChat } from "@cometchat/chat-sdk-react-native";
10
- import { anyObject } from "../../../shared/utils";
16
+ import { CometChat } from '@cometchat/chat-sdk-react-native';
17
+ import { anyObject } from '../../../shared/utils';
11
18
 
12
19
  export interface CometChatStickerKeyboardInterface {
13
- loadingText?: string,
14
- theme?: CometChatTheme,
15
- onPress?: (item: CometChat.CustomMessage | anyObject) => void,
16
- emptyText?: string,
17
- errorText?: string,
20
+ loadingText?: string;
21
+ theme?: CometChatTheme;
22
+ onPress?: (item: CometChat.CustomMessage | anyObject) => void;
23
+ emptyText?: string;
24
+ errorText?: string;
18
25
  }
19
26
 
20
27
  /**
@@ -28,23 +35,35 @@ export interface CometChatStickerKeyboardInterface {
28
35
  *
29
36
  */
30
37
 
31
- export const CometChatStickerKeyboard = (props: CometChatStickerKeyboardInterface) => {
38
+ export const CometChatStickerKeyboard = (
39
+ props: CometChatStickerKeyboardInterface
40
+ ) => {
41
+ const {
42
+ emptyText = localize('NO_STICKERS_FOUND'),
43
+ errorText = localize('SOMETHING_WRONG'),
44
+ loadingText = localize('LOADING'),
45
+ theme = new CometChatTheme({}),
46
+ onPress,
47
+ } = props;
32
48
  const [stickerList, setStickerList] = React.useState<any>([]);
33
49
  const [stickerSet, setStickerSet] = React.useState<any>(null);
34
50
  const [activeStickerList, setActiveStickerList] = React.useState([]);
35
51
  const [activeStickerSetName, setActiveStickerSetName] = React.useState();
36
52
  const [decoratorMessage, setDecoratorMessage] = React.useState(
37
- props?.loadingText || localize("LOADING")
53
+ loadingText || localize('LOADING')
38
54
  );
39
55
 
40
- const theme = new CometChatTheme(props?.theme || {});
41
- const sendStickerMessage = (stickerItem: { stickerUrl: any; stickerSetName: any; }) => {
42
- if(stickerItem && typeof stickerItem === 'object')
43
- props?.onPress && props?.onPress({
44
- ...stickerItem,
45
- sticker_url: stickerItem?.stickerUrl,
46
- sticker_name: stickerItem?.stickerSetName
47
- });
56
+ const sendStickerMessage = (stickerItem: {
57
+ stickerUrl: any;
58
+ stickerSetName: any;
59
+ }) => {
60
+ if (stickerItem && typeof stickerItem === 'object')
61
+ onPress &&
62
+ onPress({
63
+ ...stickerItem,
64
+ sticker_url: stickerItem?.stickerUrl,
65
+ sticker_name: stickerItem?.stickerSetName,
66
+ });
48
67
  };
49
68
 
50
69
  const onStickerSetClicked = (sectionItem: any) => {
@@ -103,11 +122,7 @@ export const CometChatStickerKeyboard = (props: CometChatStickerKeyboardInterfac
103
122
  if (activeStickerList?.length === 0) {
104
123
  messageContainer = (
105
124
  <View style={Styles.stickerMsgStyle}>
106
- <Text
107
- style={Styles.stickerMsgTxtStyle}
108
- >
109
- {decoratorMessage}
110
- </Text>
125
+ <Text style={Styles.stickerMsgTxtStyle}>{decoratorMessage}</Text>
111
126
  </View>
112
127
  );
113
128
  }
@@ -124,36 +139,21 @@ export const CometChatStickerKeyboard = (props: CometChatStickerKeyboardInterfac
124
139
  setActiveStickerList,
125
140
  setActiveStickerSetName,
126
141
  setDecoratorMessage,
127
- decoratorMessage,
142
+ decoratorMessage
128
143
  );
129
144
 
130
145
  return (
131
- <View
132
- style={Styles.stickerWrapperStyle}
133
- >
134
- {activeStickerList?.length > 0 ?
135
- <ScrollView
136
- style={Styles.stickerSectionListStyle}
137
- horizontal
138
- >
146
+ <View style={Styles.stickerWrapperStyle}>
147
+ {activeStickerList?.length > 0 ? (
148
+ <ScrollView style={Styles.stickerSectionListStyle} horizontal>
139
149
  {getStickerCategory()}
140
150
  </ScrollView>
141
- : getDecoratorMessage()}
151
+ ) : (
152
+ getDecoratorMessage()
153
+ )}
142
154
  <ScrollView contentContainerStyle={Styles.stickerListStyle}>
143
155
  {getStickerList()}
144
156
  </ScrollView>
145
157
  </View>
146
158
  );
147
159
  };
148
-
149
- // Specifies the default values for props:
150
- CometChatStickerKeyboard.defaultProps = {
151
- emptyText: localize("NO_STICKERS_FOUND"),
152
- errorText: localize("SOMETHING_WRONG"),
153
- loadingText: localize("LOADING"),
154
- style: {
155
- width: "100%",
156
- height: Dimensions.get("screen").height * 0.5,
157
- borderRadius: 8,
158
- },
159
- };
@@ -11,7 +11,7 @@ const areEqual = (prevProps, nextProps) => {
11
11
  };
12
12
 
13
13
  const DateTimePickerModal = memo(
14
- ({ date, mode, isVisible, onCancel, onConfirm, onHide, ...otherProps }) => {
14
+ ( { date = new Date(), mode, isVisible = false, onCancel, onConfirm, onHide = () => {}, ...otherProps } ) => {
15
15
  const currentDateRef = useRef(date);
16
16
  const [currentMode, setCurrentMode] = useState(null);
17
17
 
@@ -72,10 +72,4 @@ DateTimePickerModal.propTypes = {
72
72
  minimumDate: PropTypes.instanceOf(Date),
73
73
  };
74
74
 
75
- DateTimePickerModal.defaultProps = {
76
- date: new Date(),
77
- isVisible: false,
78
- onHide: () => {},
79
- };
80
-
81
75
  export { DateTimePickerModal };
@@ -4,6 +4,7 @@ import { View, Text, TouchableOpacity, Image } from "react-native";
4
4
  // import { getExtentionData, ExtensionConstants, CometChatTheme } from "../../shared";
5
5
  import { Styles } from "./style";
6
6
  import closeIcon from "./resources/close.png";
7
+ import { MessagePreviewStyle } from "./MessagePreviewStyle";
7
8
 
8
9
  /**
9
10
  *
@@ -14,14 +15,35 @@ import closeIcon from "./resources/close.png";
14
15
  * @copyright © 2022 CometChat Inc.
15
16
  *
16
17
  */
17
- const CometChatMessagePreview = (props) => {
18
- let messageText = props?.messagePreviewSubtitle;
18
+ const CometChatMessagePreview = ({
19
+ messagePreviewTitle = "",
20
+ messagePreviewSubtitle = "",
21
+ closeIconURL = closeIcon,
22
+ onCloseClick = null,
23
+ style = new MessagePreviewStyle({
24
+ width: "100%",
25
+ height: "auto",
26
+ border: {
27
+ borderWidth: 3,
28
+ borderStyle: "solid",
29
+ borderColor: "rgba(20, 20, 20, 0.8)",
30
+ },
31
+ backgroundColor: "rgb(255,255,255)",
32
+ borderRadius: 0,
33
+ messagePreviewTitleFont: {},
34
+ messagePreviewTitleColor: "",
35
+ messagePreviewSubtitleColor: "",
36
+ messagePreviewSubtitleFont: {},
37
+ closeIconTint: "",
38
+ }),
39
+ }) => {
40
+ let messageText = messagePreviewSubtitle;
19
41
  const theme ={}
20
- // = new CometChatTheme(props?.theme || {});
42
+ // = new CometChatTheme(theme || {});
21
43
 
22
44
  //xss extensions data
23
45
  // const xssData = getExtentionData(
24
- // props?.messageObject,
46
+ // messageObject,
25
47
  // ExtensionConstants.xssFilter
26
48
  // );
27
49
  // if (
@@ -34,7 +56,7 @@ const CometChatMessagePreview = (props) => {
34
56
 
35
57
  //datamasking extensions data
36
58
  // const maskedData = getExtentionData(
37
- // props?.messageObject,
59
+ // messageObject,
38
60
  // ExtensionConstants.dataMasking
39
61
  // );
40
62
  // if (
@@ -48,7 +70,7 @@ const CometChatMessagePreview = (props) => {
48
70
 
49
71
  //profanity extensions data
50
72
  // const profaneData = getExtentionData(
51
- // props?.messageObject,
73
+ // messageObject,
52
74
  // ExtensionConstants.profanityFilter
53
75
  // );
54
76
  // if (
@@ -60,58 +82,28 @@ const CometChatMessagePreview = (props) => {
60
82
  // }
61
83
 
62
84
  let imageSource
63
- if (props?.closeIconURL) {
64
- if (typeof props?.closeIconURL === 'string' && props?.closeIconURL.length > 0) imageSource = { uri: props?.closeIconURL }
85
+ if (closeIconURL) {
86
+ if (typeof closeIconURL === 'string' && closeIconURL.length > 0) imageSource = { uri: closeIconURL }
65
87
  else imageSource = closeIcon
66
88
  }
67
89
 
68
90
  return (
69
- <View style={Styles.editPreviewContainerStyle(props?.style, theme)}>
70
- <View style={Styles.leftBar(props?.style, theme)} />
91
+ <View style={Styles.editPreviewContainerStyle(style, theme)}>
92
+ <View style={Styles.leftBar(style, theme)} />
71
93
  <View style={Styles.previewHeadingStyle()}>
72
- <Text style={Styles.previewTitleStyle(props?.style, theme)}>
73
- {props?.messagePreviewTitle}
94
+ <Text style={Styles.previewTitleStyle(style, theme)}>
95
+ {messagePreviewTitle}
74
96
  </Text>
75
97
  <TouchableOpacity
76
- style={Styles.previewCloseStyle(props?.style)}
77
- onPress={props?.onCloseClick}
98
+ style={Styles.previewCloseStyle(style)}
99
+ onPress={onCloseClick}
78
100
  >
79
- <Image style={Styles.previewCloseIconStyle(props?.style)} source={imageSource} />
101
+ <Image style={Styles.previewCloseIconStyle(style)} source={imageSource} />
80
102
  </TouchableOpacity>
81
103
  </View>
82
- <Text numberOfLines={1} ellipsizeMode="tail" style={Styles.previewSubTitleStyle(props?.style, theme)}>{messageText}</Text>
104
+ <Text numberOfLines={1} ellipsizeMode="tail" style={Styles.previewSubTitleStyle(style, theme)}>{messageText}</Text>
83
105
  </View>
84
106
  );
85
107
  };
86
108
 
87
- CometChatMessagePreview.defaultProps = {
88
- messagePreviewTitle: "",
89
- messagePreviewSubtitle: "",
90
- closeIconURL: closeIcon,
91
- onCloseClick: null,
92
- style: {
93
- widht: "100%",
94
- height: "auto",
95
- border: {
96
- borderWidth: 3,
97
- borderStyle: "solid",
98
- borderColor: "rgba(20, 20, 20, 0.8)"
99
- },
100
- backgroundColor: "rgb(255,255,255)",
101
- borderRadius: 0,
102
- messagePreviewTitleFont: {},
103
- messagePreviewTitleColor: "",
104
- messagePreviewSubtitleColor: "",
105
- messagePreviewSubtitleFont: {},
106
- closeIconTint: "",
107
- },
108
- };
109
-
110
- CometChatMessagePreview.propTypes = {
111
- messagePreviewTitle: PropTypes.string,
112
- messagePreviewSubtitle: PropTypes.string,
113
- closeIconURL: PropTypes.any,
114
- onCloseClick: PropTypes.func,
115
- style: PropTypes.object,
116
- };
117
109
  export { CometChatMessagePreview };
@@ -149,6 +149,15 @@ interface CometChatActionSheetInterface {
149
149
  hideHeader?: boolean;
150
150
  }
151
151
  export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
152
+ const {
153
+ title= localize('ADD_TO_CHAT'),
154
+ layoutModeIconURL= undefined,
155
+ layoutMode= layoutType['list'],
156
+ hideLayoutMode= false,
157
+ actions= [],
158
+ style: propsStyle = {},
159
+ hideHeader= false,
160
+ } = props;
152
161
  const { theme } = useContext<CometChatContextType>(CometChatContext);
153
162
  const style: any = {
154
163
  ...new ActionSheetStyles({
@@ -157,15 +166,15 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
157
166
  listItemTitleColor: theme.palette.getAccent(),
158
167
  titleColor: theme.palette.getAccent(),
159
168
  titleFont: theme.typography.name,
160
- backgroundColor: props.style?.backgroundColor,
161
- paddingHorizontal: props.style?.paddingHorizontal
169
+ backgroundColor: propsStyle?.backgroundColor,
170
+ paddingHorizontal: propsStyle?.paddingHorizontal
162
171
  }),
163
- ...props.style,
164
- listItemTitleFont: {...theme.typography.subtitle1, ...(props.style.listItemTitleFont ?? {})},
172
+ ...propsStyle,
173
+ listItemTitleFont: {...theme.typography.subtitle1, ...(propsStyle.listItemTitleFont ?? {})},
165
174
  };
166
175
 
167
176
  const [listMode, setListMode] = React.useState(true);
168
- const [actionList, setActionList] = React.useState(props.actions);
177
+ const [actionList, setActionList] = React.useState(actions);
169
178
 
170
179
  Hooks(props, setActionList);
171
180
 
@@ -193,7 +202,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
193
202
  style={{
194
203
  height: 1,
195
204
  backgroundColor:
196
- props.style?.actionSheetSeparatorTint || props.style?.optionsSeparatorTint ||
205
+ style.actionSheetSeparatorTint || style.optionsSeparatorTint ||
197
206
  theme.palette.getAccent200(),
198
207
  }}
199
208
  />
@@ -215,8 +224,8 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
215
224
  };
216
225
 
217
226
  const getLayoutModeIcon = () => {
218
- if (props.hideLayoutMode) return null;
219
- let img = props.layoutModeIconURL;
227
+ if (hideLayoutMode) return null;
228
+ let img = layoutModeIconURL;
220
229
  if (img == undefined) {
221
230
  img = listMode ? ICONS.GRID : ICONS.LIST;
222
231
  }
@@ -248,7 +257,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
248
257
  style?.border,
249
258
  ]}
250
259
  >
251
- {!props.hideHeader && <View style={Style.headerStyle}>
260
+ {!hideHeader && <View style={Style.headerStyle}>
252
261
  <Text
253
262
  style={[
254
263
  Style.titleStyle,
@@ -261,7 +270,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
261
270
  },
262
271
  ]}
263
272
  >
264
- {props.title}
273
+ {title}
265
274
  </Text>
266
275
  {getLayoutModeIcon()}
267
276
  </View>}
@@ -269,12 +278,3 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
269
278
  </View>
270
279
  );
271
280
  };
272
-
273
- CometChatActionSheet.defaultProps = {
274
- title: localize('ADD_TO_CHAT'),
275
- layoutModeIconURL: undefined,
276
- layoutMode: layoutType['list'],
277
- hideLayoutMode: false,
278
- actions: [],
279
- style: null,
280
- };
@@ -24,28 +24,22 @@ interface CometChatAvatarProps {
24
24
  }
25
25
 
26
26
  export const CometChatAvatar = (props: CometChatAvatarProps) => {
27
+ const {
28
+ image = undefined,
29
+ name: rawName = '',
30
+ style: propsStyle = new AvatarStyle({}),
31
+ } = props;
27
32
  const {theme} = useContext<CometChatContextType>(CometChatContext);
28
33
 
29
- const defaultStyleProps = new AvatarStyle({
34
+ const style = new AvatarStyle({
30
35
  backgroundColor : theme.palette.getAccent400(),
31
36
  nameTextColor : theme.palette.getAccent800(),
32
37
  nameTextFont : theme.typography.body,
38
+ ...propsStyle
33
39
  });
34
40
 
35
- const { image, name: rawName } = props;
36
41
  const name = rawName.trim();
37
42
 
38
- const style = {
39
- ...defaultStyleProps,
40
- ...props.style,
41
- border: { ...defaultStyleProps.border, ...props.style?.border },
42
- nameTextFont: {
43
- ...defaultStyleProps.nameTextFont,
44
- ...props.style?.nameTextFont,
45
- },
46
- outerView: { ...defaultStyleProps.outerView, ...props.style?.outerView },
47
- };
48
-
49
43
  const getImageView = () => {
50
44
  let isImage = Boolean(image);
51
45
  if (image && image.hasOwnProperty("uri") && typeof image.uri !== "string") {
@@ -61,7 +55,7 @@ export const CometChatAvatar = (props: CometChatAvatarProps) => {
61
55
  color: style.nameTextColor,
62
56
  },
63
57
  style.nameTextFont ?? {},
64
- ] as TextStyle}
58
+ ] as TextStyle[]}
65
59
  >
66
60
  {name.length >= 2 ? name.substring(0, 2).toUpperCase() : name}
67
61
  </Text>
@@ -119,9 +113,3 @@ export const CometChatAvatar = (props: CometChatAvatarProps) => {
119
113
  </View>
120
114
  );
121
115
  };
122
-
123
- CometChatAvatar.defaultProps = {
124
- image: '',
125
- name: '',
126
- style: new AvatarStyle({}),
127
- };
@@ -21,20 +21,19 @@ interface CometChatBadgeProps {
21
21
  }
22
22
 
23
23
  export const CometChatBadge = (props: CometChatBadgeProps) => {
24
+ const {
25
+ count= 0,
26
+ style: propsStyle= new BadgeStyle({}),
27
+ } = props;
24
28
  const { theme } = useContext<CometChatContextType>(CometChatContext);
25
29
 
26
- const defaultStyleProps = new BadgeStyle({
30
+ const style = new BadgeStyle({
27
31
  backgroundColor: theme?.palette.getPrimary(),
28
32
  textFont: theme.typography.caption2,
29
33
  textColor: theme.palette.getBackgroundColor(),
34
+ ...propsStyle
30
35
  });
31
- const { count } = props;
32
- const style = {
33
- ...defaultStyleProps,
34
- ...props.style,
35
- border: { ...defaultStyleProps.border, ...props.style?.border },
36
- textFont: { ...defaultStyleProps.textFont, ...props.style?.textFont },
37
- };
36
+
38
37
  if (count == 0) return null;
39
38
  return (
40
39
  <View
@@ -56,15 +55,10 @@ export const CometChatBadge = (props: CometChatBadgeProps) => {
56
55
  color: style.textColor,
57
56
  },
58
57
  style.textFont,
59
- ] as TextStyle}
58
+ ] as TextStyle[]}
60
59
  >
61
60
  {count > 999 ? '999+' : count}
62
61
  </Text>
63
62
  </View>
64
63
  );
65
64
  };
66
-
67
- CometChatBadge.defaultProps = {
68
- count: 0,
69
- style: new BadgeStyle({}),
70
- };