@cometchat/chat-uikit-react-native 4.3.22 → 4.3.23

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-uikit-react-native",
3
- "version": "4.3.22",
3
+ "version": "4.3.23",
4
4
  "description": "Ready-to-use Chat UI Components for React Native",
5
5
  "main": "src/index",
6
6
  "module": "src/index",
@@ -9,7 +9,13 @@ import {
9
9
  ViewProps,
10
10
  //@ts-ignore
11
11
  } from 'react-native';
12
- import React, { useEffect, useState, useRef, useContext } from 'react';
12
+ import React, {
13
+ useEffect,
14
+ useState,
15
+ useRef,
16
+ useContext,
17
+ useCallback,
18
+ } from 'react';
13
19
  import { AvatarStyle, CometChatContext, CometChatListItem } from '../shared';
14
20
  import { localize } from '../shared';
15
21
  import { ICONS } from './resources';
@@ -400,6 +406,17 @@ export const CometChatMessageHeader = (
400
406
  };
401
407
  }, []);
402
408
 
409
+ const AppBarOptionsView = useCallback(() => {
410
+ if (AppBarOptions) {
411
+ return (
412
+ <AppBarOptions
413
+ {...(user ? { user } : groupObj ? { group: groupObj } : {})}
414
+ />
415
+ );
416
+ }
417
+ return null;
418
+ }, [user?.getUid(), groupObj?.getGuid()]);
419
+
403
420
  return (
404
421
  <View
405
422
  style={
@@ -498,19 +515,7 @@ export const CometChatMessageHeader = (
498
515
  : null
499
516
  : null
500
517
  }
501
- TailView={
502
- AppBarOptions
503
- ? () => (
504
- <AppBarOptions
505
- {...(user
506
- ? { user }
507
- : groupObj
508
- ? { group: groupObj }
509
- : {})}
510
- />
511
- )
512
- : null
513
- }
518
+ TailView={AppBarOptionsView}
514
519
  headViewContainerStyle={headViewContainerStyle}
515
520
  tailViewContainerStyle={tailViewContainerStyle}
516
521
  avatarStyle={_avatarStyle}
@@ -2,7 +2,8 @@ import React, { useState, useContext, useEffect, useRef } from 'react';
2
2
  import {
3
3
  View,
4
4
  Text,
5
- TextStyle
5
+ TextStyle,
6
+ Modal
6
7
  } from 'react-native';
7
8
  //@ts-ignore
8
9
  import { CometChat } from '@cometchat/chat-sdk-react-native';
@@ -214,7 +215,14 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface) =>
214
215
  }, []);
215
216
 
216
217
  return (
217
- <>
218
+ <Modal
219
+ transparent
220
+ animated
221
+ animationType="fade"
222
+ onRequestClose={() => {
223
+ return;
224
+ }}
225
+ >
218
226
  {
219
227
  showCallScreen ?
220
228
  <CometChatOngoingCall
@@ -277,6 +285,6 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface) =>
277
285
  }}
278
286
  />
279
287
  }
280
- </>
288
+ </Modal>
281
289
  )
282
290
  };
@@ -221,7 +221,12 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface) =>
221
221
  transparent
222
222
  animated
223
223
  animationType="fade"
224
- onRequestClose={() => onDeclineButtonPressed && onDeclineButtonPressed(call as CometChat.Call)}
224
+ onRequestClose={() => {
225
+ if (isCallConnected) {
226
+ return;
227
+ }
228
+ onDeclineButtonPressed && onDeclineButtonPressed(call as CometChat.Call)
229
+ }}
225
230
  >
226
231
  <SafeAreaView>
227
232
  {
@@ -1,4 +1,4 @@
1
- import React, { useContext, useEffect, useRef, useState } from 'react';
1
+ import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
2
2
 
3
3
  import {
4
4
  View,
@@ -194,13 +194,13 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
194
194
  /**
195
195
  * Component to be display the Tail section
196
196
  */
197
- const TailViewFc = () => {
197
+ const TailViewFc = useCallback(() => {
198
198
  return (
199
199
  <View style={[Style.tailViewStyle, tailViewContainerStyle ?? {}]}>
200
200
  {Boolean(TailView) && typeof TailView === 'function' && <TailView />}
201
201
  </View>
202
202
  );
203
- };
203
+ }, [tailViewContainerStyle, tailViewContainerStyle, TailView]);
204
204
 
205
205
  /**
206
206
  * Component to be display the Options in list after swipe