@applicaster/zapp-react-native-ui-components 15.0.0-alpha.6750855753 → 15.0.0-alpha.7413430163
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/AnimatedInOut/index.tsx +69 -26
- package/Components/Cell/Cell.tsx +8 -3
- package/Components/Cell/TvOSCellComponent.tsx +12 -3
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -65
- package/Components/HandlePlayable/const.ts +3 -0
- package/Components/HandlePlayable/utils.ts +74 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +16 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +30 -2
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +8 -8
- package/Components/MasterCell/index.tsx +2 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +1 -16
- package/Components/PlayerImageBackground/index.tsx +3 -22
- package/Components/ScreenRevealManager/withScreenRevealManager.tsx +44 -26
- package/Components/Tabs/TV/Tabs.tsx +20 -3
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -0
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +114 -171
- package/Components/VideoModal/ModalAnimation/index.ts +2 -13
- package/Components/VideoModal/ModalAnimation/utils.ts +1 -327
- package/Components/VideoModal/PlayerWrapper.tsx +14 -88
- package/Components/VideoModal/VideoModal.tsx +1 -5
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -0
- package/Components/VideoModal/hooks/useModalSize.ts +10 -5
- package/Components/VideoModal/playerWrapperStyle.ts +70 -0
- package/Components/VideoModal/playerWrapperUtils.ts +91 -0
- package/Components/VideoModal/utils.ts +7 -0
- package/index.d.ts +7 -0
- package/package.json +5 -5
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +0 -60
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +0 -417
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.web.tsx +0 -294
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +0 -176
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.web.tsx +0 -93
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +0 -500
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
|
@@ -1,500 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState } from "react";
|
|
2
|
-
import { Animated, View } from "react-native";
|
|
3
|
-
|
|
4
|
-
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
PlayerAnimationStateEnum,
|
|
8
|
-
useModalAnimationContext,
|
|
9
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
useDimensions,
|
|
13
|
-
useGetBottomTabBarHeight,
|
|
14
|
-
useNavigation,
|
|
15
|
-
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
16
|
-
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
17
|
-
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
|
-
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
19
|
-
|
|
20
|
-
import {
|
|
21
|
-
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
22
|
-
ComponentAnimationType,
|
|
23
|
-
defaultAspectRatioWidth,
|
|
24
|
-
gestureListenerHelper,
|
|
25
|
-
getAnimationDefaultValue,
|
|
26
|
-
getAnimationStyle,
|
|
27
|
-
getMoveUpValue,
|
|
28
|
-
} from "./utils";
|
|
29
|
-
|
|
30
|
-
import { DURATION_TO_MINIMIZE, DEFAULT_DURATION_FOR_ANIMATION } from "./const";
|
|
31
|
-
|
|
32
|
-
type Props = {
|
|
33
|
-
animationType: string;
|
|
34
|
-
children: React.ReactNode;
|
|
35
|
-
style?: Record<string, any>;
|
|
36
|
-
additionalData?: { [key: string]: any };
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const AnimationView = ({
|
|
40
|
-
animationType,
|
|
41
|
-
style,
|
|
42
|
-
children,
|
|
43
|
-
additionalData = {},
|
|
44
|
-
}: Props) => {
|
|
45
|
-
const {
|
|
46
|
-
startComponentsAnimation,
|
|
47
|
-
setStartComponentsAnimation,
|
|
48
|
-
playerAnimationState,
|
|
49
|
-
minimisedHeight,
|
|
50
|
-
animatedValues: { dragScrollY, dragVideoPlayerY },
|
|
51
|
-
lastScrollYValue,
|
|
52
|
-
scrollPosition,
|
|
53
|
-
tabletLandscapePlayerTopPosition,
|
|
54
|
-
setTabletLandscapePlayerTopPosition,
|
|
55
|
-
modalSnapPoints,
|
|
56
|
-
startComponentsAnimationDistance,
|
|
57
|
-
progressBarHeight,
|
|
58
|
-
} = useModalAnimationContext();
|
|
59
|
-
|
|
60
|
-
const isRTL = useIsRTL();
|
|
61
|
-
const isAppActive = useAppState(true);
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
width: screenWidth,
|
|
65
|
-
deviceInfo: { isTablet, isTabletLandscape },
|
|
66
|
-
} = useDimensions("window", {
|
|
67
|
-
deviceInfo: true,
|
|
68
|
-
updateForInactiveScreens: true,
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const { videoModalState } = useNavigation();
|
|
72
|
-
const { mode: videoModalMode, item: videoModalItem } = videoModalState;
|
|
73
|
-
|
|
74
|
-
const insets = useSafeAreaInsets();
|
|
75
|
-
const bottomTabBarHeight = useGetBottomTabBarHeight() + (insets.bottom || 0);
|
|
76
|
-
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
77
|
-
const animationComponentRef = useRef(null);
|
|
78
|
-
|
|
79
|
-
// retrieving top position of the player for tablet landscape mode
|
|
80
|
-
const measureView = React.useCallback(() => {
|
|
81
|
-
if (isTabletLandscape && tabletLandscapePlayerTopPosition === 0) {
|
|
82
|
-
animationComponentRef.current.measure(
|
|
83
|
-
(_x, _y, _width, _height, _pageX, pageY) => {
|
|
84
|
-
setTabletLandscapePlayerTopPosition(pageY - 20);
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
}, [tabletLandscapePlayerTopPosition]);
|
|
89
|
-
|
|
90
|
-
const [defaultValue, setDefaultValue] = useState<any>(
|
|
91
|
-
getAnimationDefaultValue(animationType, bottomTabBarHeight)
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
const isAudioItem = React.useMemo(
|
|
95
|
-
() =>
|
|
96
|
-
videoModalItem?.content?.type?.includes?.("audio") ||
|
|
97
|
-
videoModalItem?.type?.value?.includes?.("audio"),
|
|
98
|
-
[videoModalItem]
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
102
|
-
|
|
103
|
-
const moveUpValue = getMoveUpValue({
|
|
104
|
-
additionalData,
|
|
105
|
-
insets,
|
|
106
|
-
isAudioItem,
|
|
107
|
-
progressBarHeight,
|
|
108
|
-
isTablet,
|
|
109
|
-
isTabletLandscape,
|
|
110
|
-
tabletLandscapePlayerTopPosition,
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
const moveComponentHorizontalValue = additionalData.moveValue
|
|
114
|
-
? isRTL
|
|
115
|
-
? additionalData.moveValue
|
|
116
|
-
: -additionalData.moveValue
|
|
117
|
-
: 0;
|
|
118
|
-
|
|
119
|
-
const animationValueType: string =
|
|
120
|
-
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
121
|
-
|
|
122
|
-
const getAnimationValue = React.useCallback(
|
|
123
|
-
(animationType, state) => {
|
|
124
|
-
const defaultConfig = {
|
|
125
|
-
toValue: 0,
|
|
126
|
-
duration:
|
|
127
|
-
state === PlayerAnimationStateEnum.minimize
|
|
128
|
-
? DURATION_TO_MINIMIZE
|
|
129
|
-
: DEFAULT_DURATION_FOR_ANIMATION,
|
|
130
|
-
useNativeDriver: true,
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
switch (animationType) {
|
|
134
|
-
case ComponentAnimationType.bottomBar: {
|
|
135
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
136
|
-
return defaultConfig;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
defaultConfig.toValue = defaultValue;
|
|
140
|
-
|
|
141
|
-
return defaultConfig;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
case ComponentAnimationType.player: {
|
|
145
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
146
|
-
const minWidth =
|
|
147
|
-
isAudioItem && !inlineAudioPlayer
|
|
148
|
-
? minimisedHeight
|
|
149
|
-
: minimisedWidth;
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
...defaultConfig,
|
|
153
|
-
toValue: { x: minWidth, y: minimisedHeight },
|
|
154
|
-
useNativeDriver: false,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return {
|
|
159
|
-
...defaultConfig,
|
|
160
|
-
toValue: defaultValue,
|
|
161
|
-
useNativeDriver: false,
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
case ComponentAnimationType.componentFade: {
|
|
166
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
167
|
-
defaultConfig.toValue = 0;
|
|
168
|
-
|
|
169
|
-
return defaultConfig;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
defaultConfig.toValue = defaultValue;
|
|
173
|
-
|
|
174
|
-
return defaultConfig;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
case ComponentAnimationType.componentAppears: {
|
|
178
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
179
|
-
defaultConfig.toValue = 1;
|
|
180
|
-
|
|
181
|
-
return defaultConfig;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
defaultConfig.toValue = defaultValue;
|
|
185
|
-
|
|
186
|
-
return defaultConfig;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
case ComponentAnimationType.moveUpComponent: {
|
|
190
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
191
|
-
defaultConfig.toValue = moveUpValue;
|
|
192
|
-
|
|
193
|
-
return defaultConfig;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
defaultConfig.toValue = defaultValue;
|
|
197
|
-
|
|
198
|
-
return defaultConfig;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
case ComponentAnimationType.moveComponentHorizontal: {
|
|
202
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
203
|
-
defaultConfig.toValue = moveComponentHorizontalValue;
|
|
204
|
-
|
|
205
|
-
return defaultConfig;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
defaultConfig.toValue = defaultValue;
|
|
209
|
-
|
|
210
|
-
return defaultConfig;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
case ComponentAnimationType.audioPlayerPaddingHorizontal: {
|
|
214
|
-
if (state === PlayerAnimationStateEnum.minimize) {
|
|
215
|
-
defaultConfig.toValue = isRTL
|
|
216
|
-
? AUDIO_PLAYER_HORIZONTAL_PADDING
|
|
217
|
-
: -AUDIO_PLAYER_HORIZONTAL_PADDING;
|
|
218
|
-
|
|
219
|
-
return defaultConfig;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
defaultConfig.toValue = 0;
|
|
223
|
-
|
|
224
|
-
return defaultConfig;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
default:
|
|
228
|
-
return defaultConfig;
|
|
229
|
-
}
|
|
230
|
-
},
|
|
231
|
-
[
|
|
232
|
-
defaultValue,
|
|
233
|
-
minimisedWidth,
|
|
234
|
-
minimisedHeight,
|
|
235
|
-
isAudioItem,
|
|
236
|
-
moveUpValue,
|
|
237
|
-
moveComponentHorizontalValue,
|
|
238
|
-
isRTL,
|
|
239
|
-
inlineAudioPlayer,
|
|
240
|
-
]
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
const getInitialValue = React.useCallback(() => {
|
|
244
|
-
const { mode: videoModalMode, previousMode } = videoModalState;
|
|
245
|
-
const mode = videoModalMode === "PIP" ? previousMode : videoModalMode;
|
|
246
|
-
|
|
247
|
-
switch (mode) {
|
|
248
|
-
case "MINIMIZED":
|
|
249
|
-
return getAnimationValue(
|
|
250
|
-
animationType,
|
|
251
|
-
PlayerAnimationStateEnum.minimize
|
|
252
|
-
).toValue;
|
|
253
|
-
|
|
254
|
-
case "MAXIMIZED":
|
|
255
|
-
default:
|
|
256
|
-
return getAnimationValue(
|
|
257
|
-
animationType,
|
|
258
|
-
PlayerAnimationStateEnum.maximize
|
|
259
|
-
).toValue;
|
|
260
|
-
}
|
|
261
|
-
}, [defaultValue, videoModalState]);
|
|
262
|
-
|
|
263
|
-
const animatedValue = useRef(
|
|
264
|
-
new Animated[animationValueType](getInitialValue())
|
|
265
|
-
).current;
|
|
266
|
-
|
|
267
|
-
const calculationData = React.useMemo(
|
|
268
|
-
() => ({
|
|
269
|
-
isAudioItem,
|
|
270
|
-
bottomTabBarHeight,
|
|
271
|
-
minimisedHeight,
|
|
272
|
-
minimisedWidth,
|
|
273
|
-
defaultValue,
|
|
274
|
-
moveUpValue,
|
|
275
|
-
moveComponentHorizontalValue,
|
|
276
|
-
isTablet,
|
|
277
|
-
isTabletLandscape,
|
|
278
|
-
isRTL,
|
|
279
|
-
fromMiniPlayer: videoModalMode === "MINIMIZED",
|
|
280
|
-
inlineAudioPlayer,
|
|
281
|
-
}),
|
|
282
|
-
[
|
|
283
|
-
bottomTabBarHeight,
|
|
284
|
-
minimisedHeight,
|
|
285
|
-
minimisedWidth,
|
|
286
|
-
defaultValue,
|
|
287
|
-
moveUpValue,
|
|
288
|
-
moveComponentHorizontalValue,
|
|
289
|
-
videoModalMode,
|
|
290
|
-
isAudioItem,
|
|
291
|
-
isTablet,
|
|
292
|
-
isTabletLandscape,
|
|
293
|
-
isRTL,
|
|
294
|
-
inlineAudioPlayer,
|
|
295
|
-
]
|
|
296
|
-
);
|
|
297
|
-
|
|
298
|
-
React.useEffect(() => {
|
|
299
|
-
if (additionalData.resetAnimationValue) {
|
|
300
|
-
animatedValue.setValue(defaultValue);
|
|
301
|
-
}
|
|
302
|
-
}, [additionalData.resetAnimationValue, defaultValue]);
|
|
303
|
-
|
|
304
|
-
React.useEffect(() => {
|
|
305
|
-
if (animationType === ComponentAnimationType.player) {
|
|
306
|
-
let width, height;
|
|
307
|
-
|
|
308
|
-
if (additionalData.aspectRatio) {
|
|
309
|
-
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
310
|
-
|
|
311
|
-
height =
|
|
312
|
-
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
313
|
-
additionalData.aspectRatio;
|
|
314
|
-
} else {
|
|
315
|
-
width =
|
|
316
|
-
typeof additionalData.width === "number" && additionalData.width;
|
|
317
|
-
|
|
318
|
-
height =
|
|
319
|
-
typeof additionalData.height === "number" && additionalData.height;
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
if (
|
|
323
|
-
(videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
|
|
324
|
-
defaultValue.x !== screenWidth &&
|
|
325
|
-
width &&
|
|
326
|
-
height
|
|
327
|
-
) {
|
|
328
|
-
const value = { x: width, y: height };
|
|
329
|
-
setDefaultValue(value);
|
|
330
|
-
animatedValue.setValue(value);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
}, [screenWidth]);
|
|
334
|
-
|
|
335
|
-
React.useEffect(() => {
|
|
336
|
-
const { mode, previousMode } = videoModalState;
|
|
337
|
-
|
|
338
|
-
if (mode === "MINIMIZED" && previousMode === "MAXIMIZED") {
|
|
339
|
-
// set animation to the minimize values if moving from the player to another screen
|
|
340
|
-
if (playerAnimationState === null) {
|
|
341
|
-
const value = getAnimationValue(
|
|
342
|
-
animationType,
|
|
343
|
-
PlayerAnimationStateEnum.minimize
|
|
344
|
-
).toValue;
|
|
345
|
-
|
|
346
|
-
animatedValue.setValue(value);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
}, [
|
|
350
|
-
animatedValue,
|
|
351
|
-
animationType,
|
|
352
|
-
getAnimationValue,
|
|
353
|
-
playerAnimationState,
|
|
354
|
-
videoModalState,
|
|
355
|
-
]);
|
|
356
|
-
|
|
357
|
-
React.useEffect(() => {
|
|
358
|
-
if (
|
|
359
|
-
playerAnimationState === PlayerAnimationStateEnum.minimize &&
|
|
360
|
-
startComponentsAnimation &&
|
|
361
|
-
videoModalMode === "MAXIMIZED"
|
|
362
|
-
) {
|
|
363
|
-
Animated.timing(
|
|
364
|
-
animatedValue,
|
|
365
|
-
getAnimationValue(animationType, playerAnimationState)
|
|
366
|
-
).start();
|
|
367
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
368
|
-
animatedValue.setValue(defaultValue);
|
|
369
|
-
}
|
|
370
|
-
}, [playerAnimationState, startComponentsAnimation, defaultValue]);
|
|
371
|
-
|
|
372
|
-
React.useEffect(() => {
|
|
373
|
-
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
374
|
-
({ value }) => {
|
|
375
|
-
if (playerAnimationState === PlayerAnimationStateEnum.drag_player) {
|
|
376
|
-
const preparedValue = Math.round(Math.abs(value));
|
|
377
|
-
|
|
378
|
-
gestureListenerHelper({
|
|
379
|
-
listenerValue: value,
|
|
380
|
-
preparedValue,
|
|
381
|
-
animationType,
|
|
382
|
-
animatedValue,
|
|
383
|
-
calculationData,
|
|
384
|
-
modalSnapPoint: modalSnapPoints[1],
|
|
385
|
-
startComponentsAnimationDistance,
|
|
386
|
-
startComponentsAnimation,
|
|
387
|
-
setStartComponentsAnimation,
|
|
388
|
-
getAnimationValue,
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
);
|
|
393
|
-
|
|
394
|
-
const dragListenerId = dragScrollY.addListener(({ value }) => {
|
|
395
|
-
if (
|
|
396
|
-
scrollPosition.current === 0 &&
|
|
397
|
-
playerAnimationState === PlayerAnimationStateEnum.drag_scroll
|
|
398
|
-
) {
|
|
399
|
-
const preparedValue = Math.round(
|
|
400
|
-
Math.abs(value) - lastScrollYValue.current
|
|
401
|
-
);
|
|
402
|
-
|
|
403
|
-
gestureListenerHelper({
|
|
404
|
-
listenerValue: value,
|
|
405
|
-
preparedValue,
|
|
406
|
-
animationType,
|
|
407
|
-
animatedValue,
|
|
408
|
-
calculationData,
|
|
409
|
-
modalSnapPoint: modalSnapPoints[1],
|
|
410
|
-
startComponentsAnimationDistance,
|
|
411
|
-
startComponentsAnimation,
|
|
412
|
-
setStartComponentsAnimation,
|
|
413
|
-
getAnimationValue,
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
|
|
418
|
-
return () => {
|
|
419
|
-
dragScrollY.removeListener(dragListenerId);
|
|
420
|
-
dragVideoPlayerY.removeListener(dragVideoPlayerYListenerId);
|
|
421
|
-
};
|
|
422
|
-
}, [playerAnimationState, calculationData, startComponentsAnimation]);
|
|
423
|
-
|
|
424
|
-
const preparedStyles = Array.isArray(style) ? style : [style];
|
|
425
|
-
|
|
426
|
-
return (
|
|
427
|
-
<Animated.View
|
|
428
|
-
onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
|
|
429
|
-
ref={animationComponentRef}
|
|
430
|
-
style={[
|
|
431
|
-
...preparedStyles,
|
|
432
|
-
(videoModalMode === "MAXIMIZED" ||
|
|
433
|
-
videoModalMode === "MINIMIZED" ||
|
|
434
|
-
(videoModalMode === "PIP" && isAppActive)) &&
|
|
435
|
-
getAnimationStyle(animationType, animatedValue),
|
|
436
|
-
]}
|
|
437
|
-
>
|
|
438
|
-
{children}
|
|
439
|
-
</Animated.View>
|
|
440
|
-
);
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
export const AnimationComponent = (props: Props) => {
|
|
444
|
-
const { additionalData = {}, style } = props;
|
|
445
|
-
|
|
446
|
-
const {
|
|
447
|
-
videoModalState: { visible },
|
|
448
|
-
} = useNavigation();
|
|
449
|
-
|
|
450
|
-
if (additionalData?.disableAnimatedComponent) {
|
|
451
|
-
return <>{props.children}</>;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
const useAnimation =
|
|
455
|
-
visible && !additionalData.disableAnimatedComponent && !isTV();
|
|
456
|
-
|
|
457
|
-
const isReactFragment = !useAnimation && !style;
|
|
458
|
-
|
|
459
|
-
const Component = useAnimation
|
|
460
|
-
? AnimationView
|
|
461
|
-
: style
|
|
462
|
-
? View
|
|
463
|
-
: React.Fragment;
|
|
464
|
-
|
|
465
|
-
if (
|
|
466
|
-
additionalData.extraAnimation &&
|
|
467
|
-
typeof additionalData.extraAnimation === "object" &&
|
|
468
|
-
!Array.isArray(additionalData.extraAnimation) &&
|
|
469
|
-
!!Object.keys(additionalData.extraAnimation).length
|
|
470
|
-
) {
|
|
471
|
-
const animationType = Object.keys(additionalData.extraAnimation)[0];
|
|
472
|
-
const animationProps = additionalData.extraAnimation[animationType] || {};
|
|
473
|
-
delete additionalData.extraAnimation[animationType];
|
|
474
|
-
|
|
475
|
-
return (
|
|
476
|
-
// @ts-ignore
|
|
477
|
-
<Component {...(isReactFragment ? null : props)}>
|
|
478
|
-
<AnimationComponent
|
|
479
|
-
{...animationProps}
|
|
480
|
-
animationType={animationType}
|
|
481
|
-
additionalData={{
|
|
482
|
-
...animationProps.additionalData,
|
|
483
|
-
extraAnimation:
|
|
484
|
-
!!Object.keys(additionalData.extraAnimation).length &&
|
|
485
|
-
additionalData.extraAnimation,
|
|
486
|
-
}}
|
|
487
|
-
>
|
|
488
|
-
{props.children}
|
|
489
|
-
</AnimationComponent>
|
|
490
|
-
</Component>
|
|
491
|
-
);
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
if (isReactFragment) {
|
|
495
|
-
// @ts-ignore
|
|
496
|
-
return <Component>{props.children}</Component>;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
return <Component {...props}>{props.children}</Component>;
|
|
500
|
-
};
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { getMoveUpValue } from "../utils";
|
|
2
|
-
|
|
3
|
-
describe("getMoveUpValue", () => {
|
|
4
|
-
it("returns correct value when additionalData.saveArea is true and isAudioItem is false", () => {
|
|
5
|
-
const result = getMoveUpValue({
|
|
6
|
-
additionalData: { saveArea: true },
|
|
7
|
-
insets: { top: 20 },
|
|
8
|
-
isAudioItem: false,
|
|
9
|
-
progressBarHeight: 10,
|
|
10
|
-
isTablet: false,
|
|
11
|
-
isTabletLandscape: false,
|
|
12
|
-
inlineAudioPlayer: false,
|
|
13
|
-
tabletLandscapePlayerTopPosition: 100,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
expect(result).toBe(-20 + 10);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("returns correct value when additionalData.saveArea is true and isAudioItem is true", () => {
|
|
20
|
-
const result = getMoveUpValue({
|
|
21
|
-
additionalData: { saveArea: true },
|
|
22
|
-
insets: { top: 15 },
|
|
23
|
-
isAudioItem: true,
|
|
24
|
-
progressBarHeight: 5,
|
|
25
|
-
isTablet: false,
|
|
26
|
-
isTabletLandscape: false,
|
|
27
|
-
inlineAudioPlayer: false,
|
|
28
|
-
tabletLandscapePlayerTopPosition: 100,
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
expect(result).toBe(-15 + 0);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("returns correct value for audio item (tablet or not)", () => {
|
|
35
|
-
const result = getMoveUpValue({
|
|
36
|
-
additionalData: { marginTop: 30 },
|
|
37
|
-
insets: { top: 0 },
|
|
38
|
-
isAudioItem: true,
|
|
39
|
-
progressBarHeight: 0,
|
|
40
|
-
isTablet: false,
|
|
41
|
-
isTabletLandscape: false,
|
|
42
|
-
inlineAudioPlayer: false,
|
|
43
|
-
tabletLandscapePlayerTopPosition: 0,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
expect(result).toBe(-30);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("returns correct value for tablet landscape with inline audio player", () => {
|
|
50
|
-
const result = getMoveUpValue({
|
|
51
|
-
additionalData: {},
|
|
52
|
-
insets: { top: 0 },
|
|
53
|
-
isAudioItem: true,
|
|
54
|
-
progressBarHeight: 8,
|
|
55
|
-
isTablet: true,
|
|
56
|
-
isTabletLandscape: true,
|
|
57
|
-
inlineAudioPlayer: true,
|
|
58
|
-
tabletLandscapePlayerTopPosition: 50,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
expect(result).toBe(-0);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it("returns correct value for tablet landscape without audio item", () => {
|
|
65
|
-
const result = getMoveUpValue({
|
|
66
|
-
additionalData: {},
|
|
67
|
-
insets: { top: 0 },
|
|
68
|
-
isAudioItem: false,
|
|
69
|
-
progressBarHeight: 12,
|
|
70
|
-
isTablet: true,
|
|
71
|
-
isTabletLandscape: true,
|
|
72
|
-
inlineAudioPlayer: false,
|
|
73
|
-
tabletLandscapePlayerTopPosition: 60,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
expect(result).toBe(-60 + 12);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("returns -130 for tablet portrait (not landscape)", () => {
|
|
80
|
-
const result = getMoveUpValue({
|
|
81
|
-
additionalData: {},
|
|
82
|
-
insets: { top: 0 },
|
|
83
|
-
isAudioItem: false,
|
|
84
|
-
progressBarHeight: 0,
|
|
85
|
-
isTablet: true,
|
|
86
|
-
isTabletLandscape: false,
|
|
87
|
-
inlineAudioPlayer: false,
|
|
88
|
-
tabletLandscapePlayerTopPosition: 0,
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
expect(result).toBe(-130);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it("returns -50 + progressBarHeight for mobile audio player in docked mode", () => {
|
|
95
|
-
const result = getMoveUpValue({
|
|
96
|
-
additionalData: {},
|
|
97
|
-
insets: { top: 0 },
|
|
98
|
-
isAudioItem: false,
|
|
99
|
-
progressBarHeight: 7,
|
|
100
|
-
isTablet: false,
|
|
101
|
-
isTabletLandscape: false,
|
|
102
|
-
inlineAudioPlayer: false,
|
|
103
|
-
tabletLandscapePlayerTopPosition: 0,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
expect(result).toBe(-50 + 7);
|
|
107
|
-
});
|
|
108
|
-
});
|