@cometchat/chat-uikit-react-native 4.3.2 → 4.3.3
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/AndroidManifest.xml +3 -4
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +0 -1
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +125 -7
- package/android/src/main/java/com/reactnativecometchatuikit/ImageManager.java +1 -1
- package/package.json +1 -1
- package/src/CometChatConversations/CometChatConversations.tsx +51 -28
- package/src/CometChatConversations/style.ts +5 -1
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +53 -20
- package/src/CometChatMessageList/CometChatMessageList.tsx +15 -15
- package/src/CometChatMessageList/MessageListConfiguration.ts +5 -5
- package/src/CometChatThreadedMessages/CometChatThreadedMessages.tsx +35 -2
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +51 -15
- package/src/index.ts +8 -8
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +1 -4
- package/src/shared/index.ts +8 -8
- package/src/shared/libs/ImageZoom/ReactNativeZoomableView.tsx +1040 -0
- package/src/shared/libs/ImageZoom/ReactNativeZoomableViewWithGestures.tsx +223 -0
- package/src/shared/libs/ImageZoom/helper.ts +144 -0
- package/src/shared/libs/ImageZoom/index.tsx +13 -0
- package/src/shared/libs/ImageZoom/types/index.ts +186 -0
- package/src/shared/libs/VideoPlayer/Video.js +0 -24
- package/src/shared/libs/VideoPlayerControls/assets/img/back.png +0 -0
- package/src/shared/libs/VideoPlayerControls/components/Back/Back.tsx +1 -1
- package/src/shared/utils/NetworkUtils.tsx +5 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
- package/src/shared/views/CometChatImageBubble/CometChatImageBubble.tsx +64 -18
- package/src/shared/views/CometChatImageBubble/assets/index.ts +5 -0
- package/src/shared/views/CometChatImageBubble/assets/spineer.png +0 -0
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +106 -0
- package/src/shared/views/CometChatImageViewerModal/index.tsx +1 -0
- package/src/shared/views/CometChatImageViewerModal/resources/Back.png +0 -0
- package/src/shared/views/CometChatImageViewerModal/resources/index.ts +5 -0
- package/src/shared/views/CometChatList/CometChatList.tsx +10 -1
- package/src/shared/views/{CometChatReactionsList/CometChatReactionsList.tsx → CometChatReactionList/CometChatReactionList.tsx} +17 -17
- package/src/shared/views/CometChatReactionList/ReactionListConfiguration.tsx +14 -0
- package/src/shared/views/CometChatReactionList/index.ts +12 -0
- package/src/shared/views/CometChatVideoBubble/CometChatVideoBubble.tsx +1 -1
- package/src/shared/views/index.ts +5 -5
- package/android/src/main/java/com/reactnativecometchatuikit/VideoManager.java +0 -40
- package/src/shared/libs/VideoPlayerControls/assets/img/back@2x.png +0 -0
- package/src/shared/libs/VideoPlayerControls/assets/img/back@3x.png +0 -0
- package/src/shared/views/CometChatReactionsList/ReactionsListConfiguration.tsx +0 -14
- package/src/shared/views/CometChatReactionsList/index.ts +0 -12
- /package/src/shared/views/{CometChatReactionsList/ReactionsListStyle.tsx → CometChatReactionList/ReactionListStyle.tsx} +0 -0
- /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/Spineer.png +0 -0
- /package/src/shared/views/{CometChatReactionsList → CometChatReactionList}/resources/index.ts +0 -0
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReactNativeZoomableViewState,
|
|
3
|
+
ReactNativeZoomableViewWithGesturesProps,
|
|
4
|
+
} from './types';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import ReactNativeZoomableView from './ReactNativeZoomableView';
|
|
7
|
+
|
|
8
|
+
export const swipeDirections = {
|
|
9
|
+
SWIPE_UP: 'SWIPE_UP',
|
|
10
|
+
SWIPE_DOWN: 'SWIPE_DOWN',
|
|
11
|
+
SWIPE_LEFT: 'SWIPE_LEFT',
|
|
12
|
+
SWIPE_RIGHT: 'SWIPE_RIGHT',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class ReactNativeZoomableViewWithGestures extends React.Component<
|
|
16
|
+
ReactNativeZoomableViewWithGesturesProps,
|
|
17
|
+
ReactNativeZoomableViewState
|
|
18
|
+
> {
|
|
19
|
+
zoomableViewRef: React.RefObject<ReactNativeZoomableView> | undefined;
|
|
20
|
+
|
|
21
|
+
constructor(props: ReactNativeZoomableViewWithGesturesProps) {
|
|
22
|
+
super(props);
|
|
23
|
+
this.zoomableViewRef = React.createRef<ReactNativeZoomableView>();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_onShiftingEnd = (e, gestureState, zoomableViewState) => {
|
|
27
|
+
if (this.props.onShiftingEnd) {
|
|
28
|
+
this.props.onShiftingEnd(e, gestureState, zoomableViewState);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!this._couldCallSwipeEvent(zoomableViewState)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const swipeDirection = this._getSwipeDirection(gestureState);
|
|
36
|
+
this._triggerSwipeHandlers(swipeDirection, gestureState);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Checks if current config options make it possible to process a swipe or if is not necessary
|
|
41
|
+
*
|
|
42
|
+
* @returns {*}
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
_couldCallSwipeEvent(zoomableViewState) {
|
|
46
|
+
const {
|
|
47
|
+
onSwipe,
|
|
48
|
+
onSwipeUp,
|
|
49
|
+
onSwipeDown,
|
|
50
|
+
onSwipeLeft,
|
|
51
|
+
onSwipeRight,
|
|
52
|
+
swipeMaxZoom,
|
|
53
|
+
swipeMinZoom,
|
|
54
|
+
} = this.props;
|
|
55
|
+
|
|
56
|
+
if (swipeMaxZoom && zoomableViewState.zoomLevel > swipeMaxZoom) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (swipeMinZoom && zoomableViewState.zoomLevel < swipeMinZoom) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return onSwipe || onSwipeUp || onSwipeDown || onSwipeLeft || onSwipeRight;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Checks the swipe and validates whether we should process it or not
|
|
69
|
+
*
|
|
70
|
+
* @param gestureState
|
|
71
|
+
* @returns {*|boolean}
|
|
72
|
+
*
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
75
|
+
_validateSwipe(gestureState) {
|
|
76
|
+
const { onSwipeUp, onSwipeDown, onSwipeLeft, onSwipeRight } = this.props;
|
|
77
|
+
const swipeDirection = this._getSwipeDirection(gestureState);
|
|
78
|
+
const { SWIPE_LEFT, SWIPE_RIGHT, SWIPE_UP, SWIPE_DOWN } = swipeDirections;
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
(onSwipeUp && swipeDirection === SWIPE_UP) ||
|
|
82
|
+
(onSwipeDown && swipeDirection === SWIPE_DOWN) ||
|
|
83
|
+
(onSwipeLeft && swipeDirection === SWIPE_LEFT) ||
|
|
84
|
+
(onSwipeRight && swipeDirection === SWIPE_RIGHT)
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Triggers the correct directional callback
|
|
90
|
+
*
|
|
91
|
+
* @param swipeDirection
|
|
92
|
+
* @param gestureState
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
_triggerSwipeHandlers(swipeDirection, gestureState) {
|
|
96
|
+
const { onSwipe, onSwipeUp, onSwipeDown, onSwipeLeft, onSwipeRight } =
|
|
97
|
+
this.props;
|
|
98
|
+
const { SWIPE_LEFT, SWIPE_RIGHT, SWIPE_UP, SWIPE_DOWN } = swipeDirections;
|
|
99
|
+
|
|
100
|
+
// trigger the general onswipe callback
|
|
101
|
+
if (onSwipe) {
|
|
102
|
+
onSwipe(swipeDirection, gestureState);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// trigger the direction specific swipe callback
|
|
106
|
+
switch (swipeDirection) {
|
|
107
|
+
case SWIPE_LEFT:
|
|
108
|
+
onSwipeLeft && onSwipeLeft(gestureState);
|
|
109
|
+
break;
|
|
110
|
+
case SWIPE_RIGHT:
|
|
111
|
+
onSwipeRight && onSwipeRight(gestureState);
|
|
112
|
+
break;
|
|
113
|
+
case SWIPE_UP:
|
|
114
|
+
onSwipeUp && onSwipeUp(gestureState);
|
|
115
|
+
break;
|
|
116
|
+
case SWIPE_DOWN:
|
|
117
|
+
onSwipeDown && onSwipeDown(gestureState);
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Calculates what direction the user swiped
|
|
124
|
+
*
|
|
125
|
+
* @param gestureState
|
|
126
|
+
* @returns {*}
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
_getSwipeDirection(gestureState) {
|
|
130
|
+
const { swipeLengthThreshold } = this.props;
|
|
131
|
+
const { SWIPE_LEFT, SWIPE_RIGHT, SWIPE_UP, SWIPE_DOWN } = swipeDirections;
|
|
132
|
+
const { dx, dy } = gestureState;
|
|
133
|
+
|
|
134
|
+
if (!swipeLengthThreshold) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (this._isValidHorizontalSwipe(gestureState)) {
|
|
139
|
+
if (Math.abs(dx) > swipeLengthThreshold) {
|
|
140
|
+
return dx > 0 ? SWIPE_RIGHT : SWIPE_LEFT;
|
|
141
|
+
}
|
|
142
|
+
} else if (this._isValidVerticalSwipe(gestureState)) {
|
|
143
|
+
if (Math.abs(dy) > swipeLengthThreshold) {
|
|
144
|
+
return dy > 0 ? SWIPE_DOWN : SWIPE_UP;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Checks, whether the swipe was done in a horizontal fashion, respecting swipeVelocityThreshold limits
|
|
153
|
+
*
|
|
154
|
+
* @param gestureState
|
|
155
|
+
* @returns {*}
|
|
156
|
+
*
|
|
157
|
+
* @private
|
|
158
|
+
*/
|
|
159
|
+
_isValidHorizontalSwipe(gestureState) {
|
|
160
|
+
const { vx, dy } = gestureState;
|
|
161
|
+
const { swipeVelocityThreshold, swipeDirectionalThreshold } = this.props;
|
|
162
|
+
return this._isValidSwipe(
|
|
163
|
+
vx,
|
|
164
|
+
swipeVelocityThreshold,
|
|
165
|
+
dy,
|
|
166
|
+
swipeDirectionalThreshold
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Checks, whether the swipe was done in a vertical fashion, respecting swipeVelocityThreshold limits
|
|
172
|
+
*
|
|
173
|
+
* @param gestureState
|
|
174
|
+
* @returns {*}
|
|
175
|
+
*
|
|
176
|
+
* @private
|
|
177
|
+
*/
|
|
178
|
+
_isValidVerticalSwipe(gestureState) {
|
|
179
|
+
const { vy, dx } = gestureState;
|
|
180
|
+
const { swipeVelocityThreshold, swipeDirectionalThreshold } = this.props;
|
|
181
|
+
return this._isValidSwipe(
|
|
182
|
+
vy,
|
|
183
|
+
swipeVelocityThreshold,
|
|
184
|
+
dx,
|
|
185
|
+
swipeDirectionalThreshold
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Checks the sipw against velocity and directional offset to make sure it only gets activated, when we actually need it
|
|
191
|
+
*
|
|
192
|
+
* @param velocity
|
|
193
|
+
* @param swipeVelocityThreshold
|
|
194
|
+
* @param directionalOffset
|
|
195
|
+
* @param swipeDirectionalThreshold
|
|
196
|
+
*
|
|
197
|
+
* @returns {boolean}
|
|
198
|
+
*
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
_isValidSwipe(
|
|
202
|
+
velocity,
|
|
203
|
+
swipeVelocityThreshold,
|
|
204
|
+
directionalOffset,
|
|
205
|
+
swipeDirectionalThreshold
|
|
206
|
+
) {
|
|
207
|
+
return (
|
|
208
|
+
Math.abs(velocity) > swipeVelocityThreshold &&
|
|
209
|
+
Math.abs(directionalOffset) < swipeDirectionalThreshold
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
render() {
|
|
214
|
+
return (
|
|
215
|
+
<ReactNativeZoomableView
|
|
216
|
+
{...this.props}
|
|
217
|
+
ref={this.zoomableViewRef}
|
|
218
|
+
onShiftingEnd={this._onShiftingEnd}
|
|
219
|
+
/>
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export default ReactNativeZoomableViewWithGestures;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Animated,
|
|
3
|
+
Easing,
|
|
4
|
+
GestureResponderEvent,
|
|
5
|
+
PanResponderGestureState,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
import { Vec2D } from './types';
|
|
8
|
+
|
|
9
|
+
export function calcGestureTouchDistance(
|
|
10
|
+
e: GestureResponderEvent,
|
|
11
|
+
gestureState: PanResponderGestureState
|
|
12
|
+
): number | null {
|
|
13
|
+
const touches = e?.nativeEvent?.touches;
|
|
14
|
+
if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1])
|
|
15
|
+
return null;
|
|
16
|
+
|
|
17
|
+
const dx = Math.abs(touches[0].pageX - touches[1].pageX);
|
|
18
|
+
const dy = Math.abs(touches[0].pageY - touches[1].pageY);
|
|
19
|
+
return Math.sqrt(dx * dx + dy * dy);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function calcNewScaledOffsetForZoomCentering(
|
|
23
|
+
oldOffsetXOrYScaled: number,
|
|
24
|
+
zoomSubjectOriginalWidthOrHeight: number,
|
|
25
|
+
oldScale: number,
|
|
26
|
+
newScale: number,
|
|
27
|
+
zoomCenterXOrY: number
|
|
28
|
+
) {
|
|
29
|
+
const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale;
|
|
30
|
+
const growthRate = newScale / oldScale;
|
|
31
|
+
|
|
32
|
+
// these act like namespaces just for the sake of readability
|
|
33
|
+
const zoomSubjectOriginalCenter = {} as Center;
|
|
34
|
+
const zoomSubjectCurrentCenter = {} as Center;
|
|
35
|
+
const zoomSubjectNewCenter = {} as Center;
|
|
36
|
+
|
|
37
|
+
zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2;
|
|
38
|
+
zoomSubjectCurrentCenter.xOrY =
|
|
39
|
+
zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled;
|
|
40
|
+
zoomSubjectCurrentCenter.distanceToZoomCenter =
|
|
41
|
+
zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY;
|
|
42
|
+
|
|
43
|
+
zoomSubjectNewCenter.distanceToZoomCenter =
|
|
44
|
+
zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate;
|
|
45
|
+
zoomSubjectNewCenter.xOrY =
|
|
46
|
+
zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY;
|
|
47
|
+
|
|
48
|
+
const newOffsetUnscaled =
|
|
49
|
+
zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY;
|
|
50
|
+
|
|
51
|
+
return newOffsetUnscaled / newScale;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface Center {
|
|
55
|
+
xOrY: number;
|
|
56
|
+
distanceToZoomCenter: number;
|
|
57
|
+
}
|
|
58
|
+
export function applyPanBoundariesToOffset(
|
|
59
|
+
offsetScaled: number,
|
|
60
|
+
containerSize: number,
|
|
61
|
+
contentSize: number,
|
|
62
|
+
scale: number,
|
|
63
|
+
boundaryPadding: number
|
|
64
|
+
) {
|
|
65
|
+
const contentSizeUnscaled = contentSize * scale;
|
|
66
|
+
const offsetUnscaled = offsetScaled * scale;
|
|
67
|
+
|
|
68
|
+
const contentStartBorderUnscaled =
|
|
69
|
+
containerSize / 2 + offsetUnscaled - contentSizeUnscaled / 2;
|
|
70
|
+
const contentEndBorderUnscaled =
|
|
71
|
+
contentStartBorderUnscaled + contentSizeUnscaled;
|
|
72
|
+
|
|
73
|
+
const containerStartBorder = 0;
|
|
74
|
+
const containerEndBorder = containerStartBorder + containerSize;
|
|
75
|
+
|
|
76
|
+
// do not let boundary padding be greater than the container size or less than 0
|
|
77
|
+
if (!boundaryPadding || boundaryPadding < 0) boundaryPadding = 0;
|
|
78
|
+
if (boundaryPadding > containerSize) boundaryPadding = containerSize;
|
|
79
|
+
|
|
80
|
+
// Calculate container's measurements with boundary padding applied.
|
|
81
|
+
// this should shrink the container's size by the amount of the boundary padding,
|
|
82
|
+
// so that the content inside can be panned a bit further away from the original container's boundaries.
|
|
83
|
+
const paddedContainerSize = containerSize - boundaryPadding * 2;
|
|
84
|
+
const paddedContainerStartBorder = containerStartBorder + boundaryPadding;
|
|
85
|
+
const paddedContainerEndBorder = containerEndBorder - boundaryPadding;
|
|
86
|
+
|
|
87
|
+
// if content is smaller than the padded container,
|
|
88
|
+
// don't let the content move
|
|
89
|
+
if (contentSizeUnscaled < paddedContainerSize) {
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// if content is larger than the padded container,
|
|
94
|
+
// don't let the padded container go outside of content
|
|
95
|
+
|
|
96
|
+
// maximum distance the content's center can move from its original position.
|
|
97
|
+
// assuming the content original center is the container's center.
|
|
98
|
+
const contentMaxOffsetScaled =
|
|
99
|
+
(paddedContainerSize / 2 - contentSizeUnscaled / 2) / scale;
|
|
100
|
+
|
|
101
|
+
if (
|
|
102
|
+
// content reaching the end boundary
|
|
103
|
+
contentEndBorderUnscaled < paddedContainerEndBorder
|
|
104
|
+
) {
|
|
105
|
+
return contentMaxOffsetScaled;
|
|
106
|
+
}
|
|
107
|
+
if (
|
|
108
|
+
// content reaching the start boundary
|
|
109
|
+
contentStartBorderUnscaled > paddedContainerStartBorder
|
|
110
|
+
) {
|
|
111
|
+
return -contentMaxOffsetScaled;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return offsetScaled;
|
|
115
|
+
}
|
|
116
|
+
export function getBoundaryCrossedAnim(
|
|
117
|
+
animValue: Animated.Value,
|
|
118
|
+
toValue: number
|
|
119
|
+
) {
|
|
120
|
+
return Animated.spring(animValue, {
|
|
121
|
+
overshootClamping: true,
|
|
122
|
+
toValue,
|
|
123
|
+
useNativeDriver: true,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function getPanMomentumDecayAnim(
|
|
128
|
+
animValue: Animated.Value | Animated.ValueXY,
|
|
129
|
+
velocity: number | Vec2D
|
|
130
|
+
) {
|
|
131
|
+
return Animated.decay(animValue, {
|
|
132
|
+
velocity,
|
|
133
|
+
deceleration: 0.994,
|
|
134
|
+
useNativeDriver: true,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export function getZoomToAnimation(animValue: Animated.Value, toValue: number) {
|
|
139
|
+
return Animated.timing(animValue, {
|
|
140
|
+
easing: Easing.out(Easing.ease),
|
|
141
|
+
toValue,
|
|
142
|
+
useNativeDriver: true,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import ReactNativeZoomableView from './ReactNativeZoomableView';
|
|
2
|
+
import ReactNativeZoomableViewWithGestures from './ReactNativeZoomableViewWithGestures';
|
|
3
|
+
import type {
|
|
4
|
+
ReactNativeZoomableViewProps,
|
|
5
|
+
ZoomableViewEvent,
|
|
6
|
+
} from './types';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
ReactNativeZoomableView,
|
|
10
|
+
ReactNativeZoomableViewWithGestures,
|
|
11
|
+
ReactNativeZoomableViewProps,
|
|
12
|
+
ZoomableViewEvent,
|
|
13
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Animated,
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
PanResponderGestureState,
|
|
5
|
+
ViewProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
export enum SwipeDirection {
|
|
9
|
+
SWIPE_UP = 'SWIPE_UP',
|
|
10
|
+
SWIPE_DOWN = 'SWIPE_DOWN',
|
|
11
|
+
SWIPE_LEFT = 'SWIPE_LEFT',
|
|
12
|
+
SWIPE_RIGHT = 'SWIPE_RIGHT',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ZoomableViewEvent {
|
|
16
|
+
zoomLevel: number;
|
|
17
|
+
offsetX: number;
|
|
18
|
+
offsetY: number;
|
|
19
|
+
originalHeight: number;
|
|
20
|
+
originalWidth: number;
|
|
21
|
+
originalPageX: number;
|
|
22
|
+
originalPageY: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ReactNativeZoomableViewProps extends ViewProps {
|
|
26
|
+
// options
|
|
27
|
+
zoomEnabled?: boolean;
|
|
28
|
+
panEnabled?: boolean;
|
|
29
|
+
initialZoom?: number;
|
|
30
|
+
initialOffsetX?: number;
|
|
31
|
+
initialOffsetY?: number;
|
|
32
|
+
contentWidth?: number;
|
|
33
|
+
contentHeight?: number;
|
|
34
|
+
panBoundaryPadding?: number;
|
|
35
|
+
maxZoom?: number;
|
|
36
|
+
minZoom?: number;
|
|
37
|
+
doubleTapDelay?: number;
|
|
38
|
+
doubleTapZoomToCenter?: boolean;
|
|
39
|
+
bindToBorders?: boolean;
|
|
40
|
+
zoomStep?: number;
|
|
41
|
+
pinchToZoomInSensitivity?: number;
|
|
42
|
+
pinchToZoomOutSensitivity?: number;
|
|
43
|
+
movementSensibility?: number;
|
|
44
|
+
longPressDuration?: number;
|
|
45
|
+
visualTouchFeedbackEnabled?: boolean;
|
|
46
|
+
disablePanOnInitialZoom?: boolean;
|
|
47
|
+
style?: any;
|
|
48
|
+
|
|
49
|
+
// Zoom animated value ref
|
|
50
|
+
zoomAnimatedValue?: Animated.Value;
|
|
51
|
+
panAnimatedValueXY?: Animated.ValueXY;
|
|
52
|
+
|
|
53
|
+
// debug
|
|
54
|
+
debug?: boolean;
|
|
55
|
+
|
|
56
|
+
// callbacks
|
|
57
|
+
onTransform?: (zoomableViewEventObject: ZoomableViewEvent) => void;
|
|
58
|
+
onSingleTap?: (
|
|
59
|
+
event: GestureResponderEvent,
|
|
60
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
61
|
+
) => void;
|
|
62
|
+
onDoubleTapBefore?: (
|
|
63
|
+
event: GestureResponderEvent,
|
|
64
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
65
|
+
) => void;
|
|
66
|
+
onDoubleTapAfter?: (
|
|
67
|
+
event: GestureResponderEvent,
|
|
68
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
69
|
+
) => void;
|
|
70
|
+
onShiftingBefore?: (
|
|
71
|
+
event: GestureResponderEvent,
|
|
72
|
+
gestureState: PanResponderGestureState,
|
|
73
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
74
|
+
) => boolean;
|
|
75
|
+
onShiftingAfter?: (
|
|
76
|
+
event: GestureResponderEvent,
|
|
77
|
+
gestureState: PanResponderGestureState,
|
|
78
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
79
|
+
) => boolean;
|
|
80
|
+
onShiftingEnd?: (
|
|
81
|
+
event: GestureResponderEvent,
|
|
82
|
+
gestureState: PanResponderGestureState,
|
|
83
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
84
|
+
) => void;
|
|
85
|
+
onZoomBefore?: (
|
|
86
|
+
event: GestureResponderEvent,
|
|
87
|
+
gestureState: PanResponderGestureState,
|
|
88
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
89
|
+
) => boolean | void;
|
|
90
|
+
onZoomAfter?: (
|
|
91
|
+
event: GestureResponderEvent,
|
|
92
|
+
gestureState: PanResponderGestureState,
|
|
93
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
94
|
+
) => void;
|
|
95
|
+
onZoomEnd?: (
|
|
96
|
+
event: GestureResponderEvent,
|
|
97
|
+
gestureState: PanResponderGestureState,
|
|
98
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
99
|
+
) => void;
|
|
100
|
+
onLongPress?: (
|
|
101
|
+
event: GestureResponderEvent,
|
|
102
|
+
gestureState: PanResponderGestureState,
|
|
103
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
104
|
+
) => void;
|
|
105
|
+
onStartShouldSetPanResponder?: (
|
|
106
|
+
event: GestureResponderEvent,
|
|
107
|
+
gestureState: PanResponderGestureState,
|
|
108
|
+
zoomableViewEventObject: ZoomableViewEvent,
|
|
109
|
+
baseComponentResult: boolean
|
|
110
|
+
) => boolean;
|
|
111
|
+
onPanResponderGrant?: (
|
|
112
|
+
event: GestureResponderEvent,
|
|
113
|
+
gestureState: PanResponderGestureState,
|
|
114
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
115
|
+
) => void;
|
|
116
|
+
onPanResponderEnd?: (
|
|
117
|
+
event: GestureResponderEvent,
|
|
118
|
+
gestureState: PanResponderGestureState,
|
|
119
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
120
|
+
) => void;
|
|
121
|
+
onPanResponderMove?: (
|
|
122
|
+
event: GestureResponderEvent,
|
|
123
|
+
gestureState: PanResponderGestureState,
|
|
124
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
125
|
+
) => boolean;
|
|
126
|
+
onPanResponderTerminate?: (
|
|
127
|
+
event: GestureResponderEvent,
|
|
128
|
+
gestureState: PanResponderGestureState,
|
|
129
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
130
|
+
) => void;
|
|
131
|
+
onPanResponderTerminationRequest?: (
|
|
132
|
+
event: GestureResponderEvent,
|
|
133
|
+
gestureState: PanResponderGestureState,
|
|
134
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
135
|
+
) => boolean;
|
|
136
|
+
onShouldBlockNativeResponder?: (
|
|
137
|
+
event: GestureResponderEvent,
|
|
138
|
+
gestureState: PanResponderGestureState,
|
|
139
|
+
zoomableViewEventObject: ZoomableViewEvent
|
|
140
|
+
) => boolean;
|
|
141
|
+
onStartShouldSetPanResponderCapture?: (
|
|
142
|
+
event: GestureResponderEvent,
|
|
143
|
+
gestureState: PanResponderGestureState
|
|
144
|
+
) => boolean;
|
|
145
|
+
onMoveShouldSetPanResponderCapture?: (
|
|
146
|
+
event: GestureResponderEvent,
|
|
147
|
+
gestureState: PanResponderGestureState
|
|
148
|
+
) => boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface Vec2D {
|
|
152
|
+
x: number;
|
|
153
|
+
y: number;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface TouchPoint extends Vec2D {
|
|
157
|
+
id: string;
|
|
158
|
+
isSecondTap?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface ReactNativeZoomableViewState {
|
|
162
|
+
touches: TouchPoint[];
|
|
163
|
+
originalWidth: number;
|
|
164
|
+
originalHeight: number;
|
|
165
|
+
originalPageX: number;
|
|
166
|
+
originalPageY: number;
|
|
167
|
+
debugPoints: undefined | Vec2D[];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ReactNativeZoomableViewWithGesturesProps
|
|
171
|
+
extends ReactNativeZoomableViewProps {
|
|
172
|
+
swipeLengthThreshold?: number;
|
|
173
|
+
swipeVelocityThreshold?: number;
|
|
174
|
+
swipeDirectionalThreshold?: number;
|
|
175
|
+
swipeMinZoom?: number;
|
|
176
|
+
swipeMaxZoom?: number;
|
|
177
|
+
swipeDisabled?: boolean;
|
|
178
|
+
onSwipe?: (
|
|
179
|
+
swipeDirection: SwipeDirection,
|
|
180
|
+
gestureState: PanResponderGestureState
|
|
181
|
+
) => void;
|
|
182
|
+
onSwipeUp?: (gestureState: PanResponderGestureState) => void;
|
|
183
|
+
onSwipeDown?: (gestureState: PanResponderGestureState) => void;
|
|
184
|
+
onSwipeLeft?: (gestureState: PanResponderGestureState) => void;
|
|
185
|
+
onSwipeRight?: (gestureState: PanResponderGestureState) => void;
|
|
186
|
+
}
|
|
@@ -76,9 +76,6 @@ export default class Video extends Component {
|
|
|
76
76
|
this.setNativeProps({ fullscreen: false });
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
save = async (options) => {
|
|
80
|
-
return await NativeModules.VideoManager.save(options, findNodeHandle(this._root));
|
|
81
|
-
}
|
|
82
79
|
|
|
83
80
|
restoreUserInterfaceForPictureInPictureStopCompleted = (restored) => {
|
|
84
81
|
this.setNativeProps({ restoreUserInterfaceForPIPStopCompletionHandler: restored });
|
|
@@ -234,26 +231,6 @@ export default class Video extends Component {
|
|
|
234
231
|
}
|
|
235
232
|
};
|
|
236
233
|
|
|
237
|
-
_onGetLicense = (event) => {
|
|
238
|
-
if (this.props.drm && this.props.drm.getLicense instanceof Function) {
|
|
239
|
-
const data = event.nativeEvent;
|
|
240
|
-
if (data && data.spcBase64) {
|
|
241
|
-
const getLicenseOverride = this.props.drm.getLicense(data.spcBase64, data.contentId, data.licenseUrl);
|
|
242
|
-
const getLicensePromise = Promise.resolve(getLicenseOverride); // Handles both scenarios, getLicenseOverride being a promise and not.
|
|
243
|
-
getLicensePromise.then((result => {
|
|
244
|
-
if (result !== undefined) {
|
|
245
|
-
NativeModules.VideoManager.setLicenseResult(result, findNodeHandle(this._root));
|
|
246
|
-
} else {
|
|
247
|
-
NativeModules.VideoManager.setLicenseError && NativeModules.VideoManager.setLicenseError('Empty license result', findNodeHandle(this._root));
|
|
248
|
-
}
|
|
249
|
-
})).catch((error) => {
|
|
250
|
-
NativeModules.VideoManager.setLicenseError && NativeModules.VideoManager.setLicenseError(error, findNodeHandle(this._root));
|
|
251
|
-
});
|
|
252
|
-
} else {
|
|
253
|
-
NativeModules.VideoManager.setLicenseError && NativeModules.VideoManager.setLicenseError("No spc received", findNodeHandle(this._root));
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
234
|
getViewManagerConfig = viewManagerName => {
|
|
258
235
|
if (!NativeModules.UIManager.getViewManagerConfig) {
|
|
259
236
|
return NativeModules.UIManager[viewManagerName];
|
|
@@ -326,7 +303,6 @@ export default class Video extends Component {
|
|
|
326
303
|
onPlaybackRateChange: this._onPlaybackRateChange,
|
|
327
304
|
onAudioFocusChanged: this._onAudioFocusChanged,
|
|
328
305
|
onAudioBecomingNoisy: this._onAudioBecomingNoisy,
|
|
329
|
-
onGetLicense: nativeProps.drm && nativeProps.drm.getLicense && this._onGetLicense,
|
|
330
306
|
onPictureInPictureStatusChanged: this._onPictureInPictureStatusChanged,
|
|
331
307
|
onRestoreUserInterfaceForPictureInPictureStop: this._onRestoreUserInterfaceForPictureInPictureStop,
|
|
332
308
|
});
|
|
Binary file
|
|
@@ -21,7 +21,7 @@ export const Back = ({
|
|
|
21
21
|
<Image
|
|
22
22
|
source={backIcon ? backIcon : require('../../assets/img/back.png')}
|
|
23
23
|
resizeMode='contain'
|
|
24
|
-
style={backIconColor ?
|
|
24
|
+
style={{ tintColor: backIconColor ? backIconColor : '#fff', height: 25, width:25 }}
|
|
25
25
|
/>
|
|
26
26
|
</Control>
|
|
27
27
|
);
|
|
@@ -161,6 +161,7 @@ export const CometChatActionSheet = (props: CometChatActionSheetInterface) => {
|
|
|
161
161
|
paddingHorizontal: props.style?.paddingHorizontal
|
|
162
162
|
}),
|
|
163
163
|
...props.style,
|
|
164
|
+
listItemTitleFont: {...theme.typography.subtitle1, ...(props.style.listItemTitleFont ?? {})},
|
|
164
165
|
};
|
|
165
166
|
|
|
166
167
|
const [listMode, setListMode] = React.useState(true);
|