@cometchat/chat-uikit-react-native 4.3.19 → 4.3.21

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 (42) hide show
  1. package/android/src/main/AndroidManifest.xml +6 -0
  2. package/package.json +1 -1
  3. package/src/CometChatConversations/CometChatConversations.tsx +19 -25
  4. package/src/CometChatGroups/CometChatGroups.tsx +2 -2
  5. package/src/CometChatGroups/GroupsConfiguration.ts +13 -16
  6. package/src/CometChatGroups/resources/index.ts +0 -3
  7. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +6 -2
  8. package/src/CometChatMessageInformation/MessageInformationConfiguration.tsx +31 -12
  9. package/src/CometChatMessageInformation/index.ts +6 -3
  10. package/src/CometChatMessageList/CometChatMessageList.tsx +24 -9
  11. package/src/CometChatMessageList/MessageListConfiguration.ts +21 -0
  12. package/src/CometChatTabs/CometChatTabs.tsx +8 -8
  13. package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +2 -1
  14. package/src/CometChatUsers/CometChatUsers.tsx +40 -11
  15. package/src/CometChatUsers/UsersConfiguration.tsx +2 -2
  16. package/src/CometChatUsers/UsersStyle.ts +101 -0
  17. package/src/CometChatUsers/index.ts +4 -1
  18. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +1 -1
  19. package/src/extensions/MessageTranslation/MessageTranslationDecorator.tsx +1 -1
  20. package/src/extensions/SmartReplies/SmartRepliesDecorator.tsx +11 -6
  21. package/src/index.ts +8 -2
  22. package/src/shared/events/CometChatUIEventHandler/CometChatUIEventHandler.ts +53 -53
  23. package/src/shared/framework/MessageDataSource.tsx +1 -1
  24. package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1 -0
  25. package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +1 -1
  26. package/src/shared/libs/VideoPlayerControls/components/Control.tsx +1 -1
  27. package/src/shared/libs/VideoPlayerControls/components/PlayPause/PlayPause.tsx +1 -1
  28. package/src/shared/libs/luxon/src/impl/zoneUtil.js +0 -4
  29. package/src/shared/utils/CommonUtils.ts +15 -15
  30. package/src/shared/utils/InteractiveMessageUtils.ts +1 -1
  31. package/src/shared/views/CometChatActionSheet/ActionSheetStyle.ts +10 -12
  32. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +1 -1
  33. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +2 -2
  34. package/src/shared/views/CometChatFormBubble/CometChatFormBubble.tsx +1 -1
  35. package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +3 -3
  36. package/src/shared/views/CometChatImageBubble/assets/index.ts +1 -0
  37. package/src/shared/views/CometChatMediaRecorder/CometChatMediaRecorder.tsx +18 -4
  38. package/src/shared/views/CometChatMessageBubble/MessageBubbleStyle.ts +2 -2
  39. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +0 -1
  40. package/src/shared/views/CometChatSchedulerBubble/CometChatSchedulerBubble.tsx +5 -5
  41. package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
  42. package/src/CometChatGroups/resources/search.png +0 -0
@@ -1,11 +1,12 @@
1
1
  import React, { useContext, useEffect } from 'react';
2
2
  import { CometChatContext, CometChatContextType, ImageType, localize } from "../..";
3
- import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert, Platform, Linking, TextStyle, ViewProps } from "react-native";
3
+ import { View, TouchableOpacity, Text, Image, NativeModules, FlatList, PermissionsAndroid, Alert, Platform, Linking, TextStyle, ViewProps, AppState } from "react-native";
4
4
  import { Style } from "./style";
5
5
  import { ICONS } from '../../framework/resources';
6
6
  import { MediaRecorderStyle, MediaRecorderStyleInterface } from './MediaRecorderStyle';
7
7
 
8
8
  let recordedTime = 0, stopRecordingIntervalId: any = null;
9
+ let recordingStatedAt = 0;
9
10
  export interface CometChatMediaRecorderInterface {
10
11
  onClose?: Function;
11
12
  onPlay?: Function;
@@ -70,6 +71,18 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
70
71
  }
71
72
  }, [])
72
73
 
74
+ useEffect(() => {
75
+ const subscription = AppState.addEventListener('change', (nextAppState) => {
76
+ if (nextAppState === 'background') {
77
+ _onStop();
78
+ }
79
+ });
80
+
81
+ return () => {
82
+ subscription.remove();
83
+ };
84
+ }, []);
85
+
73
86
  function permissionAlert() {
74
87
  Alert.alert('', localize("MICROPHONE_PERMISSION"), [
75
88
  {
@@ -114,6 +127,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
114
127
  }
115
128
 
116
129
  const startInterval = () => {
130
+ recordingStatedAt = Date.now();
117
131
  timerIntervalId = setInterval(timer, 1000);
118
132
  }
119
133
 
@@ -131,7 +145,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
131
145
  const _onStop = () => {
132
146
  NativeModules.FileManager.releaseMediaResources((result: string) => {
133
147
  console.log(time, "Filepath _stopRecorderAudio", result);
134
- recordedTime = time;
148
+ recordedTime = Date.now() - recordingStatedAt;
135
149
  setRecordedFile(JSON.parse(result)?.file);
136
150
  onStop && onStop(JSON.parse(result)?.file);
137
151
  })
@@ -164,7 +178,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
164
178
  onPause && onPause();
165
179
  setRecordedPlaying(false);
166
180
  clearTimeout(stopRecordingIntervalId);
167
- }, recordedTime * 1000)
181
+ }, recordedTime)
168
182
  })
169
183
  }
170
184
 
@@ -246,7 +260,7 @@ export const CometChatMediaRecorder = (props: CometChatMediaRecorderInterface) =
246
260
  <View style={[Style.timerContainer, { flexDirection: Boolean(recordedFile) ? "row-reverse" : "row" }]}>
247
261
  <Text style={[
248
262
  timerTextFont && { fontFamily: timerTextFont },
249
- timerTextColor && { color: timerTextColor },
263
+ timerTextColor ? { color: timerTextColor } : { color: "#000" },
250
264
  timerTextstyle && { fontStyle: timerTextstyle },
251
265
  !Boolean(recordedFile) && { marginRight: 10 }
252
266
  ] as TextStyle}>{formatTime(time)}</Text>
@@ -1,11 +1,11 @@
1
1
  import { BaseStyle, BaseStyleInterface, BorderStyle } from "../../base";
2
2
 
3
3
  export interface MessageBubbleStyleInterface extends BaseStyleInterface {
4
- alignSelf?: string;
4
+ alignSelf?: string | null;
5
5
  }
6
6
 
7
7
  export class MessageBubbleStyle extends BaseStyle {
8
- alignSelf?: string;
8
+ alignSelf?: string | null;
9
9
  constructor({
10
10
  backgroundColor = "rgba(20,20,20,0.4)",
11
11
  border = new BorderStyle({}),
@@ -147,7 +147,6 @@ export const CometChatReactionList = (props: CometChatReactionListInterface) =>
147
147
  return list;
148
148
  } catch (error: any) {
149
149
  console.log("error while fetching reactions", error)
150
- if (error?.code === "REQUEST_IN_PROGRESS") return;
151
150
  setState("error");
152
151
  return [];
153
152
  }
@@ -426,9 +426,9 @@ export const CometChatSchedulerBubble = memo(
426
426
  }
427
427
  };
428
428
 
429
- const getQuickSelectSlots = async (date, shouldViewNext = true) => {
429
+ const getQuickSelectSlots = async (date: Date, shouldViewNext = true) => {
430
430
  let day = DateTime.fromJSDate(date).toFormat("EEEE");
431
- date = DateTime.fromJSDate(date).toFormat(dateFormats.date);
431
+ let dateString = DateTime.fromJSDate(date).toFormat(dateFormats.date);
432
432
 
433
433
  let newQuickObj: anyObject = {};
434
434
  getConvertedAvailablityObjectForDate(date, day, newQuickObj);
@@ -445,15 +445,15 @@ export const CometChatSchedulerBubble = memo(
445
445
  });
446
446
 
447
447
  tempQuickSelectRange.current = range;
448
- if (range.length && newQuickObj[date]) {
449
- newQuickObj[date].availability = range;
448
+ if (range.length && newQuickObj[dateString]) {
449
+ newQuickObj[dateString].availability = range;
450
450
  }
451
451
  // Ensure range is an Array
452
452
  if (!Array.isArray(range)) {
453
453
  range = [];
454
454
  }
455
455
 
456
- if (range.length < 2 && shouldViewNext) await getNextQuickSlots(date, newQuickObj);
456
+ if (range.length < 2 && shouldViewNext) await getNextQuickSlots(dateString, newQuickObj);
457
457
 
458
458
  let quickSlotsArray: any[] = [];
459
459
 
@@ -77,7 +77,7 @@ export const CometChatVideoBubble = (props: CometChatVideoBubbleInterface) => {
77
77
  const [isVideoPlayerVisible, setIsVideoPlayerVisible] = useState(false);
78
78
 
79
79
  const callCount = useRef(0);
80
- const timerId = useRef(null);
80
+ const timerId = useRef<any>(null);
81
81
  const threshold = 10;
82
82
  const timeframe = 1000;
83
83