@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7431051513 → 12.0.0-alpha.7528906949
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 +5 -5
- package/Components/Cell/CellWithFocusable.tsx +23 -9
- package/Components/Cell/TvOSCellComponent.tsx +3 -7
- package/Components/Focusable/Focusable.tsx +6 -1
- package/Components/FocusableGroup/index.tsx +11 -2
- package/Components/GeneralContentScreen/utils/__tests__/useCurationAPI.test.js +13 -6
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +1 -1
- package/Components/HandlePlayable/HandlePlayable.tsx +3 -0
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +2 -2
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +10 -50
- package/Components/Layout/TV/__tests__/index.test.tsx +19 -75
- package/Components/Layout/TV/index.tsx +12 -11
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +51 -16
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +5 -3
- package/Components/MasterCell/DefaultComponents/ImageContainer/index.tsx +5 -1
- package/Components/MasterCell/DefaultComponents/Text/index.tsx +14 -2
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- 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/hooks/useAsyncRendering/index.ts +1 -1
- package/Components/MasterCell/utils/__tests__/insertBetween.test.js +9 -0
- package/Components/MasterCell/utils/index.ts +17 -30
- package/Components/MeasurmentsPortal/BasicMeasurementsPortal.tsx +11 -7
- package/Components/MeasurmentsPortal/MeasurementsPortal.tsx +10 -1
- package/Components/Navigator/StackNavigator.tsx +54 -0
- package/Components/Navigator/index.ts +1 -0
- package/Components/PlayerContainer/PlayerContainer.tsx +17 -6
- package/Components/River/ComponentsMap/ComponentsMap.tsx +92 -22
- 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 +186 -0
- package/Components/Screen/__tests__/Screen.test.tsx +3 -0
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +4 -0
- package/Components/Screen/index.tsx +64 -25
- package/Components/ScreenResolver/index.tsx +3 -1
- package/Components/Transitioner/Scene.tsx +24 -19
- package/Components/Transitioner/Transitioner.tsx +21 -28
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +6 -2
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +28 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +0 -5
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +59 -42
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +46 -32
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +98 -81
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +23 -4
- package/Components/VideoModal/ModalAnimation/utils.ts +6 -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/utils.ts +5 -2
- package/Components/Viewport/ViewportTracker/ViewportTracker.tsx +31 -40
- package/Components/Viewport/ViewportTracker/index.tsx +1 -0
- package/Components/Viewport/utils.js +1 -1
- 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/MenuToggleContext/{index.js → index.ts} +16 -0
- package/Contexts/ScreenContext/__tests__/__snapshots__/index.test.tsx.snap +3 -0
- package/Contexts/ScreenContext/__tests__/index.test.tsx +27 -0
- package/Contexts/ScreenContext/index.tsx +94 -25
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/Contexts/ZappPipesContext/ZappPipesEntryContext.ts +1 -1
- 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
- /package/Contexts/{index.js → index.ts} +0 -0
|
@@ -3,6 +3,8 @@ import { Animated, StyleSheet } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import { PanGestureHandler, State } from "react-native-gesture-handler";
|
|
6
|
+
|
|
7
|
+
import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
|
|
6
8
|
import {
|
|
7
9
|
useModalAnimationContext,
|
|
8
10
|
PlayerAnimationStateEnum,
|
|
@@ -35,58 +37,70 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
35
37
|
} = useModalAnimationContext();
|
|
36
38
|
|
|
37
39
|
const { videoModalState } = useNavigation();
|
|
40
|
+
const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
|
|
41
|
+
|
|
38
42
|
const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
|
|
39
43
|
const isMinimizedModal = videoModalState.mode === "MINIMIZED";
|
|
40
44
|
|
|
45
|
+
const isEnablePanGesture =
|
|
46
|
+
!isLanguageOverlayVisible && (isMaximazedModal || isMinimizedModal);
|
|
47
|
+
|
|
41
48
|
const onGestureEvent = Animated.event(
|
|
42
49
|
[{ nativeEvent: { translationY: dragVideoPlayerY } }],
|
|
43
50
|
{ useNativeDriver: true }
|
|
44
51
|
);
|
|
45
52
|
|
|
46
|
-
const onHandlerStateChange = (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
const onHandlerStateChange = React.useCallback(
|
|
54
|
+
({ nativeEvent }) => {
|
|
55
|
+
if (nativeEvent.oldState === State.ACTIVE) {
|
|
56
|
+
// eslint-disable-next-line prefer-const
|
|
57
|
+
const { velocityY, translationY } = nativeEvent;
|
|
58
|
+
const preparedTranslationY = Math.abs(translationY);
|
|
59
|
+
const dragToss = 0.05;
|
|
52
60
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
if (videoModalState.mode === "MAXIMIZED") {
|
|
62
|
+
if (translationY > 0) {
|
|
63
|
+
const endOffsetY =
|
|
64
|
+
lastSnap + preparedTranslationY + dragToss * velocityY + 200;
|
|
57
65
|
|
|
58
|
-
|
|
66
|
+
let destSnapPoint = modalSnapPoints[0];
|
|
67
|
+
|
|
68
|
+
for (const snapPoint of modalSnapPoints) {
|
|
69
|
+
const distFromSnap = Math.abs(snapPoint - endOffsetY);
|
|
70
|
+
|
|
71
|
+
if (distFromSnap < Math.abs(destSnapPoint - endOffsetY)) {
|
|
72
|
+
destSnapPoint = snapPoint;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
59
75
|
|
|
60
|
-
|
|
61
|
-
const distFromSnap = Math.abs(snapPoint - endOffsetY);
|
|
76
|
+
setLastSnap(destSnapPoint);
|
|
62
77
|
|
|
63
|
-
if (
|
|
64
|
-
|
|
78
|
+
if (destSnapPoint === modalSnapPoints[0]) {
|
|
79
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
80
|
+
} else {
|
|
81
|
+
lastScrollY.setValue(0);
|
|
82
|
+
lastScrollYValue.current = 0;
|
|
83
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
65
84
|
}
|
|
66
85
|
}
|
|
86
|
+
} else if (videoModalState.mode === "MINIMIZED") {
|
|
87
|
+
if (translationY < 0) {
|
|
88
|
+
// from mini to full
|
|
89
|
+
setLastSnap(modalSnapPoints[0]);
|
|
67
90
|
|
|
68
|
-
|
|
91
|
+
translateYOffset.setValue(
|
|
92
|
+
modalSnapPoints[1] - preparedTranslationY
|
|
93
|
+
);
|
|
69
94
|
|
|
70
|
-
if (destSnapPoint === modalSnapPoints[0]) {
|
|
71
95
|
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
72
96
|
} else {
|
|
73
|
-
|
|
74
|
-
lastScrollYValue.current = 0;
|
|
75
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
97
|
+
resetPlayerAnimationState();
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
|
-
} else if (videoModalState.mode === "MINIMIZED") {
|
|
79
|
-
if (translationY < 0) {
|
|
80
|
-
// from mini to full
|
|
81
|
-
setLastSnap(modalSnapPoints[0]);
|
|
82
|
-
translateYOffset.setValue(modalSnapPoints[1] - preparedTranslationY);
|
|
83
|
-
setPlayerAnimationState(PlayerAnimationStateEnum.maximaze);
|
|
84
|
-
} else {
|
|
85
|
-
resetPlayerAnimationState();
|
|
86
|
-
}
|
|
87
100
|
}
|
|
88
|
-
}
|
|
89
|
-
|
|
101
|
+
},
|
|
102
|
+
[lastSnap, modalSnapPoints, videoModalState.mode]
|
|
103
|
+
);
|
|
90
104
|
|
|
91
105
|
React.useEffect(() => {
|
|
92
106
|
const dragVideoPlayerYListenerId = dragVideoPlayerY.addListener(
|
|
@@ -127,7 +141,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
127
141
|
|
|
128
142
|
return (
|
|
129
143
|
<PanGestureHandler
|
|
130
|
-
enabled={
|
|
144
|
+
enabled={isEnablePanGesture}
|
|
131
145
|
shouldCancelWhenOutside={isMaximazedModal}
|
|
132
146
|
onGestureEvent={onGestureEvent}
|
|
133
147
|
onHandlerStateChange={onHandlerStateChange}
|
|
@@ -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,21 @@ export const AnimationView = ({
|
|
|
56
50
|
tabletLandscapePlayerTopPosition,
|
|
57
51
|
setTabletLandscapePlayerTopPosition,
|
|
58
52
|
modalSnapPoints,
|
|
53
|
+
startComponentsAnimationDistance,
|
|
59
54
|
} = useModalAnimationContext();
|
|
60
55
|
|
|
61
56
|
const isRTL = useIsRTL();
|
|
57
|
+
const isAppActive = useAppState(true);
|
|
62
58
|
|
|
63
59
|
const {
|
|
64
|
-
|
|
60
|
+
width: screenWidth,
|
|
65
61
|
deviceInfo: { isTablet, isTabletLandscape },
|
|
66
|
-
} = useDimensions("
|
|
62
|
+
} = useDimensions("window", { deviceInfo: true });
|
|
67
63
|
|
|
68
|
-
const startAnimationDistance = Math.round((screenHeight * 60) / 100);
|
|
69
64
|
const { videoModalState } = useNavigation();
|
|
70
65
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
71
66
|
const minimisedWidth = defaultAspectRatioWidth(minimisedHeight);
|
|
72
67
|
const insets = useSafeAreaInsets();
|
|
73
|
-
const { width: screenWidth } = useSafeAreaFrame();
|
|
74
68
|
const animationComponentRef = useRef(null);
|
|
75
69
|
|
|
76
70
|
// retrieving top position of the player for tablet landscape mode
|
|
@@ -88,13 +82,6 @@ export const AnimationView = ({
|
|
|
88
82
|
getAnimationDefaultValue(animationType, bottomTabBarHeight)
|
|
89
83
|
);
|
|
90
84
|
|
|
91
|
-
const animationValueType: string =
|
|
92
|
-
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
93
|
-
|
|
94
|
-
const animatedValue = useRef(
|
|
95
|
-
new Animated[animationValueType](defaultValue)
|
|
96
|
-
).current;
|
|
97
|
-
|
|
98
85
|
const isAudioItem = React.useMemo(
|
|
99
86
|
() =>
|
|
100
87
|
videoModalState.item?.content?.type?.includes?.("audio") ||
|
|
@@ -118,63 +105,8 @@ export const AnimationView = ({
|
|
|
118
105
|
: -additionalData.moveValue
|
|
119
106
|
: 0;
|
|
120
107
|
|
|
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]);
|
|
108
|
+
const animationValueType: string =
|
|
109
|
+
animationType === ComponentAnimationType.player ? "ValueXY" : "Value";
|
|
178
110
|
|
|
179
111
|
const getAnimationValue = React.useCallback(
|
|
180
112
|
(animationType, state) => {
|
|
@@ -292,6 +224,90 @@ export const AnimationView = ({
|
|
|
292
224
|
]
|
|
293
225
|
);
|
|
294
226
|
|
|
227
|
+
const getInitialValue = React.useCallback(() => {
|
|
228
|
+
const mode =
|
|
229
|
+
videoModalState.mode === "PIP"
|
|
230
|
+
? videoModalState.previousMode
|
|
231
|
+
: videoModalState.mode;
|
|
232
|
+
|
|
233
|
+
switch (mode) {
|
|
234
|
+
case "MINIMIZED":
|
|
235
|
+
return getAnimationValue(
|
|
236
|
+
animationType,
|
|
237
|
+
PlayerAnimationStateEnum.minimize
|
|
238
|
+
).toValue;
|
|
239
|
+
|
|
240
|
+
case "MAXIMIZED":
|
|
241
|
+
default:
|
|
242
|
+
return getAnimationValue(
|
|
243
|
+
animationType,
|
|
244
|
+
PlayerAnimationStateEnum.maximaze
|
|
245
|
+
).toValue;
|
|
246
|
+
}
|
|
247
|
+
}, [defaultValue, videoModalState]);
|
|
248
|
+
|
|
249
|
+
const animatedValue = useRef(
|
|
250
|
+
new Animated[animationValueType](getInitialValue())
|
|
251
|
+
).current;
|
|
252
|
+
|
|
253
|
+
const calculationData = React.useMemo(
|
|
254
|
+
() => ({
|
|
255
|
+
isAudioItem,
|
|
256
|
+
bottomTabBarHeight,
|
|
257
|
+
minimisedHeight,
|
|
258
|
+
minimisedWidth,
|
|
259
|
+
defaultValue,
|
|
260
|
+
moveUpValue,
|
|
261
|
+
moveComponentHorizontalValue,
|
|
262
|
+
isTablet,
|
|
263
|
+
isTabletLandscape,
|
|
264
|
+
isRTL,
|
|
265
|
+
fromMiniPlayer: videoModalState.mode === "MINIMIZED",
|
|
266
|
+
inlineAudioPlayer,
|
|
267
|
+
}),
|
|
268
|
+
[
|
|
269
|
+
bottomTabBarHeight,
|
|
270
|
+
minimisedHeight,
|
|
271
|
+
minimisedWidth,
|
|
272
|
+
defaultValue,
|
|
273
|
+
moveUpValue,
|
|
274
|
+
moveComponentHorizontalValue,
|
|
275
|
+
videoModalState.mode,
|
|
276
|
+
]
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
React.useEffect(() => {
|
|
280
|
+
if (additionalData.resetAnimationValue) {
|
|
281
|
+
animatedValue.setValue(defaultValue);
|
|
282
|
+
}
|
|
283
|
+
}, [additionalData.resetAnimationValue, defaultValue]);
|
|
284
|
+
|
|
285
|
+
React.useEffect(() => {
|
|
286
|
+
if (animationType === ComponentAnimationType.player) {
|
|
287
|
+
let width, height;
|
|
288
|
+
|
|
289
|
+
if (additionalData.aspectRatio) {
|
|
290
|
+
width = isTabletLandscape ? additionalData.width : screenWidth;
|
|
291
|
+
|
|
292
|
+
height =
|
|
293
|
+
(isTabletLandscape ? additionalData.width : screenWidth) /
|
|
294
|
+
additionalData.aspectRatio;
|
|
295
|
+
} else {
|
|
296
|
+
width =
|
|
297
|
+
typeof additionalData.width === "number" && additionalData.width;
|
|
298
|
+
|
|
299
|
+
height =
|
|
300
|
+
typeof additionalData.height === "number" && additionalData.height;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if (defaultValue.x === 0 && width && height) {
|
|
304
|
+
const value = { x: width, y: height };
|
|
305
|
+
setDefaultValue(value);
|
|
306
|
+
animatedValue.setValue(value);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}, [additionalData, screenWidth]);
|
|
310
|
+
|
|
295
311
|
React.useEffect(() => {
|
|
296
312
|
if (
|
|
297
313
|
playerAnimationState === PlayerAnimationStateEnum.minimize &&
|
|
@@ -325,7 +341,7 @@ export const AnimationView = ({
|
|
|
325
341
|
animatedValue,
|
|
326
342
|
calculationData,
|
|
327
343
|
modalSnapPoint: modalSnapPoints[1],
|
|
328
|
-
|
|
344
|
+
startComponentsAnimationDistance,
|
|
329
345
|
startComponentsAnimation,
|
|
330
346
|
setStartComponentsAnimation,
|
|
331
347
|
getAnimationValue,
|
|
@@ -350,7 +366,7 @@ export const AnimationView = ({
|
|
|
350
366
|
animatedValue,
|
|
351
367
|
calculationData,
|
|
352
368
|
modalSnapPoint: modalSnapPoints[1],
|
|
353
|
-
|
|
369
|
+
startComponentsAnimationDistance,
|
|
354
370
|
startComponentsAnimation,
|
|
355
371
|
setStartComponentsAnimation,
|
|
356
372
|
getAnimationValue,
|
|
@@ -372,9 +388,9 @@ export const AnimationView = ({
|
|
|
372
388
|
ref={animationComponentRef}
|
|
373
389
|
style={[
|
|
374
390
|
...preparedStyles,
|
|
375
|
-
additionalData.saveArea ? styles.flex : null,
|
|
376
391
|
(videoModalState.mode === "MAXIMIZED" ||
|
|
377
|
-
videoModalState.mode === "MINIMIZED"
|
|
392
|
+
videoModalState.mode === "MINIMIZED" ||
|
|
393
|
+
(videoModalState.mode === "PIP" && isAppActive)) &&
|
|
378
394
|
getAnimationStyle(animationType, animatedValue),
|
|
379
395
|
]}
|
|
380
396
|
>
|
|
@@ -412,6 +428,7 @@ export const AnimationComponent = (props: Props) => {
|
|
|
412
428
|
delete additionalData.extraAnimation[animationType];
|
|
413
429
|
|
|
414
430
|
return (
|
|
431
|
+
// @ts-ignore
|
|
415
432
|
<Component {...(isReactFragment ? null : props)}>
|
|
416
433
|
<AnimationComponent
|
|
417
434
|
{...animationProps}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React, { useContext } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
|
+
import {
|
|
6
|
+
useGetBottomTabBarHeight,
|
|
7
|
+
useDimensions,
|
|
8
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
6
9
|
|
|
7
10
|
import { useConfiguration } from "../utils";
|
|
8
11
|
|
|
@@ -36,6 +39,7 @@ export type ModalAnimationContextT = {
|
|
|
36
39
|
setLastSnap: (value: number) => void;
|
|
37
40
|
tabletLandscapePlayerTopPosition: number;
|
|
38
41
|
setTabletLandscapePlayerTopPosition: (value: number) => void;
|
|
42
|
+
startComponentsAnimationDistance: number;
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
@@ -59,6 +63,7 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
59
63
|
setLastSnap: () => null,
|
|
60
64
|
tabletLandscapePlayerTopPosition: 0,
|
|
61
65
|
setTabletLandscapePlayerTopPosition: () => null,
|
|
66
|
+
startComponentsAnimationDistance: 0,
|
|
62
67
|
});
|
|
63
68
|
|
|
64
69
|
export function useModalAnimationContext() {
|
|
@@ -90,9 +95,22 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
90
95
|
const translateYOffset = React.useRef(new Animated.Value(0)).current;
|
|
91
96
|
const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
|
|
92
97
|
|
|
93
|
-
const { height } =
|
|
98
|
+
const { height } = useDimensions("window", { fullDimensions: true });
|
|
99
|
+
const { bottom: bottomSafeArea } = useSafeAreaInsets();
|
|
94
100
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
95
|
-
|
|
101
|
+
|
|
102
|
+
const startComponentsAnimationDistance = React.useMemo(
|
|
103
|
+
() => Math.round((height * 60) / 100),
|
|
104
|
+
[height]
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
/*
|
|
108
|
+
If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
|
|
109
|
+
Because of this we need to minus bottom SafeArea offset.
|
|
110
|
+
*/
|
|
111
|
+
const minValue =
|
|
112
|
+
height - minimisedHeight - (bottomTabBarHeight || bottomSafeArea);
|
|
113
|
+
|
|
96
114
|
const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
|
|
97
115
|
// Last snap state which will helps us to make smooth responder to scrollview animation
|
|
98
116
|
const [lastSnap, setLastSnap] = React.useState<number>(modalSnapPoints[0]);
|
|
@@ -123,6 +141,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
123
141
|
setLastSnap,
|
|
124
142
|
tabletLandscapePlayerTopPosition,
|
|
125
143
|
setTabletLandscapePlayerTopPosition,
|
|
144
|
+
startComponentsAnimationDistance,
|
|
126
145
|
}}
|
|
127
146
|
>
|
|
128
147
|
{children}
|
|
@@ -233,7 +233,7 @@ export const gestureListenerHelper = (data) => {
|
|
|
233
233
|
animatedValue,
|
|
234
234
|
calculationData,
|
|
235
235
|
modalSnapPoint,
|
|
236
|
-
|
|
236
|
+
startComponentsAnimationDistance,
|
|
237
237
|
startComponentsAnimation,
|
|
238
238
|
setStartComponentsAnimation,
|
|
239
239
|
getAnimationValue,
|
|
@@ -243,7 +243,7 @@ export const gestureListenerHelper = (data) => {
|
|
|
243
243
|
if (listenerValue <= 0) {
|
|
244
244
|
if (
|
|
245
245
|
preparedValue >= 0 &&
|
|
246
|
-
preparedValue <= modalSnapPoint -
|
|
246
|
+
preparedValue <= modalSnapPoint - startComponentsAnimationDistance
|
|
247
247
|
) {
|
|
248
248
|
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
249
249
|
|
|
@@ -263,9 +263,11 @@ export const gestureListenerHelper = (data) => {
|
|
|
263
263
|
animatedValue.setValue(value);
|
|
264
264
|
}
|
|
265
265
|
} else {
|
|
266
|
-
if (preparedValue >=
|
|
266
|
+
if (preparedValue >= startComponentsAnimationDistance) {
|
|
267
267
|
!startComponentsAnimation && setStartComponentsAnimation(true);
|
|
268
|
-
const value = Math.round(
|
|
268
|
+
const value = Math.round(
|
|
269
|
+
preparedValue - startComponentsAnimationDistance
|
|
270
|
+
);
|
|
269
271
|
|
|
270
272
|
animatedValue.setValue(
|
|
271
273
|
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 ? (
|
|
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
|
};
|