@cometchat/chat-uikit-react-native 4.3.20 → 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 (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 +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 +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
@@ -1,4 +1,10 @@
1
- import React, { forwardRef, useContext, useEffect, useImperativeHandle, useState } from 'react';
1
+ import React, {
2
+ forwardRef,
3
+ useContext,
4
+ useEffect,
5
+ useImperativeHandle,
6
+ useState,
7
+ } from 'react';
2
8
  import {
3
9
  Animated,
4
10
  BackHandler,
@@ -7,7 +13,10 @@ import {
7
13
  PanResponder,
8
14
  TouchableOpacity,
9
15
  View,
10
- Modal, ScrollView, KeyboardAvoidingView, Platform
16
+ Modal,
17
+ ScrollView,
18
+ KeyboardAvoidingView,
19
+ Platform,
11
20
  } from 'react-native';
12
21
  import { Styles } from './style';
13
22
  import { CometChatContext } from '../../CometChatContext';
@@ -26,161 +35,153 @@ export interface CometChatBottomSheetInterface {
26
35
  shadowColor?: string;
27
36
  backgroundColor?: string;
28
37
  lineColor?: string;
29
- lineHeight?: number,
30
- paddingHorizontal?: number,
31
- borderRadius?: number,
38
+ lineHeight?: number;
39
+ paddingHorizontal?: number;
40
+ borderRadius?: number;
32
41
  };
33
42
  }
34
- const CometChatBottomSheet = forwardRef((props: CometChatBottomSheetInterface, ref) => {
35
- const { theme } = useContext<CometChatContextType>(CometChatContext);
36
- const {
37
- sliderMaxHeight,
38
- animationDuration,
39
- animation,
40
- sliderMinHeight,
41
- children,
42
- isOpen,
43
- onOpen,
44
- onClose,
45
- style,
46
- } = props;
43
+ const CometChatBottomSheet = forwardRef(
44
+ (props: CometChatBottomSheetInterface, ref) => {
45
+ const { theme } = useContext<CometChatContextType>(CometChatContext);
46
+ const {
47
+ children = <View />,
48
+ isOpen = true,
49
+ sliderMaxHeight = Dimensions.get('screen').height * 0.9,
50
+ sliderMinHeight = 50,
51
+ animation = Easing.quad,
52
+ animationDuration = 200,
53
+ onOpen = undefined,
54
+ onClose = undefined,
55
+ style = {},
56
+ } = props;
47
57
 
48
- const [contentHeight, setContentHeight] = useState(null);
49
- const panelHeightValue = new Animated.Value(0);
58
+ const [contentHeight, setContentHeight] = useState(null);
59
+ const panelHeightValue = new Animated.Value(0);
50
60
 
51
- const togglePanel = () => {
52
- Animated.timing(panelHeightValue, {
53
- duration: animationDuration,
54
- easing: animation,
55
- toValue:
56
- //@ts-ignore
57
- panelHeightValue._value === 0 ? contentHeight - sliderMinHeight : 0,
58
- useNativeDriver: false,
59
- }).start(() => {
60
- onClose && onClose();
61
- });
62
- return true;
63
- };
64
-
65
- useImperativeHandle(ref, () => {
66
- return {
67
- togglePanel
61
+ const togglePanel = () => {
62
+ Animated.timing(panelHeightValue, {
63
+ duration: animationDuration,
64
+ easing: animation,
65
+ toValue:
66
+ //@ts-ignore
67
+ panelHeightValue._value === 0 ? contentHeight - sliderMinHeight : 0,
68
+ useNativeDriver: false,
69
+ }).start(() => {
70
+ onClose && onClose();
71
+ });
72
+ return true;
68
73
  };
69
- });
70
- const _onBackPress = () => {
71
- isOpen && togglePanel();
72
- return isOpen;
73
- };
74
74
 
75
- const _handleScrollEndDrag = ({ nativeEvent }: any) => {
76
- nativeEvent.contentOffset.y === 0 && togglePanel();
77
- };
75
+ useImperativeHandle(ref, () => {
76
+ return {
77
+ togglePanel,
78
+ };
79
+ });
80
+ const _onBackPress = () => {
81
+ isOpen && togglePanel();
82
+ return isOpen;
83
+ };
78
84
 
79
- const _setSize = ({ nativeEvent }: any) => {
80
- setContentHeight(nativeEvent.layout.height);
81
- };
85
+ const _handleScrollEndDrag = ({ nativeEvent }: any) => {
86
+ nativeEvent.contentOffset.y === 0 && togglePanel();
87
+ };
82
88
 
83
- let _parentPanResponder = PanResponder.create({
84
- onMoveShouldSetPanResponderCapture: () => !isOpen,
85
- onPanResponderRelease: () => togglePanel(),
86
- });
89
+ const _setSize = ({ nativeEvent }: any) => {
90
+ setContentHeight(nativeEvent.layout.height);
91
+ };
87
92
 
88
- let _childPanResponder = PanResponder.create({
89
- onMoveShouldSetPanResponderCapture: (_, gestureState) =>
90
- gestureState.dy > 15,
91
- onPanResponderRelease: (_, gestureState) =>
92
- gestureState.dy > 0 && togglePanel(),
93
- });
93
+ let _parentPanResponder = PanResponder.create({
94
+ onMoveShouldSetPanResponderCapture: () => !isOpen,
95
+ onPanResponderRelease: () => togglePanel(),
96
+ });
94
97
 
95
- useEffect(() => {
98
+ let _childPanResponder = PanResponder.create({
99
+ onMoveShouldSetPanResponderCapture: (_, gestureState) =>
100
+ gestureState.dy > 15,
101
+ onPanResponderRelease: (_, gestureState) =>
102
+ gestureState.dy > 0 && togglePanel(),
103
+ });
96
104
 
97
- BackHandler.addEventListener('hardwareBackPress', _onBackPress);
98
- // onOpen ? onOpen() : () => {};
105
+ useEffect(() => {
106
+ BackHandler.addEventListener('hardwareBackPress', _onBackPress);
107
+ // onOpen ? onOpen() : () => {};
99
108
 
100
- return () => {
101
- BackHandler.removeEventListener('hardwareBackPress', _onBackPress);
102
- };
103
- }, []);
109
+ return () => {
110
+ BackHandler.removeEventListener('hardwareBackPress', _onBackPress);
111
+ };
112
+ }, []);
104
113
 
105
- return (
106
- <Modal
107
- transparent={true}
108
- visible={isOpen}
109
- onRequestClose={() => togglePanel()}
110
- >
111
- <KeyboardAvoidingView style={{ flex: 1 }} behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
114
+ return (
115
+ <Modal
116
+ transparent={true}
117
+ visible={isOpen}
118
+ onRequestClose={() => togglePanel()}
112
119
  >
113
- <View style={Styles.wrapperStyle}>
114
- <View
115
- style={Styles.greyWrapperStyle}
116
- onStartShouldSetResponder={() => togglePanel()}
117
- />
118
- {
119
- //@ts-ignore
120
- <Animated.View
121
- onLayout={_setSize}
122
- {..._parentPanResponder?.panHandlers}
123
- style={{
124
- ...Styles.containerStyle,
125
- backgroundColor:
126
- style?.backgroundColor ?? theme.palette.getBackgroundColor(),
127
- shadowColor: style?.shadowColor ?? theme.palette.getAccent(),
128
- maxHeight: sliderMaxHeight,
129
- minHeight: sliderMinHeight,
130
- transform: [
131
- { translateY: panelHeightValue },
132
- { scale: isOpen ? 1 : 0 },
133
- ],
134
- paddingHorizontal: style?.paddingHorizontal || 5,
135
- borderTopLeftRadius: style?.borderRadius || 30,
136
- borderTopRightRadius: style?.borderRadius || 30,
137
- }}
138
- >
139
- <View
140
- style={Styles.outerContentStyle}
141
- // {..._childPanResponder?.panHandlers}
120
+ <KeyboardAvoidingView
121
+ style={{ flex: 1 }}
122
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
123
+ >
124
+ <View style={Styles.wrapperStyle}>
125
+ <View
126
+ style={Styles.greyWrapperStyle}
127
+ onStartShouldSetResponder={() => togglePanel()}
128
+ />
129
+ {
130
+ //@ts-ignore
131
+ <Animated.View
132
+ onLayout={_setSize}
133
+ {..._parentPanResponder?.panHandlers}
134
+ style={{
135
+ ...Styles.containerStyle,
136
+ backgroundColor:
137
+ style?.backgroundColor ??
138
+ theme.palette.getBackgroundColor(),
139
+ shadowColor: style?.shadowColor ?? theme.palette.getAccent(),
140
+ maxHeight: sliderMaxHeight,
141
+ minHeight: sliderMinHeight,
142
+ transform: [
143
+ { translateY: panelHeightValue },
144
+ { scale: isOpen ? 1 : 0 },
145
+ ],
146
+ paddingHorizontal: style?.paddingHorizontal || 5,
147
+ borderTopLeftRadius: style?.borderRadius || 30,
148
+ borderTopRightRadius: style?.borderRadius || 30,
149
+ }}
142
150
  >
143
- <TouchableOpacity
144
- onPress={togglePanel.bind(this)}
145
- activeOpacity={1}
146
- style={{ height: style?.lineHeight || 30 }}
151
+ <View
152
+ style={Styles.outerContentStyle}
153
+ // {..._childPanResponder?.panHandlers}
147
154
  >
148
- <View style={Styles.lineContainerStyle}>
149
- <View
150
- style={[
151
- Styles.lineStyle,
152
- {
153
- backgroundColor:
154
- style?.lineColor ?? theme.palette.getAccent200(),
155
- },
156
- ]}
157
- />
155
+ <TouchableOpacity
156
+ onPress={togglePanel.bind(this)}
157
+ activeOpacity={1}
158
+ style={{ height: style?.lineHeight || 30 }}
159
+ >
160
+ <View style={Styles.lineContainerStyle}>
161
+ <View
162
+ style={[
163
+ Styles.lineStyle,
164
+ {
165
+ backgroundColor:
166
+ style?.lineColor ?? theme.palette.getAccent200(),
167
+ },
168
+ ]}
169
+ />
170
+ </View>
171
+ </TouchableOpacity>
172
+ <View style={Styles.innerContentStyle}>
173
+ {typeof children === 'function'
174
+ ? children(_handleScrollEndDrag)
175
+ : children}
158
176
  </View>
159
- </TouchableOpacity>
160
- <View style={Styles.innerContentStyle}>
161
- {typeof children === 'function'
162
- ? children(_handleScrollEndDrag)
163
- : children}
164
177
  </View>
165
- </View>
166
- </Animated.View>
167
- }
168
- </View>
169
- </KeyboardAvoidingView>
170
- </Modal>
171
- );
172
- });
173
-
174
- CometChatBottomSheet.defaultProps = {
175
- children: <View />,
176
- isOpen: true,
177
- sliderMaxHeight: Dimensions.get('screen').height * 0.9,
178
- sliderMinHeight: 50,
179
- animation: Easing.quad,
180
- animationDuration: 200,
181
- onOpen: undefined,
182
- onClose: undefined,
183
- style: {},
184
- };
178
+ </Animated.View>
179
+ }
180
+ </View>
181
+ </KeyboardAvoidingView>
182
+ </Modal>
183
+ );
184
+ }
185
+ );
185
186
 
186
187
  export { CometChatBottomSheet };
@@ -6,7 +6,6 @@ import { CometChatContext } from '../../CometChatContext';
6
6
  import { CometChatContextType } from '../../base/Types';
7
7
  import { CometChatConfirmDialogStyleInterface } from './CometChatConfirmDialogStyle';
8
8
 
9
-
10
9
  export interface CometChatConfirmDialogInterface {
11
10
  onConfirm?: Function;
12
11
  onCancel?: Function;
@@ -22,14 +21,14 @@ export const CometChatConfirmDialog = (
22
21
  ) => {
23
22
  const { theme } = useContext<CometChatContextType>(CometChatContext);
24
23
  const {
25
- onConfirm,
26
- onCancel,
27
- isOpen,
28
- style,
29
- title,
30
- messageText,
31
- cancelButtonText,
32
- confirmButtonText,
24
+ isOpen = false,
25
+ title = '',
26
+ confirmButtonText = 'Delete',
27
+ cancelButtonText = 'Cancel',
28
+ messageText = 'Are you sure?',
29
+ onConfirm = () => {},
30
+ onCancel = () => {},
31
+ style = {},
33
32
  } = props;
34
33
  const onClick = (option: any) => {
35
34
  if (option === 'confirm') {
@@ -52,22 +51,27 @@ export const CometChatConfirmDialog = (
52
51
  ]}
53
52
  >
54
53
  <Text
55
- style={[
56
- Style.titleTextStyle,
57
- { color: style?.messageTextColor ?? theme.palette.getAccent() },
58
- style?.titleTextStyle ?? theme.typography.text1,
59
- ] as TextStyle}
54
+ style={
55
+ [
56
+ Style.titleTextStyle,
57
+ { color: style?.messageTextColor ?? theme.palette.getAccent() },
58
+ style?.titleTextStyle ?? theme.typography.text1,
59
+ ] as TextStyle[]
60
+ }
60
61
  >
61
62
  {title}
62
63
  </Text>
63
64
  <Text
64
- style={[
65
- Style.messageTextStyle,
66
- {
67
- color: style?.messageTextColor ?? theme.palette.getAccent700(),
68
- },
69
- style?.messageTextStyle ?? theme.typography.subtitle1,
70
- ] as TextStyle}
65
+ style={
66
+ [
67
+ Style.messageTextStyle,
68
+ {
69
+ color:
70
+ style?.messageTextColor ?? theme.palette.getAccent700(),
71
+ },
72
+ style?.messageTextStyle ?? theme.typography.subtitle1,
73
+ ] as TextStyle[]
74
+ }
71
75
  >
72
76
  {messageText}
73
77
  </Text>
@@ -82,15 +86,17 @@ export const CometChatConfirmDialog = (
82
86
  ]}
83
87
  >
84
88
  <Text
85
- style={[
86
- Style.cancelButtonTextStyle,
87
- {
88
- color:
89
- style?.cancelButtonTextColor ??
90
- theme.palette.getPrimary(),
91
- },
92
- style?.cancelButtonTextFont ?? theme.typography.text2,
93
- ] as TextStyle}
89
+ style={
90
+ [
91
+ Style.cancelButtonTextStyle,
92
+ {
93
+ color:
94
+ style?.cancelButtonTextColor ??
95
+ theme.palette.getPrimary(),
96
+ },
97
+ style?.cancelButtonTextFont ?? theme.typography.text2,
98
+ ] as TextStyle[]
99
+ }
94
100
  >
95
101
  {cancelButtonText?.toUpperCase()}
96
102
  </Text>
@@ -105,15 +111,17 @@ export const CometChatConfirmDialog = (
105
111
  ]}
106
112
  >
107
113
  <Text
108
- style={[
109
- Style.confirmButtonTextStyle,
110
- {
111
- color:
112
- style?.confirmButtonTextColor ??
113
- theme.palette.getPrimary(),
114
- },
115
- style?.confirmButtonTextFont ?? theme.typography.text2,
116
- ] as TextStyle}
114
+ style={
115
+ [
116
+ Style.confirmButtonTextStyle,
117
+ {
118
+ color:
119
+ style?.confirmButtonTextColor ??
120
+ theme.palette.getPrimary(),
121
+ },
122
+ style?.confirmButtonTextFont ?? theme.typography.text2,
123
+ ] as TextStyle[]
124
+ }
117
125
  >
118
126
  {confirmButtonText?.toUpperCase()}
119
127
  </Text>
@@ -124,15 +132,3 @@ export const CometChatConfirmDialog = (
124
132
  </Modal>
125
133
  );
126
134
  };
127
-
128
- CometChatConfirmDialog.defaultProps = {
129
- isOpen: false,
130
- title: '',
131
- confirmButtonText: 'Delete',
132
- cancelButtonText: 'Cancel',
133
- messageText: 'Are you sure?',
134
- onConfirm: () => {},
135
- onCancel: () => {},
136
- style: {},
137
- };
138
-
@@ -66,25 +66,27 @@ export interface CometChatDateInterface {
66
66
  */
67
67
  style?: DateStyleInterface;
68
68
  /**
69
- *
69
+ *
70
70
  */
71
- dateAlignment?: "auto" | "left" | "right" | "center" | "justify" | undefined;
71
+ dateAlignment?: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined;
72
72
  }
73
73
 
74
74
  export const CometChatDate = (props: CometChatDateInterface) => {
75
75
  const { theme } = useContext<CometChatContextType>(CometChatContext);
76
- const { timeStamp, pattern, customDateString, dateAlignment } = props;
76
+ const {
77
+ dateAlignment,
78
+ timeStamp = 0,
79
+ pattern = patterns.timeFormat,
80
+ customDateString = null,
81
+ style: styleProps = new DateStyle({}),
82
+ } = props;
77
83
 
78
- const defaultStyleProps = new DateStyle({
84
+ const style = new DateStyle({
79
85
  textFont: theme.typography.caption1,
80
86
  textColor: theme.palette.getAccent500(),
87
+ ...styleProps,
81
88
  });
82
89
 
83
- const style = {
84
- ...defaultStyleProps,
85
- ...props.style,
86
- };
87
-
88
90
  let date = new Date(timeStamp);
89
91
 
90
92
  const getWeekOfDay = () => {
@@ -175,17 +177,16 @@ export const CometChatDate = (props: CometChatDateInterface) => {
175
177
  ]}
176
178
  >
177
179
  <Text
178
- style={[Style.textStyle, style.textFont, { color: style.textColor, textAlign: dateAlignment }] as TextStyle}
180
+ style={
181
+ [
182
+ Style.textStyle,
183
+ style.textFont,
184
+ { color: style.textColor, textAlign: dateAlignment },
185
+ ] as TextStyle[]
186
+ }
179
187
  >
180
188
  {customDateString ? customDateString : getFormattedDate()}
181
189
  </Text>
182
190
  </View>
183
191
  );
184
192
  };
185
-
186
- CometChatDate.defaultProps = {
187
- timeStamp: 0,
188
- pattern: patterns.timeFormat,
189
- customDateString: null,
190
- style: new DateStyle({}),
191
- };