@cometchat/chat-uikit-react-native 4.3.23 → 4.3.25
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/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +1 -1
- package/ios/CometchatUiKit.mm +0 -13
- package/ios/FileManager.m +7 -0
- package/package.json +1 -1
- package/react-native-cometchat-ui-kit.podspec +0 -16
- package/src/CometChatConversations/CometChatConversations.tsx +44 -18
- package/src/CometChatConversationsWithMessages/CometChatConversationsWithMessages.tsx +2 -5
- package/src/CometChatDetails/CometChatDetails.tsx +128 -85
- package/src/CometChatGroupsWithMessages/CometChatGroupsWithMessages.tsx +2 -5
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +19 -15
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +78 -19
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +57 -17
- package/src/CometChatMessages/CometChatMessages.tsx +2 -5
- package/src/CometChatTabs/CometChatTabs.tsx +1 -1
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +6 -2
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +6 -0
- package/src/index.ts +20 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +6 -11
- package/src/shared/base/Types.ts +5 -0
- package/src/shared/index.ts +4 -0
- package/src/shared/libs/VideoPlayer/Video.js +4 -4
- package/src/shared/resources/CometChatLocalize/CometChatLocalize.ts +3 -4
- package/src/shared/resources/CometChatLocalize/resources/ar/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/de/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/en/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/es/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/fr/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/hi/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/hu/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/lt/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/ms/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/pt/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/ru/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/sv/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/zh/translation.json +1 -0
- package/src/shared/resources/CometChatLocalize/resources/zh-tw/translation.json +1 -0
- package/src/shared/utils/CommonUtils.ts +1 -1
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +2 -2
- package/src/shared/views/CometChatDate/CometChatDate.tsx +1 -1
- package/src/shared/views/CometChatList/CometChatList.tsx +31 -10
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +0 -1
- package/src/shared/views/CometChatReceipt/CometChatReceipt.tsx +14 -14
- package/src/shared/views/CometChatReceipt/ReceiptStyle.ts +39 -1
- package/src/shared/views/CometChatReceipt/index.ts +4 -2
- package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +1 -1
- package/src/shared/views/index.ts +4 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import { StyleSheet, requireNativeComponent, NativeModules, View, Image, Platform, ViewProps, ImageResizeMode } from 'react-native';
|
|
3
|
+
import { StyleSheet, requireNativeComponent, NativeModules, View, Image, Platform, ViewProps, ImageResizeMode, UIManager } from 'react-native';
|
|
4
4
|
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
5
5
|
import TextTrackType from './TextTrackType';
|
|
6
6
|
import FilterType from './FilterType';
|
|
@@ -231,10 +231,10 @@ export default class Video extends Component {
|
|
|
231
231
|
};
|
|
232
232
|
|
|
233
233
|
getViewManagerConfig = viewManagerName => {
|
|
234
|
-
if (!
|
|
235
|
-
return
|
|
234
|
+
if (!UIManager.getViewManagerConfig) {
|
|
235
|
+
return UIManager[viewManagerName];
|
|
236
236
|
}
|
|
237
|
-
return
|
|
237
|
+
return UIManager.getViewManagerConfig(viewManagerName);
|
|
238
238
|
};
|
|
239
239
|
|
|
240
240
|
render() {
|
|
@@ -12,7 +12,7 @@ import translationZHTW from "./resources/zh-tw/translation.json";
|
|
|
12
12
|
import translationSV from "./resources/sv/translation.json";
|
|
13
13
|
import translationLT from "./resources/lt/translation.json";
|
|
14
14
|
import translationHU from "./resources/hu/translation.json";
|
|
15
|
-
import { Platform,
|
|
15
|
+
import { Platform, Settings, I18nManager } from 'react-native';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* CometChatLocalize component allows you to show text in the locale set by you.
|
|
@@ -81,9 +81,8 @@ class CometChatLocalize {
|
|
|
81
81
|
*/
|
|
82
82
|
static getNativeLanguage = () => {
|
|
83
83
|
return Platform.OS === 'ios'
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
: NativeModules.I18nManager.localeIdentifier.replace("_", "-")
|
|
84
|
+
? Settings.get('AppleLocale') || Settings.get('AppleLanguages')[0] //iOS 13
|
|
85
|
+
: I18nManager.getConstants().localeIdentifier?.replace("_", "-")
|
|
87
86
|
};
|
|
88
87
|
|
|
89
88
|
/**
|
|
@@ -174,7 +174,7 @@ export class CommonUtils {
|
|
|
174
174
|
const diffDays = Math.floor(diff / (1000 * 60 * 60 * 24));
|
|
175
175
|
const isCurrentYear = today.getFullYear() === date.getFullYear();
|
|
176
176
|
|
|
177
|
-
if (diffDays
|
|
177
|
+
if (diffDays < 1) {
|
|
178
178
|
return `Today ${getTimeFormat()}`;
|
|
179
179
|
} else if (diffDays === 1) {
|
|
180
180
|
return `Yesterday ${getTimeFormat()}`;
|
|
@@ -103,11 +103,11 @@ const CometChatBottomSheet = forwardRef(
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
useEffect(() => {
|
|
106
|
-
BackHandler.addEventListener('hardwareBackPress', _onBackPress);
|
|
106
|
+
const backHandlerListener = BackHandler.addEventListener('hardwareBackPress', _onBackPress);
|
|
107
107
|
// onOpen ? onOpen() : () => {};
|
|
108
108
|
|
|
109
109
|
return () => {
|
|
110
|
-
|
|
110
|
+
backHandlerListener.remove();
|
|
111
111
|
};
|
|
112
112
|
}, []);
|
|
113
113
|
|
|
@@ -56,7 +56,7 @@ export interface CometChatDateInterface {
|
|
|
56
56
|
* 2. dayDateFormat: Today, Yesterday, week-day or "d MMM, yyyy".
|
|
57
57
|
* 3. dayDateTimeFormat: Today, Yesterday, week-day or "dd/mm/yyyy".
|
|
58
58
|
*/
|
|
59
|
-
pattern
|
|
59
|
+
pattern?: 'timeFormat' | 'dayDateFormat' | 'dayDateTimeFormat';
|
|
60
60
|
/**
|
|
61
61
|
* A string for custom date reprasentation.
|
|
62
62
|
*/
|
|
@@ -53,6 +53,18 @@ export interface CometChatListActionsInterface {
|
|
|
53
53
|
clearSelection: () => void;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
const waitForList = {
|
|
57
|
+
resolve: (_: any[]) => null,
|
|
58
|
+
promise: () => {
|
|
59
|
+
return new Promise((resolve: (_: any[]) => void) => {
|
|
60
|
+
waitForList.resolve = resolve;
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
reset: () => {
|
|
64
|
+
waitForList.resolve = (_: any[]) => null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
export interface CometChatListStylesInterface {
|
|
57
69
|
width?: number | string;
|
|
58
70
|
height?: number | string;
|
|
@@ -117,8 +129,6 @@ export interface CometChatListProps {
|
|
|
117
129
|
listStyle?: CometChatListStylesInterface;
|
|
118
130
|
hideSubmitIcon?: boolean;
|
|
119
131
|
}
|
|
120
|
-
let lastCall: any;
|
|
121
|
-
let lastReject: Function;
|
|
122
132
|
|
|
123
133
|
/**
|
|
124
134
|
* @class Users is a component useful for displaying the header and users in a list
|
|
@@ -134,6 +144,8 @@ export const CometChatList = React.forwardRef<
|
|
|
134
144
|
>((props, ref) => {
|
|
135
145
|
const connectionListenerId = 'connectionListener_' + new Date().getTime();
|
|
136
146
|
const { theme } = useContext<CometChatContextType>(CometChatContext);
|
|
147
|
+
const lastCall = useRef(null);
|
|
148
|
+
const lastReject = useRef(null);
|
|
137
149
|
|
|
138
150
|
const {
|
|
139
151
|
SubtitleView,
|
|
@@ -229,9 +241,14 @@ export const CometChatList = React.forwardRef<
|
|
|
229
241
|
|
|
230
242
|
const activeSwipeRows = React.useRef<anyObject>({});
|
|
231
243
|
|
|
232
|
-
const [list, setList] = React.useState<any>([]);
|
|
244
|
+
const [list, setList] = React.useState<any[]>([]);
|
|
233
245
|
const [decoratorMessage, setDecoratorMessage] = React.useState(LOADING);
|
|
234
246
|
|
|
247
|
+
if (list.length > 0) {
|
|
248
|
+
waitForList.resolve(list);
|
|
249
|
+
waitForList.reset();
|
|
250
|
+
}
|
|
251
|
+
|
|
235
252
|
const searchHandler = (searchText: string) => {
|
|
236
253
|
setSearchInput(searchText);
|
|
237
254
|
let _searchRequestBuilder = searchRequestBuilder || requestBuilder;
|
|
@@ -351,8 +368,12 @@ export const CometChatList = React.forwardRef<
|
|
|
351
368
|
* This will move item to first location if item doesn't exits then add it to first location.
|
|
352
369
|
* @param item
|
|
353
370
|
*/
|
|
354
|
-
const updateAndMoveToFirst = (item: any) => {
|
|
355
|
-
let
|
|
371
|
+
const updateAndMoveToFirst = async (item: any) => {
|
|
372
|
+
let thisList = list;
|
|
373
|
+
if (thisList.length <= 0) {
|
|
374
|
+
thisList = await waitForList.promise();
|
|
375
|
+
};
|
|
376
|
+
let newList = [...thisList];
|
|
356
377
|
let itemKey = newList.findIndex(
|
|
357
378
|
(u) => u[listItemKey] === item[listItemKey]
|
|
358
379
|
);
|
|
@@ -601,14 +622,14 @@ export const CometChatList = React.forwardRef<
|
|
|
601
622
|
const getList = (props: any) => {
|
|
602
623
|
const promise = new Promise((resolve, reject) => {
|
|
603
624
|
const cancel = () => {
|
|
604
|
-
clearTimeout(lastCall);
|
|
605
|
-
lastReject(new Error('Promise cancelled'));
|
|
625
|
+
clearTimeout(lastCall.current);
|
|
626
|
+
lastReject.current(new Error('Promise cancelled'));
|
|
606
627
|
};
|
|
607
|
-
if (lastCall) {
|
|
628
|
+
if (lastCall.current) {
|
|
608
629
|
cancel();
|
|
609
630
|
}
|
|
610
631
|
|
|
611
|
-
lastCall = setTimeout(() => {
|
|
632
|
+
lastCall.current = setTimeout(() => {
|
|
612
633
|
props
|
|
613
634
|
?.fetchNext()
|
|
614
635
|
.then((listItems: any) => {
|
|
@@ -618,7 +639,7 @@ export const CometChatList = React.forwardRef<
|
|
|
618
639
|
reject(error);
|
|
619
640
|
});
|
|
620
641
|
}, 500);
|
|
621
|
-
lastReject = reject;
|
|
642
|
+
lastReject.current = reject;
|
|
622
643
|
});
|
|
623
644
|
return promise;
|
|
624
645
|
};
|
|
@@ -261,7 +261,6 @@ export const CometChatListItem = (props: CometChatListItemInterface) => {
|
|
|
261
261
|
let wrapperComponentProps = swipeRowOptions.length
|
|
262
262
|
? {
|
|
263
263
|
ref: swipeRowRef,
|
|
264
|
-
key: id,
|
|
265
264
|
onRowDidOpen: rowOpened,
|
|
266
265
|
onRowDidClose: rowClosed,
|
|
267
266
|
disableRightSwipe: true,
|
|
@@ -26,7 +26,12 @@ export interface CometChatReceiptInterface {
|
|
|
26
26
|
height?: string | number;
|
|
27
27
|
width?: string | number;
|
|
28
28
|
tintColor?: string;
|
|
29
|
-
|
|
29
|
+
waitIconTint?: string;
|
|
30
|
+
sentIconTint?: string;
|
|
31
|
+
deliveredIconTint?: string;
|
|
32
|
+
readIconTint?: string;
|
|
33
|
+
errorIconTint?: string;
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
export const CometChatReceipt = (props: CometChatReceiptInterface) => {
|
|
@@ -46,29 +51,34 @@ export const CometChatReceipt = (props: CometChatReceiptInterface) => {
|
|
|
46
51
|
...style,
|
|
47
52
|
height: style?.height || 10,
|
|
48
53
|
width: style?.width || 14,
|
|
49
|
-
tintColor: style?.tintColor,
|
|
50
54
|
};
|
|
51
55
|
|
|
52
|
-
const { height, width
|
|
56
|
+
const { height, width } = _style;
|
|
53
57
|
|
|
54
58
|
let icon: any = null;
|
|
55
59
|
let imageSource: any = null;
|
|
60
|
+
let tintColor = style?.tintColor;
|
|
56
61
|
|
|
57
62
|
switch (receipt) {
|
|
58
63
|
case 'SENT':
|
|
59
64
|
icon = sentIcon;
|
|
65
|
+
tintColor = style?.sentIconTint;
|
|
60
66
|
break;
|
|
61
67
|
case 'DELIVERED':
|
|
62
68
|
icon = deliveredIcon;
|
|
69
|
+
tintColor = style?.deliveredIconTint;
|
|
63
70
|
break;
|
|
64
71
|
case 'READ':
|
|
65
72
|
icon = readIcon;
|
|
73
|
+
tintColor = style?.readIconTint;
|
|
66
74
|
break;
|
|
67
75
|
case 'ERROR':
|
|
68
76
|
icon = errorIcon;
|
|
77
|
+
tintColor = style?.errorIconTint;
|
|
69
78
|
break;
|
|
70
79
|
case 'WAIT':
|
|
71
80
|
icon = waitIcon;
|
|
81
|
+
tintColor = style?.waitIconTint;
|
|
72
82
|
break;
|
|
73
83
|
|
|
74
84
|
default:
|
|
@@ -81,17 +91,7 @@ export const CometChatReceipt = (props: CometChatReceiptInterface) => {
|
|
|
81
91
|
} else if (typeof icon === 'number') {
|
|
82
92
|
imageSource = icon;
|
|
83
93
|
}
|
|
84
|
-
return
|
|
85
|
-
<Image
|
|
86
|
-
source={imageSource}
|
|
87
|
-
style={
|
|
88
|
-
[
|
|
89
|
-
styles.tickImageStyle,
|
|
90
|
-
{ tintColor: tintColor, width, height },
|
|
91
|
-
] as ImageStyle
|
|
92
|
-
}
|
|
93
|
-
/>
|
|
94
|
-
);
|
|
94
|
+
return <Image source={imageSource} style={[styles.tickImageStyle, { tintColor: tintColor || style?.tintColor, width, height }] as ImageStyle} />;
|
|
95
95
|
}
|
|
96
96
|
return null;
|
|
97
97
|
};
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
export interface ReceiptStyleInterface {
|
|
2
|
+
height?: string | number;
|
|
3
|
+
width?: string | number;
|
|
4
|
+
tintColor?: string
|
|
5
|
+
waitIconTint?: string;
|
|
6
|
+
sentIconTint?: string;
|
|
7
|
+
deliveredIconTint?: string;
|
|
8
|
+
readIconTint?: string;
|
|
9
|
+
errorIconTint?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
export class ReceiptStyle {
|
|
2
|
-
|
|
13
|
+
height?: string | number;
|
|
14
|
+
width?: string | number;
|
|
15
|
+
tintColor?: string
|
|
16
|
+
waitIconTint?: string;
|
|
17
|
+
sentIconTint?: string;
|
|
18
|
+
deliveredIconTint?: string;
|
|
19
|
+
readIconTint?: string;
|
|
20
|
+
errorIconTint?: string;
|
|
21
|
+
constructor(props: ReceiptStyleInterface) {
|
|
22
|
+
const {
|
|
23
|
+
height,
|
|
24
|
+
width,
|
|
25
|
+
tintColor,
|
|
26
|
+
waitIconTint,
|
|
27
|
+
sentIconTint,
|
|
28
|
+
deliveredIconTint,
|
|
29
|
+
readIconTint,
|
|
30
|
+
errorIconTint
|
|
31
|
+
} = props;
|
|
32
|
+
this.height = height;
|
|
33
|
+
this.width = width;
|
|
34
|
+
this.tintColor = tintColor;
|
|
35
|
+
this.waitIconTint = waitIconTint;
|
|
36
|
+
this.sentIconTint = sentIconTint;
|
|
37
|
+
this.deliveredIconTint = deliveredIconTint;
|
|
38
|
+
this.readIconTint = readIconTint;
|
|
39
|
+
this.errorIconTint = errorIconTint;
|
|
40
|
+
}
|
|
3
41
|
}
|
|
@@ -7,5 +7,7 @@ import {
|
|
|
7
7
|
ReceiptConfigurationInterface,
|
|
8
8
|
} from "./MessageConfiguration";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import {ReceiptStyle, ReceiptStyleInterface} from "./ReceiptStyle"
|
|
11
|
+
|
|
12
|
+
export { CometChatReceipt, ReceiptConfiguration, ReceiptStyle };
|
|
13
|
+
export type { CometChatReceiptInterface, ReceiptConfigurationInterface, ReceiptStyleInterface };
|
|
@@ -40,8 +40,8 @@ export const CometChatStatusIndicator = (
|
|
|
40
40
|
const defaultStyleProps = new StatusIndicatorStyle({});
|
|
41
41
|
const style = {
|
|
42
42
|
...defaultStyleProps,
|
|
43
|
+
...styleProp as {},
|
|
43
44
|
...(backgroundColor ? { backgroundColor } : {}),
|
|
44
|
-
...styleProp as {}
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
const getView = () => {
|
|
@@ -63,6 +63,8 @@ import {
|
|
|
63
63
|
ReceiptConfiguration,
|
|
64
64
|
CometChatReceiptInterface,
|
|
65
65
|
ReceiptConfigurationInterface,
|
|
66
|
+
ReceiptStyle,
|
|
67
|
+
ReceiptStyleInterface
|
|
66
68
|
} from "./CometChatReceipt";
|
|
67
69
|
import {
|
|
68
70
|
CometChatDateInterface,
|
|
@@ -177,6 +179,7 @@ export {
|
|
|
177
179
|
BadgeStyle,
|
|
178
180
|
DateConfiguration,
|
|
179
181
|
ReceiptConfiguration,
|
|
182
|
+
ReceiptStyle,
|
|
180
183
|
StatusIndicatorConfiguration,
|
|
181
184
|
StatusIndicatorStyle,
|
|
182
185
|
DateStyle,
|
|
@@ -230,6 +233,7 @@ export type {
|
|
|
230
233
|
DateStyleInterface,
|
|
231
234
|
CometChatReceiptInterface,
|
|
232
235
|
ReceiptConfigurationInterface,
|
|
236
|
+
ReceiptStyleInterface,
|
|
233
237
|
CometChatStatusIndicatorInterface,
|
|
234
238
|
StatusIndicatorConfigurationInterface,
|
|
235
239
|
StatusIndicatorStyleInterface,
|