@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4837064762 → 12.0.0-alpha.4885205607
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/BaseFocusable/index.tsx +3 -3
- package/Components/Cell/Cell.tsx +30 -13
- package/Components/Cell/CellWithFocusable.tsx +6 -4
- package/Components/Cell/TvOSCellComponent.tsx +3 -7
- package/Components/Focusable/Focusable.tsx +6 -1
- package/Components/FocusableGroup/index.tsx +10 -2
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/Layout/TV/ScreenContainer.tsx +79 -5
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +38 -28
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +25 -13
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +20 -75
- package/Components/Layout/TV/index.tsx +29 -181
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +88 -112
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +20 -0
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
- package/Components/MasterCell/DefaultComponents/__tests__/text.test.tsx +24 -9
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.android.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +10 -2
- package/Components/MasterCell/SharedUI/CollapsibleTextContainer/index.ts +1 -3
- package/Components/MasterCell/dataAdapter.ts +21 -7
- package/Components/MasterCell/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/index.tsx +5 -3
- package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
- package/Components/MasterCell/utils/index.ts +32 -29
- package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
- package/Components/Navigator/StackNavigator.tsx +57 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +3 -0
- package/Components/River/ComponentsMap/ComponentsMap.tsx +24 -17
- package/Components/River/RefreshControl.tsx +55 -1
- package/Components/River/TV/River.tsx +0 -23
- package/Components/RouteManager/index.tsx +2 -2
- package/Components/Screen/TV/hooks/index.ts +3 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +22 -0
- package/Components/Screen/TV/index.web.tsx +59 -45
- package/Components/Screen/__tests__/Screen.test.tsx +3 -0
- package/Components/Screen/index.tsx +55 -58
- package/Components/Screen/navigationHandler.ts +5 -0
- package/Components/ScreenResolver/index.tsx +6 -11
- package/Components/Transitioner/Scene.tsx +32 -26
- package/Components/Transitioner/Transitioner.tsx +38 -43
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +28 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +52 -24
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +26 -24
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +2 -14
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +56 -43
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +42 -32
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +104 -86
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +44 -5
- package/Components/VideoModal/ModalAnimation/utils.ts +7 -4
- package/Components/VideoModal/PlayerDetails.tsx +3 -3
- package/Components/VideoModal/PlayerWrapper.tsx +67 -60
- package/Components/VideoModal/VideoModal.tsx +17 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -0
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +32 -12
- package/Components/VideoModal/hooks/useModalSize.ts +10 -12
- package/Components/VideoModal/utils.ts +5 -2
- package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
- package/Contexts/FocusableGroupContext/FocusableGroupContext.ts +3 -0
- package/Contexts/FocusableGroupContext/FocusableGroupContextProvider.tsx +16 -0
- package/Contexts/FocusableGroupContext/__tests__/FocusableGroupContextProvider.test.tsx +22 -0
- package/Contexts/FocusableGroupContext/__tests__/withFocusableContext.test.tsx +26 -0
- package/Contexts/FocusableGroupContext/index.ts +7 -0
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +17 -0
- package/Contexts/ScreenContext/index.tsx +2 -2
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/events/index.ts +1 -0
- package/package.json +5 -5
- package/Components/Layout/TV/TransitionOverlay.tsx +0 -64
- /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
- /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
|
-
import { Animated, View
|
|
2
|
+
import { Animated, View } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
useSafeAreaInsets,
|
|
6
|
-
useSafeAreaFrame,
|
|
7
|
-
} from "react-native-safe-area-context";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
8
5
|
|
|
9
6
|
import {
|
|
10
7
|
useModalAnimationContext,
|
|
@@ -18,6 +15,7 @@ import {
|
|
|
18
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
19
16
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
20
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
|
+
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
21
19
|
|
|
22
20
|
import {
|
|
23
21
|
gestureListenerHelper,
|
|
@@ -35,10 +33,6 @@ type Props = {
|
|
|
35
33
|
additionalData?: { [key: string]: any };
|
|
36
34
|
};
|
|
37
35
|
|
|
38
|
-
const styles = StyleSheet.create({
|
|
39
|
-
flex: { flex: 1 },
|
|
40
|
-
});
|
|
41
|
-
|
|
42
36
|
export const AnimationView = ({
|
|
43
37
|
animationType,
|
|
44
38
|
style,
|
|
@@ -56,21 +50,22 @@ export const AnimationView = ({
|
|
|
56
50
|
tabletLandscapePlayerTopPosition,
|
|
57
51
|
setTabletLandscapePlayerTopPosition,
|
|
58
52
|
modalSnapPoints,
|
|
53
|
+
startComponentsAnimationDistance,
|
|
54
|
+
progressBarHeight,
|
|
59
55
|
} = useModalAnimationContext();
|
|
60
56
|
|
|
61
57
|
const isRTL = useIsRTL();
|
|
58
|
+
const isAppActive = useAppState(true);
|
|
62
59
|
|
|
63
60
|
const {
|
|
64
|
-
|
|
61
|
+
width: screenWidth,
|
|
65
62
|
deviceInfo: { isTablet, isTabletLandscape },
|
|
66
|
-
} = useDimensions("
|
|
63
|
+
} = useDimensions("window", { deviceInfo: true });
|
|
67
64
|
|
|
68
|
-
const startAnimationDistance = Math.round((screenHeight * 60) / 100);
|
|
69
65
|
const { videoModalState } = useNavigation();
|
|
70
|
-
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
71
|
-
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
72
66
|
const insets = useSafeAreaInsets();
|
|
73
|
-
const
|
|
67
|
+
const bottomTabBarHeight = useGetBottomTabBarHeight() + (insets.bottom || 0);
|
|
68
|
+
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
74
69
|
const animationComponentRef = useRef(null);
|
|
75
70
|
|
|
76
71
|
// retrieving top position of the player for tablet landscape mode
|
|
@@ -88,13 +83,6 @@ export const AnimationView = ({
|
|
|
88
83
|
getAnimationDefaultValue(animationType, bottomTabBarHeight)
|
|
89
84
|
);
|
|
90
85
|
|
|
91
|
-
const animationValueType: string =
|
|
92
|
-
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
93
|
-
|
|
94
|
-
const animatedValue = useRef(
|
|
95
|
-
new Animated[animationValueType](defaultValue)
|
|
96
|
-
).current;
|
|
97
|
-
|
|
98
86
|
const isAudioItem = React.useMemo(
|
|
99
87
|
() =>
|
|
100
88
|
videoModalState.item?.content?.type?.includes?.("audio") ||
|
|
@@ -105,12 +93,12 @@ export const AnimationView = ({
|
|
|
105
93
|
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
106
94
|
|
|
107
95
|
const moveUpValue = additionalData.saveArea
|
|
108
|
-
? -insets.top
|
|
96
|
+
? -insets.top + (isAudioItem ? 0 : progressBarHeight)
|
|
109
97
|
: isTablet
|
|
110
98
|
? isTabletLandscape && (!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
111
|
-
? -tabletLandscapePlayerTopPosition
|
|
99
|
+
? -tabletLandscapePlayerTopPosition + progressBarHeight
|
|
112
100
|
: -130
|
|
113
|
-
: -50;
|
|
101
|
+
: -50 + progressBarHeight;
|
|
114
102
|
|
|
115
103
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
116
104
|
? isRTL
|
|
@@ -118,63 +106,8 @@ export const AnimationView = ({
|
|
|
118
106
|
: -additionalData.moveValue
|
|
119
107
|
: 0;
|
|
120
108
|
|
|
121
|
-
const
|
|
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
|
-
);
|
|
146
|
-
|
|
147
|
-
React.useEffect(() => {
|
|
148
|
-
if (additionalData.resetAnimationValue) {
|
|
149
|
-
animatedValue.setValue(0);
|
|
150
|
-
}
|
|
151
|
-
}, [additionalData.resetAnimationValue]);
|
|
152
|
-
|
|
153
|
-
React.useEffect(() => {
|
|
154
|
-
if (animationType === ComponentAnimationType.player) {
|
|
155
|
-
let width, height;
|
|
156
|
-
|
|
157
|
-
if (additionalData.aspectRatio) {
|
|
158
|
-
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
159
|
-
|
|
160
|
-
height =
|
|
161
|
-
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
162
|
-
additionalData.aspectRatio;
|
|
163
|
-
} else {
|
|
164
|
-
width =
|
|
165
|
-
typeof additionalData.width === "number" && additionalData.width;
|
|
166
|
-
|
|
167
|
-
height =
|
|
168
|
-
typeof additionalData.height === "number" && additionalData.height;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
if (defaultValue.x === 0 && width && height) {
|
|
172
|
-
const value = { x: width, y: height };
|
|
173
|
-
setDefaultValue(value);
|
|
174
|
-
animatedValue.setValue(value);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
}, [additionalData, screenWidth]);
|
|
109
|
+
const animationValueType: string =
|
|
110
|
+
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
178
111
|
|
|
179
112
|
const getAnimationValue = React.useCallback(
|
|
180
113
|
(animationType, state) => {
|
|
@@ -292,6 +225,90 @@ export const AnimationView = ({
|
|
|
292
225
|
]
|
|
293
226
|
);
|
|
294
227
|
|
|
228
|
+
const getInitialValue = React.useCallback(() => {
|
|
229
|
+
const mode =
|
|
230
|
+
videoModalState.mode === "PIP"
|
|
231
|
+
? videoModalState.previousMode
|
|
232
|
+
: videoModalState.mode;
|
|
233
|
+
|
|
234
|
+
switch (mode) {
|
|
235
|
+
case "MINIMIZED":
|
|
236
|
+
return getAnimationValue(
|
|
237
|
+
animationType,
|
|
238
|
+
PlayerAnimationStateEnum.minimize
|
|
239
|
+
).toValue;
|
|
240
|
+
|
|
241
|
+
case "MAXIMIZED":
|
|
242
|
+
default:
|
|
243
|
+
return getAnimationValue(
|
|
244
|
+
animationType,
|
|
245
|
+
PlayerAnimationStateEnum.maximaze
|
|
246
|
+
).toValue;
|
|
247
|
+
}
|
|
248
|
+
}, [defaultValue, videoModalState]);
|
|
249
|
+
|
|
250
|
+
const animatedValue = useRef(
|
|
251
|
+
new Animated[animationValueType](getInitialValue())
|
|
252
|
+
).current;
|
|
253
|
+
|
|
254
|
+
const calculationData = React.useMemo(
|
|
255
|
+
() => ({
|
|
256
|
+
isAudioItem,
|
|
257
|
+
bottomTabBarHeight,
|
|
258
|
+
minimisedHeight,
|
|
259
|
+
minimisedWidth,
|
|
260
|
+
defaultValue,
|
|
261
|
+
moveUpValue,
|
|
262
|
+
moveComponentHorizontalValue,
|
|
263
|
+
isTablet,
|
|
264
|
+
isTabletLandscape,
|
|
265
|
+
isRTL,
|
|
266
|
+
fromMiniPlayer: videoModalState.mode === "MINIMIZED",
|
|
267
|
+
inlineAudioPlayer,
|
|
268
|
+
}),
|
|
269
|
+
[
|
|
270
|
+
bottomTabBarHeight,
|
|
271
|
+
minimisedHeight,
|
|
272
|
+
minimisedWidth,
|
|
273
|
+
defaultValue,
|
|
274
|
+
moveUpValue,
|
|
275
|
+
moveComponentHorizontalValue,
|
|
276
|
+
videoModalState.mode,
|
|
277
|
+
]
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
React.useEffect(() => {
|
|
281
|
+
if (additionalData.resetAnimationValue) {
|
|
282
|
+
animatedValue.setValue(defaultValue);
|
|
283
|
+
}
|
|
284
|
+
}, [additionalData.resetAnimationValue, defaultValue]);
|
|
285
|
+
|
|
286
|
+
React.useEffect(() => {
|
|
287
|
+
if (animationType === ComponentAnimationType.player) {
|
|
288
|
+
let width, height;
|
|
289
|
+
|
|
290
|
+
if (additionalData.aspectRatio) {
|
|
291
|
+
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
292
|
+
|
|
293
|
+
height =
|
|
294
|
+
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
295
|
+
additionalData.aspectRatio;
|
|
296
|
+
} else {
|
|
297
|
+
width =
|
|
298
|
+
typeof additionalData.width === "number" && additionalData.width;
|
|
299
|
+
|
|
300
|
+
height =
|
|
301
|
+
typeof additionalData.height === "number" && additionalData.height;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (defaultValue.x === 0 && width && height) {
|
|
305
|
+
const value = { x: width, y: height };
|
|
306
|
+
setDefaultValue(value);
|
|
307
|
+
animatedValue.setValue(value);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}, [additionalData, screenWidth]);
|
|
311
|
+
|
|
295
312
|
React.useEffect(() => {
|
|
296
313
|
if (
|
|
297
314
|
playerAnimationState === PlayerAnimationStateEnum.minimize &&
|
|
@@ -325,7 +342,7 @@ export const AnimationView = ({
|
|
|
325
342
|
animatedValue,
|
|
326
343
|
calculationData,
|
|
327
344
|
modalSnapPoint: modalSnapPoints[1],
|
|
328
|
-
|
|
345
|
+
startComponentsAnimationDistance,
|
|
329
346
|
startComponentsAnimation,
|
|
330
347
|
setStartComponentsAnimation,
|
|
331
348
|
getAnimationValue,
|
|
@@ -350,7 +367,7 @@ export const AnimationView = ({
|
|
|
350
367
|
animatedValue,
|
|
351
368
|
calculationData,
|
|
352
369
|
modalSnapPoint: modalSnapPoints[1],
|
|
353
|
-
|
|
370
|
+
startComponentsAnimationDistance,
|
|
354
371
|
startComponentsAnimation,
|
|
355
372
|
setStartComponentsAnimation,
|
|
356
373
|
getAnimationValue,
|
|
@@ -372,9 +389,9 @@ export const AnimationView = ({
|
|
|
372
389
|
ref={animationComponentRef}
|
|
373
390
|
style={[
|
|
374
391
|
...preparedStyles,
|
|
375
|
-
additionalData.saveArea ? styles.flex : null,
|
|
376
392
|
(videoModalState.mode === "MAXIMIZED" ||
|
|
377
|
-
videoModalState.mode === "MINIMIZED"
|
|
393
|
+
videoModalState.mode === "MINIMIZED" ||
|
|
394
|
+
(videoModalState.mode === "PIP" && isAppActive)) &&
|
|
378
395
|
getAnimationStyle(animationType, animatedValue),
|
|
379
396
|
]}
|
|
380
397
|
>
|
|
@@ -412,6 +429,7 @@ export const AnimationComponent = (props: Props) => {
|
|
|
412
429
|
delete additionalData.extraAnimation[animationType];
|
|
413
430
|
|
|
414
431
|
return (
|
|
432
|
+
// @ts-ignore
|
|
415
433
|
<Component {...(isReactFragment ? null : props)}>
|
|
416
434
|
<AnimationComponent
|
|
417
435
|
{...animationProps}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
useSafeAreaInsets,
|
|
6
|
+
useSafeAreaFrame,
|
|
7
|
+
} from "react-native-safe-area-context";
|
|
8
|
+
import {
|
|
9
|
+
useGetBottomTabBarHeight,
|
|
10
|
+
useNavigation,
|
|
11
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
|
+
import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
13
|
+
|
|
14
|
+
import { PROGRESS_BAR_HEIGHT } from "./utils";
|
|
7
15
|
import { useConfiguration } from "../utils";
|
|
8
16
|
|
|
9
17
|
export enum PlayerAnimationStateEnum {
|
|
@@ -36,6 +44,8 @@ export type ModalAnimationContextT = {
|
|
|
36
44
|
setLastSnap: (value: number) => void;
|
|
37
45
|
tabletLandscapePlayerTopPosition: number;
|
|
38
46
|
setTabletLandscapePlayerTopPosition: (value: number) => void;
|
|
47
|
+
startComponentsAnimationDistance: number;
|
|
48
|
+
progressBarHeight: number;
|
|
39
49
|
};
|
|
40
50
|
|
|
41
51
|
const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
@@ -59,6 +69,8 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
59
69
|
setLastSnap: () => null,
|
|
60
70
|
tabletLandscapePlayerTopPosition: 0,
|
|
61
71
|
setTabletLandscapePlayerTopPosition: () => null,
|
|
72
|
+
startComponentsAnimationDistance: 0,
|
|
73
|
+
progressBarHeight: 0,
|
|
62
74
|
});
|
|
63
75
|
|
|
64
76
|
export function useModalAnimationContext() {
|
|
@@ -77,6 +89,11 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
77
89
|
const [startComponentsAnimation, setStartComponentsAnimation] =
|
|
78
90
|
React.useState<boolean>(false);
|
|
79
91
|
|
|
92
|
+
const {
|
|
93
|
+
videoModalState: { mode, visible, item },
|
|
94
|
+
} = useNavigation();
|
|
95
|
+
|
|
96
|
+
const isLiveItem = isLive(item);
|
|
80
97
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
81
98
|
|
|
82
99
|
const resetPlayerAnimationState = React.useCallback(() => {
|
|
@@ -90,9 +107,29 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
90
107
|
const translateYOffset = React.useRef(new Animated.Value(0)).current;
|
|
91
108
|
const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
|
|
92
109
|
|
|
93
|
-
const { height } = useSafeAreaFrame();
|
|
110
|
+
const { height: safeAreaFrameHeight } = useSafeAreaFrame();
|
|
111
|
+
const [height, setHeight] = React.useState<number>(safeAreaFrameHeight);
|
|
112
|
+
const progressBarHeight = isLiveItem ? 0 : PROGRESS_BAR_HEIGHT;
|
|
113
|
+
const { bottom: bottomSafeArea } = useSafeAreaInsets();
|
|
94
114
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
95
|
-
const
|
|
115
|
+
const startComponentsAnimationDistance = Math.round((height * 60) / 100);
|
|
116
|
+
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
if (visible && mode === "MAXIMIZED" && height !== safeAreaFrameHeight) {
|
|
119
|
+
setHeight(safeAreaFrameHeight);
|
|
120
|
+
}
|
|
121
|
+
}, [height, safeAreaFrameHeight, mode, visible]);
|
|
122
|
+
|
|
123
|
+
/*
|
|
124
|
+
If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
|
|
125
|
+
Because of this we need to minus bottom SafeArea offset.
|
|
126
|
+
*/
|
|
127
|
+
const minValue =
|
|
128
|
+
height -
|
|
129
|
+
minimisedHeight -
|
|
130
|
+
(bottomTabBarHeight || bottomSafeArea) -
|
|
131
|
+
progressBarHeight;
|
|
132
|
+
|
|
96
133
|
const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
|
|
97
134
|
// Last snap state which will helps us to make smooth responder to scrollview animation
|
|
98
135
|
const [lastSnap, setLastSnap] = React.useState<number>(modalSnapPoints[0]);
|
|
@@ -123,6 +160,8 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
123
160
|
setLastSnap,
|
|
124
161
|
tabletLandscapePlayerTopPosition,
|
|
125
162
|
setTabletLandscapePlayerTopPosition,
|
|
163
|
+
startComponentsAnimationDistance,
|
|
164
|
+
progressBarHeight,
|
|
126
165
|
}}
|
|
127
166
|
>
|
|
128
167
|
{children}
|
|
@@ -13,6 +13,7 @@ export enum ComponentAnimationType {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export const AUDIO_PLAYER_HORIZONTAL_PADDING = 15;
|
|
16
|
+
export const PROGRESS_BAR_HEIGHT = 3;
|
|
16
17
|
|
|
17
18
|
export const defaultAspectRatioWidth = (height: number): number =>
|
|
18
19
|
(height / 9) * 16;
|
|
@@ -233,7 +234,7 @@ export const gestureListenerHelper = (data) => {
|
|
|
233
234
|
animatedValue,
|
|
234
235
|
calculationData,
|
|
235
236
|
modalSnapPoint,
|
|
236
|
-
|
|
237
|
+
startComponentsAnimationDistance,
|
|
237
238
|
startComponentsAnimation,
|
|
238
239
|
setStartComponentsAnimation,
|
|
239
240
|
getAnimationValue,
|
|
@@ -243,7 +244,7 @@ export const gestureListenerHelper = (data) => {
|
|
|
243
244
|
if (listenerValue <= 0) {
|
|
244
245
|
if (
|
|
245
246
|
preparedValue >= 0 &&
|
|
246
|
-
preparedValue <= modalSnapPoint -
|
|
247
|
+
preparedValue <= modalSnapPoint - startComponentsAnimationDistance
|
|
247
248
|
) {
|
|
248
249
|
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
249
250
|
|
|
@@ -263,9 +264,11 @@ export const gestureListenerHelper = (data) => {
|
|
|
263
264
|
animatedValue.setValue(value);
|
|
264
265
|
}
|
|
265
266
|
} else {
|
|
266
|
-
if (preparedValue >=
|
|
267
|
+
if (preparedValue >= startComponentsAnimationDistance) {
|
|
267
268
|
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
268
|
-
const value = Math.round(
|
|
269
|
+
const value = Math.round(
|
|
270
|
+
preparedValue - startComponentsAnimationDistance
|
|
271
|
+
);
|
|
269
272
|
|
|
270
273
|
animatedValue.setValue(
|
|
271
274
|
calculateAnimationValue(animationType, value, calculationData)
|
|
@@ -42,12 +42,12 @@ export const PlayerDetails = ({
|
|
|
42
42
|
: {};
|
|
43
43
|
|
|
44
44
|
// Animation setup
|
|
45
|
-
const translateY = useRef(new Animated.Value(
|
|
45
|
+
const translateY = useRef(new Animated.Value(50)).current;
|
|
46
46
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
47
47
|
|
|
48
48
|
const runAnimation = () => {
|
|
49
49
|
Animated.timing(translateY, {
|
|
50
|
-
toValue:
|
|
50
|
+
toValue: -30,
|
|
51
51
|
duration: 500,
|
|
52
52
|
easing: Easing.inOut(Easing.ease),
|
|
53
53
|
useNativeDriver: true,
|
|
@@ -63,7 +63,7 @@ export const PlayerDetails = ({
|
|
|
63
63
|
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if (isAudioPlayer) {
|
|
66
|
-
setTimeout(() => runAnimation(),
|
|
66
|
+
setTimeout(() => runAnimation(), 1500);
|
|
67
67
|
}
|
|
68
68
|
}, [isAudioPlayer]);
|
|
69
69
|
|
|
@@ -14,12 +14,13 @@ import { PlayerDetails } from "./PlayerDetails";
|
|
|
14
14
|
import { playerDimesionsHack } from "./utils";
|
|
15
15
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
16
16
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
17
|
+
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
|
|
17
18
|
|
|
18
19
|
import {
|
|
19
|
-
AnimationComponent,
|
|
20
|
-
ComponentAnimationType,
|
|
21
20
|
AnimatedScrollModal,
|
|
22
21
|
AnimatedVideoPlayerComponent,
|
|
22
|
+
AnimationComponent,
|
|
23
|
+
ComponentAnimationType,
|
|
23
24
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
24
25
|
|
|
25
26
|
type DimensionsT = {
|
|
@@ -180,65 +181,71 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
180
181
|
[containerDimensions, playerDimesionsHack]
|
|
181
182
|
);
|
|
182
183
|
|
|
184
|
+
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
|
|
185
|
+
|
|
183
186
|
return (
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
<
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
animationType={ComponentAnimationType.moveUpComponent}
|
|
210
|
-
style={isTabletLandscape ? defaultStyles.flex : undefined}
|
|
211
|
-
additionalData={{
|
|
212
|
-
useLayoutMeasure: isTabletLandscape,
|
|
213
|
-
disableAnimatedComponent: !isTabletLandscape,
|
|
214
|
-
resetAnimationValue: isTabletLandscape && docked,
|
|
215
|
-
}}
|
|
216
|
-
>
|
|
217
|
-
<AnimatedVideoPlayerComponent>
|
|
218
|
-
{children(childrenStyles)}
|
|
219
|
-
</AnimatedVideoPlayerComponent>
|
|
220
|
-
</AnimationComponent>
|
|
221
|
-
</View>
|
|
222
|
-
<AnimatedScrollModal>
|
|
223
|
-
{isInlineModal ? (
|
|
224
|
-
<AnimationComponent
|
|
225
|
-
animationType={ComponentAnimationType.componentFade}
|
|
226
|
-
style={defaultStyles.flex}
|
|
187
|
+
<PathnameContext.Provider value={pathname}>
|
|
188
|
+
<ScreenContextProvider pathname={pathname}>
|
|
189
|
+
<WrapperView
|
|
190
|
+
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
191
|
+
style={[
|
|
192
|
+
safeAreaStyles(configuration, isTablet),
|
|
193
|
+
style,
|
|
194
|
+
playerDimesionsHack,
|
|
195
|
+
]}
|
|
196
|
+
>
|
|
197
|
+
<AnimationComponent
|
|
198
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
199
|
+
additionalData={{ saveArea: true }}
|
|
200
|
+
style={[directionStyles(isTabletLandscape), defaultStyles.flex]}
|
|
201
|
+
>
|
|
202
|
+
<PathnameContext.Provider value={pathname}>
|
|
203
|
+
<ScreenContextProvider pathname={pathname}>
|
|
204
|
+
<View
|
|
205
|
+
testID={`${entry?.id}-player-container`}
|
|
206
|
+
style={[
|
|
207
|
+
defaultStyles.playerContainer,
|
|
208
|
+
containerDimensions,
|
|
209
|
+
containerStyle,
|
|
210
|
+
playerDimesionsHack,
|
|
211
|
+
]}
|
|
227
212
|
>
|
|
228
|
-
<
|
|
229
|
-
|
|
230
|
-
style={defaultStyles.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
213
|
+
<AnimationComponent
|
|
214
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
215
|
+
style={isTabletLandscape ? defaultStyles.flex : undefined}
|
|
216
|
+
additionalData={{
|
|
217
|
+
useLayoutMeasure: isTabletLandscape,
|
|
218
|
+
disableAnimatedComponent: !isTabletLandscape,
|
|
219
|
+
resetAnimationValue: isTabletLandscape && docked,
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
<AnimatedVideoPlayerComponent>
|
|
223
|
+
{children(childrenStyles)}
|
|
224
|
+
</AnimatedVideoPlayerComponent>
|
|
225
|
+
</AnimationComponent>
|
|
226
|
+
</View>
|
|
227
|
+
<AnimatedScrollModal>
|
|
228
|
+
{isInlineModal && !docked ? (
|
|
229
|
+
<AnimationComponent
|
|
230
|
+
animationType={ComponentAnimationType.componentFade}
|
|
231
|
+
style={defaultStyles.flex}
|
|
232
|
+
>
|
|
233
|
+
<PlayerDetails
|
|
234
|
+
configuration={configuration}
|
|
235
|
+
style={defaultStyles.playerDetails}
|
|
236
|
+
entry={entry}
|
|
237
|
+
isTabletLandscape={isTabletLandscape}
|
|
238
|
+
/>
|
|
239
|
+
</AnimationComponent>
|
|
240
|
+
) : (
|
|
241
|
+
<View style={defaultStyles.playerDetails} />
|
|
242
|
+
)}
|
|
243
|
+
</AnimatedScrollModal>
|
|
244
|
+
</ScreenContextProvider>
|
|
245
|
+
</PathnameContext.Provider>
|
|
246
|
+
</AnimationComponent>
|
|
247
|
+
</WrapperView>
|
|
248
|
+
</ScreenContextProvider>
|
|
249
|
+
</PathnameContext.Provider>
|
|
243
250
|
);
|
|
244
251
|
};
|
|
@@ -129,17 +129,17 @@ const VideoModalComponent = () => {
|
|
|
129
129
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
|
|
130
130
|
|
|
131
131
|
return (
|
|
132
|
-
<
|
|
133
|
-
style={[
|
|
134
|
-
styles.container,
|
|
135
|
-
{
|
|
136
|
-
backgroundColor,
|
|
137
|
-
},
|
|
138
|
-
]}
|
|
139
|
-
>
|
|
132
|
+
<PathnameContext.Provider value={pathname}>
|
|
140
133
|
<ScreenContextProvider pathname={pathname}>
|
|
141
|
-
|
|
142
|
-
|
|
134
|
+
{itemIdHooksFinished === item?.id ? (
|
|
135
|
+
<AnimatedPlayerModalWrapper
|
|
136
|
+
style={[
|
|
137
|
+
styles.container,
|
|
138
|
+
{
|
|
139
|
+
backgroundColor,
|
|
140
|
+
},
|
|
141
|
+
]}
|
|
142
|
+
>
|
|
143
143
|
<HandlePlayable
|
|
144
144
|
item={item}
|
|
145
145
|
isModal={mode !== "PIP"}
|
|
@@ -147,14 +147,14 @@ const VideoModalComponent = () => {
|
|
|
147
147
|
modalWidth={modalSize.width}
|
|
148
148
|
mode={mode}
|
|
149
149
|
/>
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
150
|
+
</AnimatedPlayerModalWrapper>
|
|
151
|
+
) : (
|
|
152
|
+
<View style={styles.loaderContainer}>
|
|
153
|
+
<Spinner />
|
|
154
|
+
</View>
|
|
155
|
+
)}
|
|
156
156
|
</ScreenContextProvider>
|
|
157
|
-
</
|
|
157
|
+
</PathnameContext.Provider>
|
|
158
158
|
);
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -25,6 +25,13 @@ jest.mock("react-native-gesture-handler");
|
|
|
25
25
|
|
|
26
26
|
jest.mock("../PlayerDetails", () => ({ PlayerDetails: View }));
|
|
27
27
|
|
|
28
|
+
jest.mock(
|
|
29
|
+
"@applicaster/zapp-react-native-utils/reactHooks/screen/useScreenContext",
|
|
30
|
+
() => ({
|
|
31
|
+
useScreenContext: jest.fn().mockReturnValue({ screen: {}, entry: {} }),
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
|
|
28
35
|
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/device", () => ({
|
|
29
36
|
useIsTablet,
|
|
30
37
|
}));
|