@applicaster/zapp-react-native-ui-components 12.0.0-alpha.5040434238 → 12.0.0-alpha.5061452310
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/Components/Image/utils/index.ts +21 -11
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +14 -1
- package/Components/MasterCell/utils/index.ts +16 -5
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -9
- package/Components/PlayerImageBackground/index.tsx +13 -3
- package/Components/Screen/index.tsx +1 -1
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +16 -6
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +17 -15
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +138 -85
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +36 -25
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +133 -74
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +10 -9
- package/Components/VideoModal/ModalAnimation/utils.ts +69 -37
- package/Components/VideoModal/PlayerWrapper.tsx +1 -4
- package/Components/VideoModal/VideoModal.tsx +0 -19
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +28 -0
- package/package.json +5 -5
- package/Components/VideoModal/hooks/usePosition.ts +0 -52
|
@@ -52,20 +52,21 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
52
52
|
|
|
53
53
|
if (videoModalState.mode === "MAXIMIZED") {
|
|
54
54
|
if (translationY > 0) {
|
|
55
|
-
const endOffsetY =
|
|
55
|
+
const endOffsetY =
|
|
56
|
+
lastSnap + preparedTranslationY + dragToss * velocityY + 150;
|
|
56
57
|
|
|
57
58
|
let destSnapPoint = modalSnapPoints[0];
|
|
58
|
-
|
|
59
|
+
|
|
59
60
|
for (const snapPoint of modalSnapPoints) {
|
|
60
61
|
const distFromSnap = Math.abs(snapPoint - endOffsetY);
|
|
61
|
-
|
|
62
|
+
|
|
62
63
|
if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
|
|
63
64
|
destSnapPoint = snapPoint;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
|
|
67
68
|
setLastSnap(destSnapPoint);
|
|
68
|
-
|
|
69
|
+
|
|
69
70
|
if (destSnapPoint === modalSnapPoints[0]) {
|
|
70
71
|
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
71
72
|
} else {
|
|
@@ -88,24 +89,36 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
88
89
|
};
|
|
89
90
|
|
|
90
91
|
React.useEffect(() => {
|
|
91
|
-
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} else
|
|
103
|
-
|
|
92
|
+
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
93
|
+
({ value }) => {
|
|
94
|
+
if (
|
|
95
|
+
(isMinimizedModal && value >= 0) ||
|
|
96
|
+
(isMaximazedModal && value <= 0)
|
|
97
|
+
) {
|
|
98
|
+
if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
|
|
99
|
+
translateYOffset.setValue(
|
|
100
|
+
modalSnapPoints[isMinimizedModal ? 1 : 0]
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
const preparedValue = Math.round(Math.abs(value));
|
|
105
|
+
|
|
106
|
+
if (
|
|
107
|
+
preparedValue > 0 &&
|
|
108
|
+
playerAnimationState !== PlayerAnimationStateEnum.drag_scroll
|
|
109
|
+
) {
|
|
110
|
+
playerAnimationState !== PlayerAnimationStateEnum.drag_player &&
|
|
111
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.drag_player);
|
|
112
|
+
|
|
113
|
+
translateYOffset.setValue(
|
|
114
|
+
isMaximazedModal
|
|
115
|
+
? preparedValue
|
|
116
|
+
: modalSnapPoints[1] - preparedValue
|
|
117
|
+
);
|
|
118
|
+
}
|
|
104
119
|
}
|
|
105
|
-
|
|
106
|
-
translateYOffset.setValue(animatedValue);
|
|
107
120
|
}
|
|
108
|
-
|
|
121
|
+
);
|
|
109
122
|
|
|
110
123
|
return () => {
|
|
111
124
|
dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
|
|
@@ -115,7 +128,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
115
128
|
return (
|
|
116
129
|
<PanGestureHandler
|
|
117
130
|
enabled={isMaximazedModal || isMinimizedModal}
|
|
118
|
-
shouldCancelWhenOutside={
|
|
131
|
+
shouldCancelWhenOutside={isMaximazedModal}
|
|
119
132
|
onGestureEvent={onGestureEvent}
|
|
120
133
|
onHandlerStateChange={onHandlerStateChange}
|
|
121
134
|
>
|
|
@@ -125,9 +138,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
125
138
|
};
|
|
126
139
|
|
|
127
140
|
export const AnimatedVideoPlayerComponent = ({ children }: Props) => {
|
|
128
|
-
const Component = !isTV()
|
|
129
|
-
? AnimatedVideoPlayer
|
|
130
|
-
: React.Fragment;
|
|
141
|
+
const Component = !isTV() ? AnimatedVideoPlayer : React.Fragment;
|
|
131
142
|
|
|
132
143
|
return <Component>{children}</Component>;
|
|
133
144
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { Animated, View, StyleSheet } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useSafeAreaInsets,
|
|
6
|
+
useSafeAreaFrame,
|
|
7
|
+
} from "react-native-safe-area-context";
|
|
5
8
|
|
|
6
9
|
import {
|
|
7
10
|
useModalAnimationContext,
|
|
@@ -29,7 +32,7 @@ type Props = {
|
|
|
29
32
|
animationType: string;
|
|
30
33
|
children: React.ReactNode;
|
|
31
34
|
style?: Record<string, any>;
|
|
32
|
-
additionalData?: { [key: string]: any
|
|
35
|
+
additionalData?: { [key: string]: any };
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
const styles = StyleSheet.create({
|
|
@@ -56,8 +59,13 @@ export const AnimationView = ({
|
|
|
56
59
|
} = useModalAnimationContext();
|
|
57
60
|
|
|
58
61
|
const isRTL = useIsRTL();
|
|
59
|
-
|
|
60
|
-
const
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
height: screenHeight,
|
|
65
|
+
deviceInfo: { isTablet, isTabletLandscape },
|
|
66
|
+
} = useDimensions("screen", { deviceInfo: true });
|
|
67
|
+
|
|
68
|
+
const startAnimationDistance = Math.round((screenHeight * 60) / 100);
|
|
61
69
|
const { videoModalState } = useNavigation();
|
|
62
70
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
63
71
|
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
@@ -67,10 +75,12 @@ export const AnimationView = ({
|
|
|
67
75
|
|
|
68
76
|
// retrieving top position of the player for tablet landscape mode
|
|
69
77
|
const measureView = React.useCallback(() => {
|
|
70
|
-
if (
|
|
71
|
-
animationComponentRef.current.measure(
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
|
|
79
|
+
animationComponentRef.current.measure(
|
|
80
|
+
(x, y, width, height, pageX, pageY) => {
|
|
81
|
+
setTabletLandscapePlayerTopPosition(pageY - 20);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
74
84
|
}
|
|
75
85
|
}, [tabletLandscapePlayerTopPosition]);
|
|
76
86
|
|
|
@@ -92,31 +102,47 @@ export const AnimationView = ({
|
|
|
92
102
|
[videoModalState.item]
|
|
93
103
|
);
|
|
94
104
|
|
|
95
|
-
const
|
|
96
|
-
const moveComponentHorizontalValue = additionalData.moveValue ? additionalData.moveValue : 0;
|
|
105
|
+
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
97
106
|
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
const moveUpValue = additionalData.saveArea
|
|
108
|
+
? -insets.top
|
|
109
|
+
: isTablet
|
|
110
|
+
? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
111
|
+
? -tabletLandscapePlayerTopPosition
|
|
112
|
+
: -130
|
|
113
|
+
: -50;
|
|
114
|
+
|
|
115
|
+
const moveComponentHorizontalValue = additionalData.moveValue
|
|
116
|
+
? isRTL
|
|
117
|
+
? additionalData.moveValue
|
|
118
|
+
: -additionalData.moveValue
|
|
119
|
+
: 0;
|
|
120
|
+
|
|
121
|
+
const calculationData = React.useMemo(
|
|
122
|
+
() => ({
|
|
123
|
+
isAudioItem,
|
|
124
|
+
bottomTabBarHeight,
|
|
125
|
+
minimisedHeight,
|
|
126
|
+
minimisedWidth,
|
|
127
|
+
defaultValue,
|
|
128
|
+
moveUpValue,
|
|
129
|
+
moveComponentHorizontalValue,
|
|
130
|
+
isTablet,
|
|
131
|
+
isTabletLandscape,
|
|
132
|
+
isRTL,
|
|
133
|
+
fromMiniPlayer: videoModalState.mode === "MINIMIZED",
|
|
134
|
+
inlineAudioPlayer,
|
|
135
|
+
}),
|
|
136
|
+
[
|
|
137
|
+
bottomTabBarHeight,
|
|
138
|
+
minimisedHeight,
|
|
139
|
+
minimisedWidth,
|
|
140
|
+
defaultValue,
|
|
141
|
+
moveUpValue,
|
|
142
|
+
moveComponentHorizontalValue,
|
|
143
|
+
videoModalState.mode,
|
|
144
|
+
]
|
|
145
|
+
);
|
|
120
146
|
|
|
121
147
|
React.useEffect(() => {
|
|
122
148
|
if (additionalData.resetAnimationValue) {
|
|
@@ -129,13 +155,19 @@ export const AnimationView = ({
|
|
|
129
155
|
let width, height;
|
|
130
156
|
|
|
131
157
|
if (additionalData.aspectRatio) {
|
|
132
|
-
width =
|
|
133
|
-
|
|
158
|
+
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
159
|
+
|
|
160
|
+
height =
|
|
161
|
+
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
162
|
+
additionalData.aspectRatio;
|
|
134
163
|
} else {
|
|
135
|
-
width =
|
|
136
|
-
|
|
164
|
+
width =
|
|
165
|
+
typeof additionalData.width === "number" && additionalData.width;
|
|
166
|
+
|
|
167
|
+
height =
|
|
168
|
+
typeof additionalData.height === "number" && additionalData.height;
|
|
137
169
|
}
|
|
138
|
-
|
|
170
|
+
|
|
139
171
|
if (defaultValue.x === 0 && width && height) {
|
|
140
172
|
const value = { x: width, y: height };
|
|
141
173
|
setDefaultValue(value);
|
|
@@ -165,7 +197,10 @@ export const AnimationView = ({
|
|
|
165
197
|
|
|
166
198
|
case ComponentAnimationType.player: {
|
|
167
199
|
if (state === PlayerAnimationStateEnum.minimize) {
|
|
168
|
-
const minWidth =
|
|
200
|
+
const minWidth =
|
|
201
|
+
isAudioItem && !inlineAudioPlayer
|
|
202
|
+
? minimisedHeight
|
|
203
|
+
: minimisedWidth;
|
|
169
204
|
|
|
170
205
|
return {
|
|
171
206
|
...defaultConfig,
|
|
@@ -216,10 +251,10 @@ export const AnimationView = ({
|
|
|
216
251
|
|
|
217
252
|
return defaultConfig;
|
|
218
253
|
}
|
|
219
|
-
|
|
254
|
+
|
|
220
255
|
case ComponentAnimationType.moveComponentHorizontal: {
|
|
221
256
|
if (state === PlayerAnimationStateEnum.minimize) {
|
|
222
|
-
defaultConfig.toValue =
|
|
257
|
+
defaultConfig.toValue = moveComponentHorizontalValue;
|
|
223
258
|
|
|
224
259
|
return defaultConfig;
|
|
225
260
|
}
|
|
@@ -231,7 +266,9 @@ export const AnimationView = ({
|
|
|
231
266
|
|
|
232
267
|
case ComponentAnimationType.audioPlayerPaddingHorizontal: {
|
|
233
268
|
if (state === PlayerAnimationStateEnum.minimize) {
|
|
234
|
-
defaultConfig.toValue =
|
|
269
|
+
defaultConfig.toValue = isRTL
|
|
270
|
+
? AUDIO_PLAYER_HORIZONTAL_PADDING
|
|
271
|
+
: -AUDIO_PLAYER_HORIZONTAL_PADDING;
|
|
235
272
|
|
|
236
273
|
return defaultConfig;
|
|
237
274
|
}
|
|
@@ -256,8 +293,11 @@ export const AnimationView = ({
|
|
|
256
293
|
);
|
|
257
294
|
|
|
258
295
|
React.useEffect(() => {
|
|
259
|
-
if (
|
|
260
|
-
|
|
296
|
+
if (
|
|
297
|
+
playerAnimationState === PlayerAnimationStateEnum.minimize &&
|
|
298
|
+
startComponentsAnimation &&
|
|
299
|
+
videoModalState.mode === "MAXIMIZED"
|
|
300
|
+
) {
|
|
261
301
|
Animated.timing(
|
|
262
302
|
animatedValue,
|
|
263
303
|
getAnimationValue(animationType, playerAnimationState)
|
|
@@ -265,31 +305,43 @@ export const AnimationView = ({
|
|
|
265
305
|
} else if (playerAnimationState === PlayerAnimationStateEnum.maximaze) {
|
|
266
306
|
animatedValue.setValue(defaultValue);
|
|
267
307
|
}
|
|
268
|
-
}, [
|
|
308
|
+
}, [
|
|
309
|
+
playerAnimationState,
|
|
310
|
+
startComponentsAnimation,
|
|
311
|
+
videoModalState.mode,
|
|
312
|
+
defaultValue,
|
|
313
|
+
]);
|
|
269
314
|
|
|
270
315
|
React.useEffect(() => {
|
|
271
|
-
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
316
|
+
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
317
|
+
({ value }) => {
|
|
318
|
+
if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
|
|
319
|
+
const preparedValue = Math.round(Math.abs(value));
|
|
320
|
+
|
|
321
|
+
gestureListenerHelper({
|
|
322
|
+
listenerValue: value,
|
|
323
|
+
preparedValue,
|
|
324
|
+
animationType,
|
|
325
|
+
animatedValue,
|
|
326
|
+
calculationData,
|
|
327
|
+
modalSnapPoint: modalSnapPoints[1],
|
|
328
|
+
startAnimationDistance,
|
|
329
|
+
startComponentsAnimation,
|
|
330
|
+
setStartComponentsAnimation,
|
|
331
|
+
getAnimationValue,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
287
334
|
}
|
|
288
|
-
|
|
335
|
+
);
|
|
289
336
|
|
|
290
337
|
const dragListenerId = dragScrollY.addListener(({ value }) => {
|
|
291
|
-
if (
|
|
292
|
-
|
|
338
|
+
if (
|
|
339
|
+
scrollPosition.current === 0 &&
|
|
340
|
+
playerAnimationState === PlayerAnimationStateEnum.drag_scroll
|
|
341
|
+
) {
|
|
342
|
+
const preparedValue = Math.round(
|
|
343
|
+
Math.abs(value) - lastScrollYValue.current
|
|
344
|
+
);
|
|
293
345
|
|
|
294
346
|
gestureListenerHelper({
|
|
295
347
|
listenerValue: value,
|
|
@@ -305,7 +357,7 @@ export const AnimationView = ({
|
|
|
305
357
|
});
|
|
306
358
|
}
|
|
307
359
|
});
|
|
308
|
-
|
|
360
|
+
|
|
309
361
|
return () => {
|
|
310
362
|
dragScrollY.removeListener(dragListenerId);
|
|
311
363
|
dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
|
|
@@ -321,7 +373,8 @@ export const AnimationView = ({
|
|
|
321
373
|
style={[
|
|
322
374
|
...preparedStyles,
|
|
323
375
|
additionalData.saveArea ? styles.flex : null,
|
|
324
|
-
(videoModalState.mode === "MAXIMIZED" ||
|
|
376
|
+
(videoModalState.mode === "MAXIMIZED" ||
|
|
377
|
+
videoModalState.mode === "MINIMIZED") &&
|
|
325
378
|
getAnimationStyle(animationType, animatedValue),
|
|
326
379
|
]}
|
|
327
380
|
>
|
|
@@ -337,7 +390,9 @@ export const AnimationComponent = (props: Props) => {
|
|
|
337
390
|
videoModalState: { visible },
|
|
338
391
|
} = useNavigation();
|
|
339
392
|
|
|
340
|
-
const useAnimation =
|
|
393
|
+
const useAnimation =
|
|
394
|
+
visible && !additionalData.disableAnimatedComponent && !isTV();
|
|
395
|
+
|
|
341
396
|
const isReactFragment = !useAnimation && !style;
|
|
342
397
|
|
|
343
398
|
const Component = useAnimation
|
|
@@ -346,11 +401,12 @@ export const AnimationComponent = (props: Props) => {
|
|
|
346
401
|
? View
|
|
347
402
|
: React.Fragment;
|
|
348
403
|
|
|
349
|
-
if (
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
)
|
|
404
|
+
if (
|
|
405
|
+
additionalData.extraAnimation &&
|
|
406
|
+
typeof additionalData.extraAnimation === "object" &&
|
|
407
|
+
!Array.isArray(additionalData.extraAnimation) &&
|
|
408
|
+
!!Object.keys(additionalData.extraAnimation).length
|
|
409
|
+
) {
|
|
354
410
|
const animationType = Object.keys(additionalData.extraAnimation)[0];
|
|
355
411
|
const animationProps = additionalData.extraAnimation[animationType] || {};
|
|
356
412
|
delete additionalData.extraAnimation[animationType];
|
|
@@ -362,9 +418,12 @@ export const AnimationComponent = (props: Props) => {
|
|
|
362
418
|
animationType={animationType}
|
|
363
419
|
additionalData={{
|
|
364
420
|
...animationProps.additionalData,
|
|
365
|
-
extraAnimation:
|
|
366
|
-
|
|
367
|
-
|
|
421
|
+
extraAnimation:
|
|
422
|
+
!!Object.keys(additionalData.extraAnimation).length &&
|
|
423
|
+
additionalData.extraAnimation,
|
|
424
|
+
}}
|
|
425
|
+
>
|
|
426
|
+
{props.children}
|
|
368
427
|
</AnimationComponent>
|
|
369
428
|
</Component>
|
|
370
429
|
);
|
|
@@ -69,19 +69,20 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
69
69
|
const [playerAnimationState, setPlayerAnimationState] =
|
|
70
70
|
React.useState<PlayerAnimationStateT>(null);
|
|
71
71
|
|
|
72
|
-
const [
|
|
73
|
-
|
|
72
|
+
const [
|
|
73
|
+
tabletLandscapePlayerTopPosition,
|
|
74
|
+
setTabletLandscapePlayerTopPosition,
|
|
75
|
+
] = React.useState<number>(0);
|
|
74
76
|
|
|
75
|
-
const [startComponentsAnimation, setStartComponentsAnimation] =
|
|
77
|
+
const [startComponentsAnimation, setStartComponentsAnimation] =
|
|
78
|
+
React.useState<boolean>(false);
|
|
76
79
|
|
|
77
80
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
78
81
|
|
|
79
|
-
const resetPlayerAnimationState = React.useCallback(
|
|
80
|
-
()
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, []
|
|
84
|
-
);
|
|
82
|
+
const resetPlayerAnimationState = React.useCallback(() => {
|
|
83
|
+
setPlayerAnimationState(null);
|
|
84
|
+
setStartComponentsAnimation(false);
|
|
85
|
+
}, []);
|
|
85
86
|
|
|
86
87
|
// Animated values
|
|
87
88
|
const lastScrollY = React.useRef(new Animated.Value(0)).current;
|
|
@@ -69,11 +69,7 @@ export const getAnimationDefaultValue = (component, bottomTabBarHeight) => {
|
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
export const calculateAnimationValue = (
|
|
73
|
-
animationType,
|
|
74
|
-
dragPosition,
|
|
75
|
-
data
|
|
76
|
-
) => {
|
|
72
|
+
export const calculateAnimationValue = (animationType, dragPosition, data) => {
|
|
77
73
|
const {
|
|
78
74
|
isAudioItem,
|
|
79
75
|
bottomTabBarHeight,
|
|
@@ -83,33 +79,55 @@ export const calculateAnimationValue = (
|
|
|
83
79
|
moveUpValue,
|
|
84
80
|
moveComponentHorizontalValue,
|
|
85
81
|
isTablet,
|
|
86
|
-
|
|
82
|
+
isTabletLandscape,
|
|
87
83
|
isRTL,
|
|
88
84
|
fromMiniPlayer,
|
|
85
|
+
inlineAudioPlayer,
|
|
89
86
|
} = data;
|
|
90
87
|
|
|
91
88
|
switch (animationType) {
|
|
92
89
|
case ComponentAnimationType.bottomBar: {
|
|
93
90
|
if (fromMiniPlayer) {
|
|
94
|
-
return dragPosition < bottomTabBarHeight
|
|
91
|
+
return dragPosition < bottomTabBarHeight
|
|
92
|
+
? dragPosition
|
|
93
|
+
: bottomTabBarHeight;
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
return dragPosition < bottomTabBarHeight
|
|
96
|
+
return dragPosition < bottomTabBarHeight
|
|
97
|
+
? bottomTabBarHeight - dragPosition
|
|
98
|
+
: 0;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
case ComponentAnimationType.player: {
|
|
101
|
-
const value =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
102
|
+
const value =
|
|
103
|
+
isAudioItem && !inlineAudioPlayer
|
|
104
|
+
? isTabletLandscape
|
|
105
|
+
? fromMiniPlayer
|
|
106
|
+
? { forWidth: 4, forHeight: 4.5 }
|
|
107
|
+
: { forWidth: 3, forHeight: 3 }
|
|
108
|
+
: { forWidth: 2, forHeight: 2 }
|
|
109
|
+
: isTabletLandscape
|
|
110
|
+
? { forWidth: 8, forHeight: 6.5 }
|
|
111
|
+
: { forWidth: 3.5, forHeight: 2 };
|
|
112
|
+
|
|
113
|
+
const minWidth =
|
|
114
|
+
isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
|
|
106
115
|
|
|
107
116
|
if (fromMiniPlayer) {
|
|
108
|
-
const calculationWidth =
|
|
109
|
-
|
|
117
|
+
const calculationWidth =
|
|
118
|
+
dragPosition * value.forWidth < minWidth
|
|
119
|
+
? minWidth
|
|
120
|
+
: dragPosition * value.forWidth;
|
|
121
|
+
const calculationHeight =
|
|
122
|
+
dragPosition * value.forHeight < minimisedHeight
|
|
123
|
+
? minimisedHeight
|
|
124
|
+
: dragPosition * value.forHeight;
|
|
110
125
|
|
|
111
126
|
return {
|
|
112
|
-
x:
|
|
127
|
+
x:
|
|
128
|
+
calculationWidth < defaultValue.x
|
|
129
|
+
? calculationWidth
|
|
130
|
+
: defaultValue.x,
|
|
113
131
|
y:
|
|
114
132
|
calculationHeight < defaultValue.y
|
|
115
133
|
? calculationHeight
|
|
@@ -117,11 +135,9 @@ export const calculateAnimationValue = (
|
|
|
117
135
|
};
|
|
118
136
|
}
|
|
119
137
|
|
|
120
|
-
const calculationWidth =
|
|
121
|
-
defaultValue.x - dragPosition * value.forWidth;
|
|
138
|
+
const calculationWidth = defaultValue.x - dragPosition * value.forWidth;
|
|
122
139
|
|
|
123
|
-
const calculationHeight =
|
|
124
|
-
defaultValue.y - dragPosition * value.forHeight;
|
|
140
|
+
const calculationHeight = defaultValue.y - dragPosition * value.forHeight;
|
|
125
141
|
|
|
126
142
|
return {
|
|
127
143
|
x: calculationWidth > minWidth ? calculationWidth : minWidth,
|
|
@@ -158,38 +174,53 @@ export const calculateAnimationValue = (
|
|
|
158
174
|
|
|
159
175
|
case ComponentAnimationType.moveUpComponent: {
|
|
160
176
|
if (fromMiniPlayer) {
|
|
161
|
-
const calculation =
|
|
177
|
+
const calculation =
|
|
178
|
+
moveUpValue + dragPosition / (isTabletLandscape ? 1 : 4);
|
|
162
179
|
|
|
163
180
|
return calculation < 0 ? calculation : 0;
|
|
164
181
|
}
|
|
165
|
-
|
|
166
|
-
const calculation = 0 - dragPosition / (
|
|
182
|
+
|
|
183
|
+
const calculation = 0 - dragPosition / (isTabletLandscape ? 1 : 2);
|
|
167
184
|
|
|
168
185
|
return calculation > moveUpValue ? calculation : moveUpValue;
|
|
169
186
|
}
|
|
170
187
|
|
|
171
188
|
case ComponentAnimationType.moveComponentHorizontal: {
|
|
172
189
|
if (fromMiniPlayer) {
|
|
173
|
-
const calculation =
|
|
190
|
+
const calculation = isRTL
|
|
191
|
+
? moveComponentHorizontalValue - dragPosition * 2
|
|
192
|
+
: moveComponentHorizontalValue + dragPosition * 2;
|
|
193
|
+
const condition = isRTL ? calculation > 0 : calculation < 0;
|
|
174
194
|
|
|
175
|
-
return
|
|
195
|
+
return condition ? calculation : 0;
|
|
176
196
|
}
|
|
177
197
|
|
|
178
|
-
const calculation = dragPosition * 2;
|
|
198
|
+
const calculation = isRTL ? dragPosition * 2 : -(dragPosition * 2);
|
|
199
|
+
const condition = isRTL
|
|
200
|
+
? calculation < moveComponentHorizontalValue
|
|
201
|
+
: calculation > moveComponentHorizontalValue;
|
|
179
202
|
|
|
180
|
-
return
|
|
203
|
+
return condition ? calculation : moveComponentHorizontalValue;
|
|
181
204
|
}
|
|
182
205
|
|
|
183
206
|
case ComponentAnimationType.audioPlayerPaddingHorizontal: {
|
|
207
|
+
const padding = isRTL
|
|
208
|
+
? AUDIO_PLAYER_HORIZONTAL_PADDING
|
|
209
|
+
: -AUDIO_PLAYER_HORIZONTAL_PADDING;
|
|
210
|
+
|
|
184
211
|
if (fromMiniPlayer) {
|
|
185
|
-
const calculation =
|
|
212
|
+
const calculation = isRTL
|
|
213
|
+
? padding - dragPosition / 5
|
|
214
|
+
: padding + dragPosition / 5;
|
|
215
|
+
const condition = isRTL ? calculation > 0 : calculation < 0;
|
|
186
216
|
|
|
187
|
-
return
|
|
217
|
+
return condition ? calculation : 0;
|
|
188
218
|
}
|
|
189
219
|
|
|
190
|
-
const calculation = dragPosition / 5;
|
|
220
|
+
const calculation = isRTL ? dragPosition / 5 : -(dragPosition / 5);
|
|
221
|
+
const condition = isRTL ? calculation < padding : calculation > padding;
|
|
191
222
|
|
|
192
|
-
return
|
|
223
|
+
return condition ? calculation : padding;
|
|
193
224
|
}
|
|
194
225
|
}
|
|
195
226
|
};
|
|
@@ -210,7 +241,10 @@ export const gestureListenerHelper = (data) => {
|
|
|
210
241
|
|
|
211
242
|
if (calculationData.fromMiniPlayer) {
|
|
212
243
|
if (listenerValue <= 0) {
|
|
213
|
-
if (
|
|
244
|
+
if (
|
|
245
|
+
preparedValue >= 0 &&
|
|
246
|
+
preparedValue <= modalSnapPoint - startAnimationDistance
|
|
247
|
+
) {
|
|
214
248
|
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
215
249
|
|
|
216
250
|
animatedValue.setValue(
|
|
@@ -218,11 +252,9 @@ export const gestureListenerHelper = (data) => {
|
|
|
218
252
|
);
|
|
219
253
|
} else {
|
|
220
254
|
animatedValue.setValue(calculationData.defaultValue);
|
|
221
|
-
startComponentsAnimation &&
|
|
255
|
+
startComponentsAnimation && setStartComponentsAnimation(false);
|
|
222
256
|
}
|
|
223
257
|
} else {
|
|
224
|
-
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
225
|
-
|
|
226
258
|
const value = getAnimationValue(
|
|
227
259
|
animationType,
|
|
228
260
|
PlayerAnimationStateEnum.minimize
|
|
@@ -240,7 +272,7 @@ export const gestureListenerHelper = (data) => {
|
|
|
240
272
|
);
|
|
241
273
|
} else {
|
|
242
274
|
animatedValue.setValue(calculationData.defaultValue);
|
|
243
|
-
startComponentsAnimation &&
|
|
275
|
+
startComponentsAnimation && setStartComponentsAnimation(false);
|
|
244
276
|
}
|
|
245
277
|
}
|
|
246
278
|
};
|
|
@@ -258,7 +290,7 @@ export const resetScrollAnimatedValues = (
|
|
|
258
290
|
lastScrollY,
|
|
259
291
|
lastScrollYValue,
|
|
260
292
|
dragScrollY,
|
|
261
|
-
dragVideoPlayerY
|
|
293
|
+
dragVideoPlayerY
|
|
262
294
|
) => {
|
|
263
295
|
lastScrollY.setValue(0);
|
|
264
296
|
lastScrollYValue.current = 0;
|