@cometchat/chat-uikit-react-native 4.3.21 → 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 (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 +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 +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
@@ -13,9 +13,9 @@ import {
13
13
  ViewProps,
14
14
  //@ts-ignore
15
15
  } from 'react-native';
16
- import { CometChatAvatar } from "../../views/CometChatAvatar";
16
+ import { CometChatAvatar } from '../../views/CometChatAvatar';
17
17
  import { CometChatStatusIndicator } from '../../views/CometChatStatusIndicator';
18
- import { CometChatContext } from "../../CometChatContext";
18
+ import { CometChatContext } from '../../CometChatContext';
19
19
  //@ts-ignore
20
20
  import SwipeRow from '../../helper/SwipeRow';
21
21
  import { ListItemStyle } from './ListItemStyle';
@@ -71,7 +71,6 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
71
71
  SubtitleView,
72
72
  options,
73
73
  TailView,
74
- hideSeparator,
75
74
  separatorColor,
76
75
  headViewContainerStyle,
77
76
  tailViewContainerStyle,
@@ -79,27 +78,18 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
79
78
  onPress,
80
79
  onLongPress,
81
80
  rowOpens,
82
- activeSwipeRows
81
+ listItemStyle: listItemStyleProp = new ListItemStyle({}),
82
+ hideSeparator = true,
83
+ activeSwipeRows = {},
83
84
  } = props;
84
-
85
- const swipeRowRef = useRef<any>(null)
86
- const defaultlistItemStyleProps = new ListItemStyle({
85
+
86
+ const swipeRowRef = useRef<any>(null);
87
+ const listItemStyle = new ListItemStyle({
87
88
  backgroundColor: theme.palette.getBackgroundColor(),
88
89
  titleColor: theme.palette.getAccent(),
89
90
  titleFont: theme.typography.name,
91
+ ...listItemStyleProp,
90
92
  });
91
- const listItemStyle = {
92
- ...defaultlistItemStyleProps,
93
- ...props.listItemStyle,
94
- border: {
95
- ...defaultlistItemStyleProps.border,
96
- ...props.listItemStyle?.border,
97
- },
98
- titleFont: {
99
- ...defaultlistItemStyleProps.titleFont,
100
- ...props.listItemStyle?.titleFont,
101
- },
102
- };
103
93
 
104
94
  const [swipeRowOptions, setSwipeRowOptions] = useState<any[]>([]);
105
95
  let cancelClick = false;
@@ -153,13 +143,15 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
153
143
  <Text
154
144
  numberOfLines={1}
155
145
  ellipsizeMode="tail"
156
- style={[
157
- Style.titleTextStyle,
158
- {
159
- color: listItemStyle.titleColor,
160
- },
161
- listItemStyle.titleFont,
162
- ] as StyleProp<TextStyle> }
146
+ style={
147
+ [
148
+ Style.titleTextStyle,
149
+ {
150
+ color: listItemStyle.titleColor,
151
+ },
152
+ listItemStyle.titleFont,
153
+ ] as StyleProp<TextStyle>
154
+ }
163
155
  >
164
156
  {title?.trim()}
165
157
  </Text>
@@ -190,8 +182,8 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
190
182
  };
191
183
 
192
184
  const rowOpened = () => {
193
- if(activeSwipeRows) activeSwipeRows[id] = swipeRowRef
194
- rowOpens && rowOpens(id)
185
+ if (activeSwipeRows) activeSwipeRows[id] = swipeRowRef;
186
+ rowOpens && rowOpens(id);
195
187
  cancelClick = true;
196
188
  };
197
189
 
@@ -205,7 +197,7 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
205
197
  const TailViewFc = () => {
206
198
  return (
207
199
  <View style={[Style.tailViewStyle, tailViewContainerStyle ?? {}]}>
208
- {Boolean(TailView) && typeof(TailView) === 'function' && <TailView />}
200
+ {Boolean(TailView) && typeof TailView === 'function' && <TailView />}
209
201
  </View>
210
202
  );
211
203
  };
@@ -250,35 +242,45 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
250
242
  );
251
243
  };
252
244
 
253
- let ListComponent: any = ((onPress && typeof onPress == 'function') || (onLongPress && typeof onLongPress == 'function')) ? TouchableOpacity : View;
254
- let listComponentProps = ((onPress && typeof onPress == 'function') || (onLongPress && typeof onLongPress == 'function')) ? {
255
- activeOpacity: 1,
256
- onPress: clickHandler,
257
- onLongPress: longPressHandler
258
- } : {};
245
+ let ListComponent: any =
246
+ (onPress && typeof onPress == 'function') ||
247
+ (onLongPress && typeof onLongPress == 'function')
248
+ ? TouchableOpacity
249
+ : View;
250
+ let listComponentProps =
251
+ (onPress && typeof onPress == 'function') ||
252
+ (onLongPress && typeof onLongPress == 'function')
253
+ ? {
254
+ activeOpacity: 1,
255
+ onPress: clickHandler,
256
+ onLongPress: longPressHandler,
257
+ }
258
+ : {};
259
259
 
260
260
  let WrapperComponent = swipeRowOptions.length ? SwipeRow : React.Fragment;
261
- let wrapperComponentProps = swipeRowOptions.length ? {
262
- ref: swipeRowRef,
263
- key: id,
264
- onRowDidOpen: rowOpened,
265
- onRowDidClose: rowClosed,
266
- disableRightSwipe: true,
267
- disableLeftSwipe: !swipeRowOptions.length,
268
- rightOpenValue: 0 - translate
269
- } : {};
261
+ let wrapperComponentProps = swipeRowOptions.length
262
+ ? {
263
+ ref: swipeRowRef,
264
+ key: id,
265
+ onRowDidOpen: rowOpened,
266
+ onRowDidClose: rowClosed,
267
+ disableRightSwipe: true,
268
+ disableLeftSwipe: !swipeRowOptions.length,
269
+ rightOpenValue: 0 - translate,
270
+ }
271
+ : {};
270
272
 
271
273
  return (
272
- <WrapperComponent
273
- {...wrapperComponentProps}
274
- >
274
+ <WrapperComponent {...wrapperComponentProps}>
275
275
  <View
276
- style={[
277
- Style.optionStyle,
278
- {
279
- height: listItemStyle.height ?? 50,
280
- },
281
- ] as ViewProps}
276
+ style={
277
+ [
278
+ Style.optionStyle,
279
+ {
280
+ height: listItemStyle.height ?? 50,
281
+ },
282
+ ] as ViewProps
283
+ }
282
284
  >
283
285
  <View onLayout={onLayout} style={Style.optionStyleContainer}>
284
286
  {swipeRowOptions.length !== 0 && (
@@ -309,12 +311,17 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
309
311
  <View
310
312
  style={[
311
313
  Style.rightContainerStyle,
312
- { borderBottomWidth: hideSeparator ? 0 : 1, borderBottomColor: separatorColor || undefined },
314
+ {
315
+ borderBottomWidth: hideSeparator ? 0 : 1,
316
+ borderBottomColor: separatorColor || undefined,
317
+ },
313
318
  ]}
314
319
  >
315
320
  <View style={[Style.middleViewStyle, bodyViewContainerStyle ?? {}]}>
316
321
  {Boolean(title) && <TitleView />}
317
- {Boolean(SubtitleView) && typeof(SubtitleView) === 'function' && <SubtitleView />}
322
+ {Boolean(SubtitleView) && typeof SubtitleView === 'function' && (
323
+ <SubtitleView />
324
+ )}
318
325
  </View>
319
326
  {Boolean(TailView) && <TailViewFc />}
320
327
  </View>
@@ -322,9 +329,3 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
322
329
  </WrapperComponent>
323
330
  );
324
331
  };
325
-
326
- CometChatListItem.defaultProps = {
327
- listItemStyle: new ListItemStyle({}),
328
- hideSeparator: true,
329
- activeSwipeRows: {}
330
- };
@@ -27,7 +27,7 @@ export interface CometChatMediaRecorderInterface {
27
27
  let timerIntervalId: any = null;
28
28
  export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) => {
29
29
  const {
30
- onClose, style, onPause, onPlay, onSend, onStop, onStart, mediaRecorderStyle,
30
+ onClose, style = new MediaRecorderStyle({}), onPause, onPlay, onSend, onStop, onStart, mediaRecorderStyle,
31
31
  pauseIconUrl, playIconUrl, recordIconUrl, deleteIconUrl, stopIconUrl, submitIconUrl
32
32
  } = props;
33
33
 
@@ -263,7 +263,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
263
263
  timerTextColor ? { color: timerTextColor } : { color: "#000" },
264
264
  timerTextstyle && { fontStyle: timerTextstyle },
265
265
  !Boolean(recordedFile) && { marginRight: 10 }
266
- ] as TextStyle}>{formatTime(time)}</Text>
266
+ ] as TextStyle[]}>{formatTime(time)}</Text>
267
267
  <FlatList
268
268
  data={soundBars}
269
269
  keyExtractor={(item) => item.toString()}
@@ -308,8 +308,4 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
308
308
  </View>
309
309
  </View>
310
310
  )
311
- }
312
-
313
- CometChatMediaRecorder.defaultProps = {
314
- style: new MediaRecorderStyle({}),
315
311
  }
@@ -73,10 +73,10 @@ export const CometChatMessageBubble = memo(({
73
73
  LeadingView,
74
74
  BottomView,
75
75
  ThreadView,
76
- alignment,
76
+ alignment = 'left',
77
77
  id,
78
78
  style
79
- }: CometChatMessageBubbleInterface) => {
79
+ }: CometChatMessageBubbleInterface ) => {
80
80
 
81
81
  const {theme} = useContext<CometChatContextType>(CometChatContext);
82
82
 
@@ -143,9 +143,4 @@ export const CometChatMessageBubble = memo(({
143
143
 
144
144
  </View>
145
145
  )
146
- })
147
-
148
- //@ts-ignore
149
- CometChatMessageBubble.defaultProps = {
150
- alignment: "left"
151
- }
146
+ })
@@ -109,33 +109,41 @@ export const CometChatMessageInput = (
109
109
  ) => {
110
110
  const { theme } = useContext<CometChatContextType>(CometChatContext);
111
111
  const {
112
- text,
113
- placeHolderText,
114
112
  onChangeText,
115
- style,
116
113
  maxHeight,
117
114
  SecondaryButtonView,
118
115
  AuxiliaryButtonView,
119
- auxiliaryButtonAlignment,
120
116
  PrimaryButtonView,
121
117
  onSelectionChange,
122
- messageInputRef
118
+ messageInputRef,
119
+ placeHolderText = localize('ENTER_YOUR_MESSAGE_HERE'),
120
+ auxiliaryButtonAlignment = 'right',
121
+ style = {},
122
+ text = '',
123
123
  } = props;
124
124
 
125
125
  return (
126
- <View style={{ backgroundColor: style?.inputBackground ?? theme.palette.getAccent100(), marginHorizontal: 8, borderRadius: 8 }}>
126
+ <View
127
+ style={{
128
+ backgroundColor: style?.inputBackground ?? theme.palette.getAccent100(),
129
+ marginHorizontal: 8,
130
+ borderRadius: 8,
131
+ }}
132
+ >
127
133
  <TextInput
128
134
  ref={messageInputRef}
129
- style={[
130
- styles.textInput,
131
- {
132
- color: style?.textColor ?? theme.palette.getAccent(),
133
- maxHeight: maxHeight ?? 25 * 3,
134
- },
135
- text?.length
136
- ? style?.textFont ?? theme.typography.body
137
- : style?.placeholderTextFont ?? theme.typography.body,
138
- ] as TextInputStyle}
135
+ style={
136
+ [
137
+ styles.textInput,
138
+ {
139
+ color: style?.textColor ?? theme.palette.getAccent(),
140
+ maxHeight: maxHeight ?? 25 * 3,
141
+ },
142
+ text?.length
143
+ ? style?.textFont ?? theme.typography.body
144
+ : style?.placeholderTextFont ?? theme.typography.body,
145
+ ] as TextInputStyle
146
+ }
139
147
  onChangeText={onChangeText}
140
148
  placeholderTextColor={
141
149
  style?.placeholderTextColor
@@ -176,10 +184,3 @@ export const CometChatMessageInput = (
176
184
  </View>
177
185
  );
178
186
  };
179
-
180
- CometChatMessageInput.defaultProps = {
181
- placeHolderText: localize('ENTER_YOUR_MESSAGE_HERE'),
182
- auxiliaryButtonAlignment: 'right',
183
- style: {},
184
- text: '',
185
- };
@@ -1,6 +1,6 @@
1
1
  import React, { useContext } from 'react';
2
2
  import { Text, TextStyle, TouchableOpacity, View } from 'react-native';
3
- import { CometChatContext } from "../../CometChatContext";
3
+ import { CometChatContext } from '../../CometChatContext';
4
4
  import { Styles } from './style';
5
5
  //@ts-ignore
6
6
  import { CometChat } from '@cometchat/chat-sdk-react-native';
@@ -10,17 +10,24 @@ import { MessageBubbleAlignmentType } from '../../base/Types';
10
10
  export interface CometChatReactionsInterface {
11
11
  messageObject?: CometChat.BaseMessage;
12
12
  style?: ReactionsStyleInterface;
13
- onReactionPress?: (reaction: CometChat.ReactionCount, messageObject: CometChat.BaseMessage) => void;
14
- onReactionLongPress?: (reaction: CometChat.ReactionCount, messageObject: CometChat.BaseMessage) => void;
13
+ onReactionPress?: (
14
+ reaction: CometChat.ReactionCount,
15
+ messageObject: CometChat.BaseMessage
16
+ ) => void;
17
+ onReactionLongPress?: (
18
+ reaction: CometChat.ReactionCount,
19
+ messageObject: CometChat.BaseMessage
20
+ ) => void;
15
21
  alignment?: MessageBubbleAlignmentType;
16
22
  }
17
23
  const CometChatReactions = (props: CometChatReactionsInterface) => {
18
24
  const {
19
- messageObject,
20
- style,
21
25
  onReactionPress,
22
26
  onReactionLongPress,
23
27
  alignment,
28
+
29
+ messageObject = null,
30
+ style = {},
24
31
  } = props;
25
32
 
26
33
  const { theme } = useContext(CometChatContext);
@@ -32,7 +39,8 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
32
39
  countColor: style?.countColor || theme?.palette?.getAccent(),
33
40
  countFont: style?.countFont || theme?.typography?.text1,
34
41
  backgroundColor: style?.backgroundColor || theme?.palette?.getAccent100(),
35
- primaryBackgroundColor: style?.primaryBackgroundColor || theme?.palette?.getPrimary150(),
42
+ primaryBackgroundColor:
43
+ style?.primaryBackgroundColor || theme?.palette?.getPrimary150(),
36
44
  primaryBorder: style?.primaryBorder || {
37
45
  borderWidth: 1,
38
46
  borderColor: theme?.palette?.getPrimary500(),
@@ -56,42 +64,60 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
56
64
  const reactionView = (reactionObj: any, index: any) => {
57
65
  let count: number = reactionObj?.count;
58
66
  let Emoji: string = reactionObj?.reaction;
59
- let Count: JSX.Element = <Text
60
- style={[
61
- Styles.reactionCountStyle,
62
- { color: countColor },
63
- countFont,
64
- ] as TextStyle}
65
- >
66
- {count}
67
- </Text>;
67
+ let Count: JSX.Element = (
68
+ <Text
69
+ style={
70
+ [
71
+ Styles.reactionCountStyle,
72
+ { color: countColor },
73
+ countFont,
74
+ ] as TextStyle[]
75
+ }
76
+ >
77
+ {count}
78
+ </Text>
79
+ );
68
80
 
69
81
  return count >= 1 ? (
70
- <View key={index} style={[
71
- Styles.messageReactionsStyle,
72
- {
73
- backgroundColor: reactionObj?.reactedByMe ? primaryBackgroundColor : backgroundColor,
74
- paddingVertical: 0, paddingHorizontal: 0,
75
- },
76
- { backgroundColor: theme.palette.getBackgroundColor() }]}>
82
+ <View
83
+ key={index}
84
+ style={[
85
+ Styles.messageReactionsStyle,
86
+ {
87
+ backgroundColor: reactionObj?.reactedByMe
88
+ ? primaryBackgroundColor
89
+ : backgroundColor,
90
+ paddingVertical: 0,
91
+ paddingHorizontal: 0,
92
+ },
93
+ { backgroundColor: theme.palette.getBackgroundColor() },
94
+ ]}
95
+ >
77
96
  <TouchableOpacity
78
97
  onPress={() => {
79
- onReactionPress && messageObject && onReactionPress(reactionObj, messageObject);
98
+ onReactionPress &&
99
+ messageObject &&
100
+ onReactionPress(reactionObj, messageObject);
80
101
  }}
81
102
  onLongPress={() => {
82
- onReactionLongPress && messageObject && onReactionLongPress(reactionObj, messageObject);
103
+ onReactionLongPress &&
104
+ messageObject &&
105
+ onReactionLongPress(reactionObj, messageObject);
83
106
  }}
84
107
  key={Math.random()}
85
108
  style={[
86
109
  Styles.messageReactionsStyle,
87
110
  {
88
- backgroundColor: reactionObj?.reactedByMe ? primaryBackgroundColor : backgroundColor,
89
- marginRight: 0, marginBottom: 0,
111
+ backgroundColor: reactionObj?.reactedByMe
112
+ ? primaryBackgroundColor
113
+ : backgroundColor,
114
+ marginRight: 0,
115
+ marginBottom: 0,
90
116
  ...(reactionObj?.reactedByMe ? primaryBorder : border),
91
- }
117
+ },
92
118
  ]}
93
119
  >
94
- <Text style={[Styles.reactionListStyle, emojiFont] as TextStyle}>
120
+ <Text style={[Styles.reactionListStyle, emojiFont] as TextStyle[]}>
95
121
  {Emoji}&nbsp;{Count}
96
122
  </Text>
97
123
  </TouchableOpacity>
@@ -100,43 +126,63 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
100
126
  };
101
127
 
102
128
  const extraEmojisView = (numberOfExtraEmojis: number) => {
103
- let extraEmojis = reactionRef.current.slice(reactionRef.current.length - numberOfExtraEmojis);
104
- let hasReactedByMe = extraEmojis.some((reaction: any) => reaction.reactedByMe);
129
+ let extraEmojis = reactionRef.current.slice(
130
+ reactionRef.current.length - numberOfExtraEmojis
131
+ );
132
+ let hasReactedByMe = extraEmojis.some(
133
+ (reaction: any) => reaction.reactedByMe
134
+ );
105
135
 
106
- let totalCount = reactionRef.current.reduce((acc: any, curr: any) => acc + curr.count, 0);
107
- let AllObj = new CometChat.ReactionCount("All", totalCount, false); // { reaction: "All", count: totalCount };
136
+ let totalCount = reactionRef.current.reduce(
137
+ (acc: any, curr: any) => acc + curr.count,
138
+ 0
139
+ );
140
+ let AllObj = new CometChat.ReactionCount('All', totalCount, false); // { reaction: "All", count: totalCount };
108
141
 
109
142
  return (
110
- <View key={new Date().getTime()} style={[
111
- Styles.messageReactionsStyle,
112
- {
113
- paddingVertical: 0, paddingHorizontal: 0,
114
- },
115
- { backgroundColor: theme.palette.getBackgroundColor() }]}>
143
+ <View
144
+ key={new Date().getTime()}
145
+ style={[
146
+ Styles.messageReactionsStyle,
147
+ {
148
+ paddingVertical: 0,
149
+ paddingHorizontal: 0,
150
+ },
151
+ { backgroundColor: theme.palette.getBackgroundColor() },
152
+ ]}
153
+ >
116
154
  <TouchableOpacity
117
155
  onPress={() => {
118
- onReactionLongPress && messageObject && onReactionLongPress(AllObj, messageObject);
156
+ onReactionLongPress &&
157
+ messageObject &&
158
+ onReactionLongPress(AllObj, messageObject);
119
159
  }}
120
160
  onLongPress={() => {
121
- onReactionLongPress && messageObject && onReactionLongPress(AllObj, messageObject);
161
+ onReactionLongPress &&
162
+ messageObject &&
163
+ onReactionLongPress(AllObj, messageObject);
122
164
  }}
123
165
  key={Math.random()}
124
166
  style={[
125
167
  Styles.messageReactionsStyle,
126
168
  {
127
- backgroundColor: hasReactedByMe ? primaryBackgroundColor : backgroundColor,
169
+ backgroundColor: hasReactedByMe
170
+ ? primaryBackgroundColor
171
+ : backgroundColor,
128
172
  ...(hasReactedByMe ? primaryBorder : border),
129
- marginRight: 0, marginBottom: 0,
173
+ marginRight: 0,
174
+ marginBottom: 0,
130
175
  paddingHorizontal: 6,
131
176
  },
132
177
  ]}
133
178
  >
134
- <Text style={[Styles.reactionListStyle, emojiFont] as TextStyle}>
179
+ <Text style={[Styles.reactionListStyle, emojiFont] as TextStyle[]}>
135
180
  +{numberOfExtraEmojis}
136
181
  </Text>
137
182
  </TouchableOpacity>
138
- </View>)
139
- }
183
+ </View>
184
+ );
185
+ };
140
186
 
141
187
  React.useEffect(() => {
142
188
  reactionRef.current = messageObject?.getReactions() || [];
@@ -144,23 +190,31 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
144
190
  if (messageReactions.length > 0) {
145
191
  if (messageReactions.length > 4) {
146
192
  let newMessageReactions: any[] = [...messageReactions].slice(0, 3);
147
- newMessageReactions.push(extraEmojisView(reactionRef.current.length - 3));
193
+ newMessageReactions.push(
194
+ extraEmojisView(reactionRef.current.length - 3)
195
+ );
148
196
  setReactionList(newMessageReactions);
149
197
  } else setReactionList(messageReactions);
150
198
  }
151
199
  }, [messageObject]);
152
200
 
153
201
  return reactionList.length ? (
154
- <View style={[Styles.messageReactionListStyle, { alignSelf: alignment === "right" ? "flex-end" : alignment === "center" ? "center" : "flex-start" }]}>
202
+ <View
203
+ style={[
204
+ Styles.messageReactionListStyle,
205
+ {
206
+ alignSelf:
207
+ alignment === 'right'
208
+ ? 'flex-end'
209
+ : alignment === 'center'
210
+ ? 'center'
211
+ : 'flex-start',
212
+ },
213
+ ]}
214
+ >
155
215
  {reactionList}
156
216
  </View>
157
217
  ) : null;
158
218
  };
159
219
 
160
- // Specifies the default values for props:
161
- CometChatReactions.defaultProps = {
162
- messageObject: null,
163
- style: {},
164
- };
165
-
166
220
  export { CometChatReactions };
@@ -25,13 +25,20 @@ export interface CometChatReceiptInterface {
25
25
  style?: {
26
26
  height?: string | number;
27
27
  width?: string | number;
28
- tintColor?: string
29
- }
28
+ tintColor?: string;
29
+ };
30
30
  }
31
31
 
32
32
  export const CometChatReceipt = (props: CometChatReceiptInterface) => {
33
- const { waitIcon, sentIcon, deliveredIcon, readIcon, errorIcon, receipt, style } =
34
- props;
33
+ const {
34
+ style,
35
+ waitIcon = ICONS.WAITING,
36
+ sentIcon = ICONS.GREY_TICK,
37
+ deliveredIcon = ICONS.GREY_DOUBLE_TICK,
38
+ readIcon = ICONS.BLUE_DOUBLE_TICK,
39
+ errorIcon = ICONS.ERROR_TICK,
40
+ receipt = null,
41
+ } = props;
35
42
 
36
43
  const { theme } = useContext<CometChatContextType>(CometChatContext);
37
44
 
@@ -74,16 +81,17 @@ export const CometChatReceipt = (props: CometChatReceiptInterface) => {
74
81
  } else if (typeof icon === 'number') {
75
82
  imageSource = icon;
76
83
  }
77
- return <Image source={imageSource} style={[styles.tickImageStyle, { tintColor: tintColor, width, height }] as ImageStyle} />;
84
+ return (
85
+ <Image
86
+ source={imageSource}
87
+ style={
88
+ [
89
+ styles.tickImageStyle,
90
+ { tintColor: tintColor, width, height },
91
+ ] as ImageStyle
92
+ }
93
+ />
94
+ );
78
95
  }
79
96
  return null;
80
97
  };
81
-
82
- CometChatReceipt.defaultProps = {
83
- waitIcon: ICONS.WAITING,
84
- sentIcon: ICONS.GREY_TICK,
85
- deliveredIcon: ICONS.GREY_DOUBLE_TICK,
86
- readIcon: ICONS.BLUE_DOUBLE_TICK,
87
- errorIcon: ICONS.ERROR_TICK,
88
- receipt: null,
89
- };
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
2
  // @ts-ignore
3
- import { Image, View, StyleProp, ViewStyle, ViewProps, ImageStyle } from 'react-native';
3
+ import {
4
+ Image,
5
+ View,
6
+ StyleProp,
7
+ ViewStyle,
8
+ ViewProps,
9
+ ImageStyle,
10
+ } from 'react-native';
4
11
  import { Styles } from './styles';
5
12
  import { StatusIndicatorStyle } from './StatusIndicatorStyle';
6
13
  import { ImageType } from '../../base';
@@ -23,13 +30,18 @@ export interface CometChatStatusIndicatorInterface {
23
30
  export const CometChatStatusIndicator = (
24
31
  props: CometChatStatusIndicatorInterface
25
32
  ) => {
26
- const { backgroundImage, backgroundColor } = props;
33
+ const {
34
+ backgroundColor,
35
+
36
+ backgroundImage = undefined,
37
+ style: styleProp = new StatusIndicatorStyle({}),
38
+ } = props;
27
39
 
28
40
  const defaultStyleProps = new StatusIndicatorStyle({});
29
41
  const style = {
30
42
  ...defaultStyleProps,
31
- ...(props.style as object),
32
43
  ...(backgroundColor ? { backgroundColor } : {}),
44
+ ...styleProp as {}
33
45
  };
34
46
 
35
47
  const getView = () => {
@@ -57,8 +69,3 @@ export const CometChatStatusIndicator = (
57
69
 
58
70
  return getView();
59
71
  };
60
-
61
- CometChatStatusIndicator.defaultProps = {
62
- backgroundImage: '',
63
- style: new StatusIndicatorStyle({}),
64
- };