@cometchat/chat-uikit-react-native 4.3.3 → 4.3.5

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 (92) hide show
  1. package/README.md +11 -21
  2. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +6 -6
  3. package/ios/CommonUtil.h +4 -0
  4. package/ios/CommonUtil.m +27 -0
  5. package/package.json +10 -5
  6. package/src/AI/AIAssistBot/AIAssistBotDecorator.tsx +0 -3
  7. package/src/CometChatConversations/CometChatConversations.tsx +143 -72
  8. package/src/CometChatConversations/ConversationsConfiguration.ts +25 -4
  9. package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +29 -29
  10. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +11 -1
  11. package/src/CometChatGroups/CometChatGroups.tsx +10 -0
  12. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +554 -52
  13. package/src/CometChatMessageComposer/MessageComposerConfiguration.tsx +12 -1
  14. package/src/CometChatMessageComposer/resources/Info.png +0 -0
  15. package/src/CometChatMessageComposer/resources/index.ts +3 -1
  16. package/src/CometChatMessageHeader/listners.ts +0 -2
  17. package/src/CometChatMessageList/CometChatMessageList.tsx +124 -15
  18. package/src/CometChatMessageList/MessageListConfiguration.ts +14 -1
  19. package/src/CometChatMessages/CometChatMessages.tsx +16 -16
  20. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -1
  21. package/src/calls/CallingExtentionDecorator.tsx +11 -9
  22. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +3 -3
  23. package/src/calls/CometChatCallLogHistory/CometChatCallLogHistory.tsx +10 -0
  24. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +10 -0
  25. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +2 -0
  26. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +2 -0
  27. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +3 -3
  28. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +3 -3
  29. package/src/extensions/LinkPreview/LinkPreviewExtentionDecorator.tsx +4 -4
  30. package/src/extensions/MessageTranslation/MessageTranslationBubble.tsx +31 -9
  31. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +83 -6
  32. package/src/extensions/Polls/Polls.tsx +106 -70
  33. package/src/extensions/Polls/PollsDecorator.tsx +3 -2
  34. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +3 -3
  35. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +14 -6
  36. package/src/extensions/TextModeration/TextModerationExtensionDecorator.tsx +3 -3
  37. package/src/index.ts +21 -0
  38. package/src/shared/CometChatUiKit/CometChatUIKit.ts +150 -25
  39. package/src/shared/CometChatUiKit/index.ts +1 -1
  40. package/src/shared/base/vars.ts +13 -0
  41. package/src/shared/constants/UIKitConstants.ts +6 -0
  42. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +7 -0
  43. package/src/shared/events/CometChatUIEventHandler/Listener.ts +11 -1
  44. package/src/shared/events/CometChatUIEvents.ts +3 -1
  45. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +380 -0
  46. package/src/shared/formatters/CometChatMentionsFormatter/MentionTextStyle.ts +14 -0
  47. package/src/shared/formatters/CometChatMentionsFormatter/index.ts +7 -0
  48. package/src/shared/formatters/CometChatTextFormatter.ts +253 -0
  49. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +146 -0
  50. package/src/shared/formatters/index.ts +11 -0
  51. package/src/shared/framework/DataSource.ts +21 -16
  52. package/src/shared/framework/DataSourceDecorator.tsx +29 -13
  53. package/src/shared/framework/MessageDataSource.tsx +215 -49
  54. package/src/shared/helper/useKeyboard.tsx +20 -2
  55. package/src/shared/index.ts +23 -3
  56. package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +2 -0
  57. package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +11 -1
  58. package/src/shared/resources/CometChatLocalize/resources/de/translation.json +11 -1
  59. package/src/shared/resources/CometChatLocalize/resources/en/translation.json +10 -1
  60. package/src/shared/resources/CometChatLocalize/resources/es/translation.json +11 -1
  61. package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +11 -1
  62. package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +10 -1
  63. package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +315 -0
  64. package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +11 -1
  65. package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +11 -1
  66. package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +12 -1
  67. package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +11 -1
  68. package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +11 -1
  69. package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +11 -1
  70. package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +11 -1
  71. package/src/shared/resources/CometChatTheme/Palette.ts +16 -0
  72. package/src/shared/utils/InteractiveMessageUtils.ts +39 -1
  73. package/src/shared/utils/PermissionUtil.ts +142 -0
  74. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +8 -6
  75. package/src/shared/views/CometChatAvatar/CometChatAvatar.tsx +5 -1
  76. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +12 -11
  77. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +7 -5
  78. package/src/shared/views/CometChatList/CometChatList.tsx +12 -0
  79. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +11 -2
  80. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +3 -2
  81. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +3 -3
  82. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +12 -0
  83. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +64 -0
  84. package/src/shared/views/CometChatSuggestionList/SuggestionItem.ts +48 -0
  85. package/src/shared/views/CometChatSuggestionList/SuggestionListConfiguration.ts +23 -0
  86. package/src/shared/views/CometChatSuggestionList/index.ts +11 -0
  87. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +33 -46
  88. package/src/shared/views/CometChatTextBubble/TextBubbleStyle.ts +0 -14
  89. package/src/shared/views/CometChatTextBubble/index.ts +2 -3
  90. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +5 -3
  91. package/src/shared/views/index.ts +9 -3
  92. package/src/shared/utils/PermissionUtilIOS.ts +0 -104
@@ -0,0 +1,142 @@
1
+ import {
2
+ Alert,
3
+ Linking,
4
+ NativeModules,
5
+ PermissionsAndroid,
6
+ Platform,
7
+ } from 'react-native';
8
+ import { localize } from '../resources/CometChatLocalize/CometChatLocalize';
9
+ const { FileManager } = NativeModules;
10
+
11
+ let instance: PermissionUtilIOS;
12
+ const permissionStatus = {
13
+ 'Not Determined': 0,
14
+ 'Restricted': 1,
15
+ 'Denied': 2,
16
+ 'Authorized': 3,
17
+ 'Unknown': -1,
18
+ } as const;
19
+
20
+ const permissionStatusAndroid = {
21
+ granted: 3,
22
+ denied: 2,
23
+ never_ask_again: 2,
24
+ } as const;
25
+
26
+ const permissibleResources = ['camera', 'mic'] as const;
27
+
28
+ const permissionMapAndroid = {
29
+ camera: PermissionsAndroid.PERMISSIONS.CAMERA,
30
+ mic: PermissionsAndroid.PERMISSIONS.RECORD_AUDIO,
31
+ };
32
+
33
+ type TPermissibleResources = (typeof permissibleResources)[number];
34
+
35
+ type ValueOf<T> = T[keyof T];
36
+ type TPermissionStatus = ValueOf<typeof permissionStatus>;
37
+
38
+ const permissionStore: Record<TPermissibleResources, TPermissionStatus> = {
39
+ camera: permissionStatus.Unknown,
40
+ mic: permissionStatus.Unknown,
41
+ };
42
+
43
+ class PermissionUtilIOS {
44
+ status = permissionStatus;
45
+ constructor() {
46
+ if (instance) {
47
+ throw new Error('New instance cannot be created!!');
48
+ }
49
+ instance = this;
50
+ }
51
+
52
+ async init() {
53
+ try {
54
+ if (Platform.OS === "ios") {
55
+ const res: Record<TPermissibleResources, TPermissionStatus> =
56
+ await FileManager.checkResourcesPermission(['mic', 'camera']);
57
+ for (const resourceType in res) {
58
+ permissionStore[resourceType as TPermissibleResources] =
59
+ res[resourceType as TPermissibleResources];
60
+ }
61
+ permissionStore.camera = res.camera;
62
+ permissionStore.mic = res.mic;
63
+ } else if (Platform.OS === "android") {
64
+ for (const resourceType of permissibleResources) {
65
+ const isGranted = await PermissionsAndroid.check(permissionMapAndroid[resourceType]);
66
+ permissionStore[resourceType] = isGranted ? permissionStatus.Authorized : permissionStatus['Not Determined'];
67
+ }
68
+ }
69
+ return true;
70
+ } catch (error: any) {
71
+ return false;
72
+ }
73
+ }
74
+
75
+ async get(resources: TPermissibleResources[]) {
76
+ return resources.map((resource) => {
77
+ if (!permissibleResources.includes(resource)) {
78
+ throw new Error('Invalid resource type');
79
+ }
80
+ return permissionStore[resource];
81
+ });
82
+ }
83
+
84
+ async request(resources: TPermissibleResources[]) {
85
+ for (const resource of resources) {
86
+ if (!permissibleResources.includes(resource)) {
87
+ throw new Error('Invalid resource type');
88
+ }
89
+ }
90
+ if (Platform.OS === 'ios') {
91
+ const res: Record<TPermissibleResources, TPermissionStatus> =
92
+ await FileManager.requestResourcesPermission(resources);
93
+ for (const resourceType in res) {
94
+ permissionStore[resourceType as TPermissibleResources] =
95
+ res[resourceType as TPermissibleResources];
96
+ }
97
+ } else if (Platform.OS === 'android') {
98
+ const res = await PermissionsAndroid.requestMultiple(resources.map(item => permissionMapAndroid[item]));
99
+ const permissionMapAndroidRevert = {};
100
+ for (const resource in permissionMapAndroid) {
101
+ permissionMapAndroidRevert[permissionMapAndroid[resource]] = resource;
102
+ }
103
+ for (const androidResource in res) {
104
+ permissionStore[permissionMapAndroidRevert[androidResource]] =
105
+ permissionStatusAndroid[res[androidResource]];
106
+ }
107
+ }
108
+ }
109
+
110
+ async startResourceBasedTask(resources: TPermissibleResources[]) {
111
+ const resourcePermStatuses = await this.get(resources);
112
+ let allResourcesAllowed = true;
113
+ for (let i = 0; i < resourcePermStatuses.length; i++) {
114
+ const resourcePermStatus = resourcePermStatuses[i];
115
+ if (resourcePermStatus === this.status['Not Determined'] || (Platform.OS === "android" && resourcePermStatuses[i] === this.status.Denied)) {
116
+ await this.request([resources[i]]);
117
+ [resourcePermStatuses[i]] = await this.get([resources[i]]);
118
+ }
119
+ if (resourcePermStatuses[i] === this.status.Denied) {
120
+ allResourcesAllowed = false;
121
+ }
122
+ }
123
+ if (allResourcesAllowed === false) {
124
+ Alert.alert(localize('RESOURCE_PERMISSION_REQUIRED'), undefined, [
125
+ {
126
+ style: 'cancel',
127
+ text: localize('CANCEL'),
128
+ },
129
+ {
130
+ style: 'default',
131
+ text: localize('SETTINGS'),
132
+ onPress: () => {
133
+ Linking.openSettings();
134
+ },
135
+ },
136
+ ]);
137
+ }
138
+ return allResourcesAllowed;
139
+ }
140
+ }
141
+
142
+ export const permissionUtil = Object.freeze(new PermissionUtilIOS());
@@ -1,5 +1,5 @@
1
1
  import React, { useRef, useEffect, useContext } from "react";
2
- import { View, Text, Image, NativeModules, ActivityIndicator, NativeEventEmitter } from "react-native";
2
+ import { View, Text, Image, NativeModules, ActivityIndicator, NativeEventEmitter, Platform } from "react-native";
3
3
  import { CometChatContext } from "../../CometChatContext";
4
4
  import { CometChatContextType, ImageType } from "../../base/Types";
5
5
  import { AudioBubbleStyle, AudioBubbleStyleInterface } from "./AudioBubbleStyle";
@@ -137,7 +137,7 @@ export const CometChatAudioBubble = ({
137
137
  };
138
138
 
139
139
  const handleTouchEnd = () => {
140
- // if (pressTime.current === null) return;
140
+ if (pressTime.current === null && Platform.OS === "ios") return;
141
141
  const endTime = Date.now();
142
142
  const pressDuration = endTime - pressTime.current;
143
143
  if (pressDuration < 500) {
@@ -145,9 +145,11 @@ export const CometChatAudioBubble = ({
145
145
  }
146
146
  };
147
147
 
148
- // const onTouchMove = () => {
149
- // pressTime.current = null
150
- // }
148
+ const onTouchMove = () => {
149
+ if (Platform.OS === "ios") {
150
+ pressTime.current = null
151
+ }
152
+ }
151
153
 
152
154
  return (
153
155
  <View style={[Style.container, { backgroundColor, ...border, borderRadius, height, width }]}>
@@ -157,7 +159,7 @@ export const CometChatAudioBubble = ({
157
159
  <View
158
160
  onTouchStart={handleTouchStart}
159
161
  onTouchEnd={handleTouchEnd}
160
- // onTouchMove={onTouchMove}
162
+ onTouchMove={onTouchMove}
161
163
  >
162
164
  <Image
163
165
  source={
@@ -46,7 +46,11 @@ export const CometChatAvatar = (props: CometChatAvatarProps) => {
46
46
  };
47
47
 
48
48
  const getImageView = () => {
49
- if (!image && name) {
49
+ let isImage = Boolean(image);
50
+ if (image && image.hasOwnProperty("uri") && typeof image.uri !== "string") {
51
+ isImage = false;
52
+ }
53
+ if (!isImage && name) {
50
54
  return (
51
55
  <Text
52
56
  style={[
@@ -68,6 +68,8 @@ export const CometChatFileBubble = ({
68
68
  const downloadFile = () => {
69
69
  if (processing) return;
70
70
 
71
+ if(!fileUrl) return;
72
+
71
73
  setProcessing(true);
72
74
  FileManager.checkAndDownload(fileUrl, getFileName(), async (storedFilePath) => {
73
75
  console.log(storedFilePath);
@@ -78,6 +80,8 @@ export const CometChatFileBubble = ({
78
80
  const downloadAndOpen = () => {
79
81
  if (processing) return;
80
82
 
83
+ if(!fileUrl) return;
84
+
81
85
  setProcessing(true);
82
86
  FileManager.openFile(fileUrl, getFileName(), async (isOpened: string) => {
83
87
  console.log(isOpened);
@@ -94,11 +98,11 @@ export const CometChatFileBubble = ({
94
98
  onTouchStart: () => {
95
99
  wrapperPressTime.current = Date.now();
96
100
  },
97
- // onTouchMove: () => {
98
- // wrapperPressTime.current = null
99
- // },
101
+ onTouchMove: () => {
102
+ wrapperPressTime.current = null
103
+ },
100
104
  onTouchEnd: () => {
101
- // if (wrapperPressTime.current === null) return;
105
+ if (wrapperPressTime.current === null) return;
102
106
  const endTime = Date.now();
103
107
  const pressDuration = endTime - wrapperPressTime.current;
104
108
  if (pressDuration < 500) {
@@ -115,11 +119,8 @@ export const CometChatFileBubble = ({
115
119
  },
116
120
  // onTouchMove: () => {
117
121
  // pressTimeOnAndroid.current = null
118
- // }
119
- } : {};
120
-
121
- const shouldDownloadAndOpen = () => {
122
- if (Platform.OS === "android") {
122
+ // },
123
+ onTouchEnd: () => {
123
124
  // if (pressTimeOnAndroid.current === null) return;
124
125
  const endTime = Date.now();
125
126
  const pressDuration = endTime - pressTimeOnAndroid.current;
@@ -127,7 +128,7 @@ export const CometChatFileBubble = ({
127
128
  downloadAndOpen();
128
129
  }
129
130
  }
130
- }
131
+ } : {};
131
132
 
132
133
  const shouldDownload = () => {
133
134
  if (Platform.OS === "android") {
@@ -142,7 +143,7 @@ export const CometChatFileBubble = ({
142
143
 
143
144
  return (
144
145
  <View {...viewProps} style={[Style.container, { backgroundColor, borderWidth: border.borderWidth, borderColor: border.borderColor, borderRadius, height, width }]}>
145
- <View {...viewPropsForAndroid} onTouchEnd={shouldDownloadAndOpen} style={Style.messageInfoStyle}>
146
+ <View {...viewPropsForAndroid} style={Style.messageInfoStyle}>
146
147
  {
147
148
  title && <Text
148
149
  numberOfLines={1}
@@ -108,7 +108,7 @@ export const CometChatImageBubble = (props: CometChatImageBubbleInterface) => {
108
108
  };
109
109
 
110
110
  const handleTouchEnd = () => {
111
- // if (pressTime.current === null) return;
111
+ if (pressTime.current === null && Platform.OS === "ios") return;
112
112
  const endTime = Date.now();
113
113
  const pressDuration = endTime - pressTime.current;
114
114
  if (pressDuration < 500) {
@@ -116,9 +116,11 @@ export const CometChatImageBubble = (props: CometChatImageBubbleInterface) => {
116
116
  }
117
117
  };
118
118
 
119
- // const onTouchMove = () => {
120
- // pressTime.current = null
121
- // }
119
+ const onTouchMove = () => {
120
+ if (Platform.OS === "ios") {
121
+ pressTime.current = null;
122
+ }
123
+ }
122
124
 
123
125
  useLayoutEffect(() => {
124
126
  if(isHttpUrl(thumbnailUrl?.uri ?? imageUrl?.uri)) {
@@ -141,7 +143,7 @@ export const CometChatImageBubble = (props: CometChatImageBubbleInterface) => {
141
143
  <View
142
144
  onTouchStart={handleTouchStart}
143
145
  onTouchEnd={handleTouchEnd}
144
- // onTouchMove={onTouchMove}
146
+ onTouchMove={onTouchMove}
145
147
  style={{
146
148
  justifyContent:'center',
147
149
  alignItems: 'center',
@@ -38,6 +38,7 @@ import { StatusIndicatorStyleInterface } from '../CometChatStatusIndicator';
38
38
 
39
39
  export interface CometChatListActionsInterface {
40
40
  updateList: (prop: any) => void;
41
+ updateAndMoveToFirst: (item: any) => void;
41
42
  addItemToList: (item: any, position?: number) => void;
42
43
  removeItemFromList: (itemId: string | number) => void;
43
44
  getListItem: (itemId: string | number) => void;
@@ -203,6 +204,8 @@ export const CometChatList = React.forwardRef<
203
204
  const listHandlerRef = React.useRef(null);
204
205
  const initialRunRef = React.useRef(true);
205
206
 
207
+ const activeSwipeRows = React.useRef({});
208
+
206
209
  const [list, setList] = React.useState<any>([]);
207
210
  const [decoratorMessage, setDecoratorMessage] = React.useState(LOADING);
208
211
 
@@ -524,6 +527,15 @@ export const CometChatList = React.forwardRef<
524
527
  }
525
528
  avatarStyle={avatarStyle}
526
529
  options={() => options && options(item.value)}
530
+ activeSwipeRows={activeSwipeRows.current}
531
+ rowOpens={(id) => {
532
+ Object.keys(activeSwipeRows.current).forEach(key => {
533
+ if(id !== key && activeSwipeRows.current[key]) {
534
+ activeSwipeRows.current[key]?.current?.closeRow?.()
535
+ delete activeSwipeRows.current[key]
536
+ }
537
+ })
538
+ }}
527
539
  onPress={() => {
528
540
  onListItemPress(item);
529
541
  }}
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useState } from 'react';
1
+ import React, { useContext, useEffect, useRef, useState } from 'react';
2
2
 
3
3
  import {
4
4
  View,
@@ -46,6 +46,8 @@ export interface CometChatListItemInterface {
46
46
  headViewContainerStyle?: StyleProp<ViewStyle>;
47
47
  tailViewContainerStyle?: StyleProp<ViewStyle>;
48
48
  bodyViewContainerStyle?: StyleProp<ViewStyle>;
49
+ activeSwipeRows?: Object;
50
+ rowOpens?: (id: string | number) => void;
49
51
  }
50
52
  export const CometChatListItem = (props: CometChatListItemInterface) => {
51
53
  //state for translateX
@@ -71,8 +73,11 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
71
73
  bodyViewContainerStyle,
72
74
  onPress,
73
75
  onLongPress,
76
+ rowOpens,
77
+ activeSwipeRows
74
78
  } = props;
75
-
79
+
80
+ const swipeRowRef = useRef(null)
76
81
  const defaultlistItemStyleProps = new ListItemStyle({
77
82
  backgroundColor: theme.palette.getBackgroundColor(),
78
83
  titleColor: theme.palette.getAccent(),
@@ -180,6 +185,8 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
180
185
  };
181
186
 
182
187
  const rowOpened = () => {
188
+ activeSwipeRows[id] = swipeRowRef
189
+ rowOpens && rowOpens(id)
183
190
  cancelClick = true;
184
191
  };
185
192
 
@@ -247,6 +254,7 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
247
254
 
248
255
  let WrapperComponent = swipeRowOptions.length ? SwipeRow : React.Fragment;
249
256
  let wrapperComponentProps = swipeRowOptions.length ? {
257
+ ref: swipeRowRef,
250
258
  key: id,
251
259
  onRowDidOpen: rowOpened,
252
260
  onRowDidClose: rowClosed,
@@ -313,4 +321,5 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
313
321
  CometChatListItem.defaultProps = {
314
322
  listItemStyle: new ListItemStyle({}),
315
323
  hideSeparator: true,
324
+ activeSwipeRows: {}
316
325
  };
@@ -136,7 +136,6 @@ export const CometChatMessageInput = (
136
136
  : style.placeholderTextFont ?? theme.typography.body,
137
137
  ]}
138
138
  onChangeText={onChangeText}
139
- value={text}
140
139
  placeholderTextColor={
141
140
  style.placeholderTextColor
142
141
  ? style.placeholderTextColor
@@ -146,7 +145,9 @@ export const CometChatMessageInput = (
146
145
  textAlignVertical="top"
147
146
  placeholder={placeHolderText}
148
147
  onSelectionChange={onSelectionChange}
149
- />
148
+ >
149
+ {text}
150
+ </TextInput>
150
151
  <View
151
152
  style={{
152
153
  flexDirection: 'row',
@@ -53,7 +53,7 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
53
53
  primaryBorder,
54
54
  } = _style;
55
55
 
56
- const reactionView = (reactionObj) => {
56
+ const reactionView = (reactionObj, index) => {
57
57
  let count: number = reactionObj?.count;
58
58
  let Emoji: string = reactionObj?.reaction;
59
59
  let Count: JSX.Element = <Text
@@ -67,7 +67,7 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
67
67
  </Text>;
68
68
 
69
69
  return count >= 1 ? (
70
- <View style={[
70
+ <View key={index} style={[
71
71
  Styles.messageReactionsStyle,
72
72
  {
73
73
  backgroundColor: reactionObj?.reactedByMe ? primaryBackgroundColor : backgroundColor,
@@ -107,7 +107,7 @@ const CometChatReactions = (props: CometChatReactionsInterface) => {
107
107
  let AllObj = new CometChat.ReactionCount("All", totalCount, false); // { reaction: "All", count: totalCount };
108
108
 
109
109
  return (
110
- <View style={[
110
+ <View key={new Date().getTime()} style={[
111
111
  Styles.messageReactionsStyle,
112
112
  {
113
113
  paddingVertical: 0, paddingHorizontal: 0,
@@ -39,6 +39,7 @@ import CometChatQuickView from "../CometChatQuickView/CometChatQuickView";
39
39
  import { localize } from "../../resources";
40
40
  import { CometChatUIKit } from "../../CometChatUiKit";
41
41
  import { CometChatUiKitConstants } from "../..";
42
+ import { InteractiveMessageUtils } from "../../utils/InteractiveMessageUtils";
42
43
 
43
44
  const { TimeZoneCodeManager } = NativeModules;
44
45
  export interface CometChatSchedulerBubbleInterface {
@@ -621,6 +622,17 @@ export const CometChatSchedulerBubble = memo(
621
622
  useEffect(() => {
622
623
  CometChat.getLoggedinUser()
623
624
  .then((u) => {
625
+ let hasInteractionCompleted: boolean = InteractiveMessageUtils.checkHasInteractionCompleted({
626
+ interactedElements: message?.getInteractions() || [],
627
+ interactionGoal: message?.getInteractionGoal() || undefined
628
+ });
629
+ if(hasInteractionCompleted) {
630
+ setCurrentComp((prev) => ({
631
+ current: componentEnum.interacted,
632
+ previous: prev.current,
633
+ }));
634
+ return
635
+ }
624
636
  TimeZoneCodeManager.getCurrentTimeZone((timeZone) => {
625
637
  currentTimeZoneRef.current = timeZone;
626
638
  });
@@ -0,0 +1,64 @@
1
+ import { View, Text, FlatList, ListRenderItemInfo, ActivityIndicator } from 'react-native'
2
+ import React from 'react'
3
+ import { SuggestionItem } from './SuggestionItem';
4
+ import { CometChatListItem, ListItemStyle } from '../CometChatListItem';
5
+ import { AvatarStyleInterface } from '../CometChatAvatar';
6
+
7
+ export interface CometChatSuggestionListInterface {
8
+ separatorColor?: string
9
+ /**
10
+ * Array of selection items
11
+ */
12
+ data: Array<SuggestionItem>;
13
+ listItemStyle?: ListItemStyle;
14
+ avatarStyle?: AvatarStyleInterface;
15
+ onPress: (item: SuggestionItem) => void;
16
+ onEndReached?: () => void;
17
+ loading?: boolean;
18
+ }
19
+
20
+ export const CometChatSuggestionList = (props: CometChatSuggestionListInterface) => {
21
+ const { data, avatarStyle, listItemStyle, separatorColor, onPress, onEndReached, loading } = props;
22
+
23
+ const _render = ({ item, index }: ListRenderItemInfo<SuggestionItem>) => {
24
+ let shouldLoadAvatarName = item.hideLeadingIcon ? {} : { avatarName: item.name }
25
+ return (
26
+ <CometChatListItem
27
+ key={index}
28
+ id={item.id}
29
+ title={item.name}
30
+ avatarStyle={{ ...avatarStyle }}
31
+ avatarURL={item.leadingIconUrl ? { uri: item.leadingIconUrl } : undefined}
32
+ listItemStyle={{ ...listItemStyle }}
33
+ onPress={() => onPress(item)}
34
+ {...shouldLoadAvatarName}
35
+ />
36
+ );
37
+ }
38
+
39
+ return (
40
+ <View>
41
+ <FlatList
42
+ data={data}
43
+ renderItem={_render}
44
+ onEndReached={({ distanceFromEnd }) => {
45
+ if (distanceFromEnd < 0) return;
46
+ onEndReached();
47
+ }}
48
+ ItemSeparatorComponent={() => <View style={{ height: 1, marginLeft: 5, backgroundColor: separatorColor }}></View>}
49
+ onEndReachedThreshold={0.3}
50
+ keyboardShouldPersistTaps={"always"}
51
+ style={{
52
+ paddingLeft: 5
53
+ }}
54
+ />
55
+ <View style={{
56
+ position: 'absolute',
57
+ bottom: 0,
58
+ width: '100%',
59
+ }}>
60
+ {loading && <ActivityIndicator animating={loading} />}
61
+ </View>
62
+ </View>
63
+ )
64
+ }
@@ -0,0 +1,48 @@
1
+
2
+ export class SuggestionItem {
3
+ /**
4
+ * Unique identifier of item
5
+ */
6
+ id: string;
7
+ /**
8
+ * Name to be displayed in the list
9
+ */
10
+ name: string;
11
+ /**
12
+ * Avatar Icon Url
13
+ */
14
+ leadingIconUrl?: string;
15
+ /**
16
+ * Hide leading icon
17
+ * @default true
18
+ */
19
+ hideLeadingIcon?: boolean = true;
20
+ /**
21
+ * Presence Indicator
22
+ */
23
+ status?: 'online' | 'offline';
24
+ /**
25
+ * Name to be displayed in the composer
26
+ */
27
+ promptText: string;
28
+ /**
29
+ * underlying text
30
+ * @example <@uid:superhero1>
31
+ */
32
+ underlyingText: string;
33
+ /**
34
+ * set a tracking character.
35
+ * @description string length has be 1.
36
+ * @example '@' | '#' etc.
37
+ */
38
+ trackingCharacter: string
39
+ /**
40
+ * extra data to be passed in JSON format
41
+ */
42
+ data?: JSON;
43
+
44
+ constructor(props: SuggestionItem) {
45
+ Object.assign(this, props);
46
+ }
47
+
48
+ }
@@ -0,0 +1,23 @@
1
+ import { AvatarStyleInterface } from "../CometChatAvatar";
2
+ import { ListItemStyle } from "../CometChatListItem";
3
+ import { CometChatSuggestionListInterface } from "./CometChatSuggestionList";
4
+ import { SuggestionItem } from "./SuggestionItem";
5
+
6
+ export interface SuggestionListConfigurationInterface extends CometChatSuggestionListInterface { }
7
+
8
+ export class SuggestionListConfiguration {
9
+ separatorColor: string
10
+ /**
11
+ * Array of selection items
12
+ */
13
+ data: Array<SuggestionItem>;
14
+ listItemStyle?: ListItemStyle
15
+ avatarStyle?: AvatarStyleInterface
16
+ onPress: (item: SuggestionItem) => void
17
+ onEndReached?: () => void
18
+ loading?: boolean
19
+
20
+ constructor(props: SuggestionListConfigurationInterface) {
21
+ Object.assign(this, props);
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ import { CometChatSuggestionList, CometChatSuggestionListInterface } from './CometChatSuggestionList';
2
+ import { SuggestionItem } from './SuggestionItem';
3
+ import { SuggestionListConfiguration, SuggestionListConfigurationInterface } from './SuggestionListConfiguration';
4
+
5
+ export {
6
+ CometChatSuggestionList,
7
+ CometChatSuggestionListInterface,
8
+ SuggestionItem,
9
+ SuggestionListConfiguration,
10
+ SuggestionListConfigurationInterface
11
+ }