@applicaster/zapp-react-native-ui-components 12.0.0-alpha.5208030571 → 12.0.0-alpha.5230293331
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/FreezeWithCallback/Freeze.tsx +31 -0
- package/Components/FreezeWithCallback/LICENSE +21 -0
- package/Components/FreezeWithCallback/Suspender.tsx +17 -0
- package/Components/FreezeWithCallback/__tests__/index.test.tsx +170 -0
- package/Components/FreezeWithCallback/index.tsx +3 -0
- 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 +86 -116
- package/Components/MasterCell/DefaultComponents/DynamicBadge.tsx +4 -2
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +17 -1
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +71 -0
- 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/index.ts +2 -0
- 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/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
- 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 +17 -30
- 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 +14 -3
- package/Components/River/ComponentsMap/ComponentsMap.tsx +24 -17
- package/Components/River/RefreshControl.tsx +55 -1
- package/Components/River/TV/River.tsx +0 -22
- package/Components/RouteManager/index.tsx +2 -2
- package/Components/Screen/TV/hooks/index.ts +1 -0
- package/Components/Screen/TV/hooks/useInitialFocus.ts +70 -0
- package/Components/Screen/TV/index.web.tsx +85 -58
- package/Components/Screen/__tests__/Screen.test.tsx +3 -49
- package/Components/Screen/index.tsx +55 -76
- package/Components/Screen/navigationHandler.ts +6 -3
- package/Components/Screen/orientationHandler.ts +18 -7
- package/Components/Screen/utils.ts +16 -0
- package/Components/ScreenResolver/index.tsx +6 -11
- package/Components/Transitioner/Scene.tsx +39 -26
- package/Components/Transitioner/Transitioner.tsx +56 -48
- package/Components/Transitioner/__tests__/Scene.test.js +7 -0
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +12 -4
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -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 +81 -46
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +47 -33
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +129 -86
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +44 -5
- package/Components/VideoModal/ModalAnimation/utils.ts +7 -4
- package/Components/VideoModal/PlayerDetails.tsx +19 -5
- package/Components/VideoModal/PlayerWrapper.tsx +104 -67
- package/Components/VideoModal/VideoModal.tsx +27 -21
- package/Components/VideoModal/__tests__/PlayerDetails.test.tsx +7 -0
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +7 -0
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -0
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +134 -22
- 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/ZappFrameworkComponents/BarView/BarView.tsx +4 -3
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
- package/Contexts/ConfirmDialogState/index.ts +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/ScreenContext/index.tsx +2 -2
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/const.ts +6 -0
- package/events/index.ts +1 -0
- package/index.js +3 -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,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)
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
Animated,
|
|
6
|
+
Easing,
|
|
7
|
+
Dimensions,
|
|
8
|
+
} from "react-native";
|
|
3
9
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
4
10
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
5
11
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
12
|
|
|
13
|
+
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
14
|
+
|
|
7
15
|
type Configuration = {
|
|
8
16
|
[key: string]: any;
|
|
9
17
|
modal_background_color?: string;
|
|
@@ -15,6 +23,7 @@ type Props = {
|
|
|
15
23
|
configuration: Configuration;
|
|
16
24
|
isTabletLandscape: boolean;
|
|
17
25
|
isAudioPlayer?: boolean;
|
|
26
|
+
isTablet: boolean;
|
|
18
27
|
};
|
|
19
28
|
|
|
20
29
|
const containerStyle = ({
|
|
@@ -31,6 +40,7 @@ export const PlayerDetails = ({
|
|
|
31
40
|
configuration,
|
|
32
41
|
isTabletLandscape,
|
|
33
42
|
isAudioPlayer,
|
|
43
|
+
isTablet,
|
|
34
44
|
}: Props) => {
|
|
35
45
|
const screenData = useTargetScreenData(entry);
|
|
36
46
|
const insets = useSafeAreaInsets();
|
|
@@ -42,12 +52,12 @@ export const PlayerDetails = ({
|
|
|
42
52
|
: {};
|
|
43
53
|
|
|
44
54
|
// Animation setup
|
|
45
|
-
const translateY = useRef(new Animated.Value(
|
|
55
|
+
const translateY = useRef(new Animated.Value(50)).current;
|
|
46
56
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
47
57
|
|
|
48
58
|
const runAnimation = () => {
|
|
49
59
|
Animated.timing(translateY, {
|
|
50
|
-
toValue:
|
|
60
|
+
toValue: -30,
|
|
51
61
|
duration: 500,
|
|
52
62
|
easing: Easing.inOut(Easing.ease),
|
|
53
63
|
useNativeDriver: true,
|
|
@@ -63,7 +73,7 @@ export const PlayerDetails = ({
|
|
|
63
73
|
|
|
64
74
|
useEffect(() => {
|
|
65
75
|
if (isAudioPlayer) {
|
|
66
|
-
setTimeout(() => runAnimation(),
|
|
76
|
+
setTimeout(() => runAnimation(), 1500);
|
|
67
77
|
}
|
|
68
78
|
}, [isAudioPlayer]);
|
|
69
79
|
|
|
@@ -77,7 +87,11 @@ export const PlayerDetails = ({
|
|
|
77
87
|
transform: [{ translateY }],
|
|
78
88
|
opacity,
|
|
79
89
|
},
|
|
80
|
-
|
|
90
|
+
{
|
|
91
|
+
// workaround for avoid wrong text-height after going back to portrait rotation
|
|
92
|
+
// we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
|
|
93
|
+
width: isTablet ? undefined : SCREEN_WIDTH,
|
|
94
|
+
},
|
|
81
95
|
]}
|
|
82
96
|
>
|
|
83
97
|
{screenData && (
|
|
@@ -7,21 +7,23 @@ import {
|
|
|
7
7
|
ViewStyle,
|
|
8
8
|
} from "react-native";
|
|
9
9
|
import { Edge, SafeAreaView } from "react-native-safe-area-context";
|
|
10
|
-
|
|
11
10
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
12
11
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
13
12
|
import { PlayerDetails } from "./PlayerDetails";
|
|
14
13
|
import { playerDimesionsHack } from "./utils";
|
|
15
14
|
import { PathnameContext } from "../../Contexts/PathnameContext";
|
|
16
15
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
16
|
+
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
|
-
AnimationComponent,
|
|
20
|
-
ComponentAnimationType,
|
|
21
19
|
AnimatedScrollModal,
|
|
22
20
|
AnimatedVideoPlayerComponent,
|
|
21
|
+
AnimationComponent,
|
|
22
|
+
ComponentAnimationType,
|
|
23
23
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
24
24
|
|
|
25
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
26
|
+
|
|
25
27
|
type DimensionsT = {
|
|
26
28
|
width: number | string;
|
|
27
29
|
height: number | string | undefined;
|
|
@@ -68,10 +70,8 @@ const directionStyles = (isTabletLandscape: boolean): ViewStyle => {
|
|
|
68
70
|
};
|
|
69
71
|
|
|
70
72
|
const getScreenAspectRatio = () => {
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const longEdge = Math.max(width, height);
|
|
74
|
-
const shortEdge = Math.min(width, height);
|
|
73
|
+
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
74
|
+
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
75
75
|
|
|
76
76
|
return longEdge / shortEdge;
|
|
77
77
|
};
|
|
@@ -124,10 +124,37 @@ const getTabletWidth = (
|
|
|
124
124
|
return Number(width) - sidebarWidth;
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
const getStyles = (baseStyle, isMobile, isPortrait) => {
|
|
128
|
+
if (isMobile && isPortrait) {
|
|
129
|
+
return { width: SCREEN_WIDTH, height: SCREEN_HEIGHT };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (isMobile && !isPortrait) {
|
|
133
|
+
return { width: SCREEN_HEIGHT, height: SCREEN_WIDTH };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return baseStyle;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const showDetails = (isMobile: boolean, docked: boolean): boolean => {
|
|
140
|
+
// for mobile we always show details. Mounting of it very heavy operation.
|
|
141
|
+
if (isMobile) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
|
|
146
|
+
// FIXME - find out the reason of dissapearing of content
|
|
147
|
+
if (docked) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return true;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const PlayerWrapperComponent = (props: Props) => {
|
|
128
155
|
const {
|
|
129
156
|
entry,
|
|
130
|
-
style,
|
|
157
|
+
style: baseStyle,
|
|
131
158
|
containerStyle,
|
|
132
159
|
inline,
|
|
133
160
|
docked,
|
|
@@ -142,6 +169,8 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
142
169
|
|
|
143
170
|
const isInlineModal = inline && isModal;
|
|
144
171
|
|
|
172
|
+
const style = getStyles(baseStyle, !isTablet, isInlineModal);
|
|
173
|
+
|
|
145
174
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
146
175
|
|
|
147
176
|
const tabletWidth = getTabletWidth(configuration, style);
|
|
@@ -180,65 +209,73 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
180
209
|
[containerDimensions, playerDimesionsHack]
|
|
181
210
|
);
|
|
182
211
|
|
|
212
|
+
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
|
|
213
|
+
|
|
183
214
|
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}
|
|
215
|
+
<PathnameContext.Provider value={pathname}>
|
|
216
|
+
<ScreenContextProvider pathname={pathname}>
|
|
217
|
+
<WrapperView
|
|
218
|
+
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
219
|
+
style={[
|
|
220
|
+
safeAreaStyles(configuration, isTablet),
|
|
221
|
+
style,
|
|
222
|
+
playerDimesionsHack,
|
|
223
|
+
]}
|
|
224
|
+
>
|
|
225
|
+
<AnimationComponent
|
|
226
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
227
|
+
additionalData={{ saveArea: true }}
|
|
228
|
+
style={[directionStyles(isTabletLandscape), defaultStyles.flex]}
|
|
229
|
+
>
|
|
230
|
+
<PathnameContext.Provider value={pathname}>
|
|
231
|
+
<ScreenContextProvider pathname={pathname}>
|
|
232
|
+
<View
|
|
233
|
+
testID={`${entry?.id}-player-container`}
|
|
234
|
+
style={[
|
|
235
|
+
defaultStyles.playerContainer,
|
|
236
|
+
containerDimensions,
|
|
237
|
+
containerStyle,
|
|
238
|
+
playerDimesionsHack,
|
|
239
|
+
]}
|
|
227
240
|
>
|
|
228
|
-
<
|
|
229
|
-
|
|
230
|
-
style={defaultStyles.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
<AnimationComponent
|
|
242
|
+
animationType={ComponentAnimationType.moveUpComponent}
|
|
243
|
+
style={isTabletLandscape ? defaultStyles.flex : undefined}
|
|
244
|
+
additionalData={{
|
|
245
|
+
useLayoutMeasure: isTabletLandscape,
|
|
246
|
+
disableAnimatedComponent: !isTabletLandscape,
|
|
247
|
+
resetAnimationValue: isTabletLandscape && docked,
|
|
248
|
+
}}
|
|
249
|
+
>
|
|
250
|
+
<AnimatedVideoPlayerComponent>
|
|
251
|
+
{children(childrenStyles)}
|
|
252
|
+
</AnimatedVideoPlayerComponent>
|
|
253
|
+
</AnimationComponent>
|
|
254
|
+
</View>
|
|
255
|
+
|
|
256
|
+
<AnimatedScrollModal>
|
|
257
|
+
{showDetails(!isTablet, docked) && (
|
|
258
|
+
<AnimationComponent
|
|
259
|
+
animationType={ComponentAnimationType.componentFade}
|
|
260
|
+
style={defaultStyles.flex}
|
|
261
|
+
>
|
|
262
|
+
<PlayerDetails
|
|
263
|
+
configuration={configuration}
|
|
264
|
+
style={defaultStyles.playerDetails}
|
|
265
|
+
entry={entry}
|
|
266
|
+
isTabletLandscape={isTabletLandscape}
|
|
267
|
+
isTablet={isTablet}
|
|
268
|
+
/>
|
|
269
|
+
</AnimationComponent>
|
|
270
|
+
)}
|
|
271
|
+
</AnimatedScrollModal>
|
|
272
|
+
</ScreenContextProvider>
|
|
273
|
+
</PathnameContext.Provider>
|
|
274
|
+
</AnimationComponent>
|
|
275
|
+
</WrapperView>
|
|
276
|
+
</ScreenContextProvider>
|
|
277
|
+
</PathnameContext.Provider>
|
|
243
278
|
);
|
|
244
279
|
};
|
|
280
|
+
|
|
281
|
+
export const PlayerWrapper = PlayerWrapperComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import * as R from "ramda";
|
|
3
|
-
import { StyleSheet, View } from "react-native";
|
|
3
|
+
import { StyleSheet, View, StatusBar } from "react-native";
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
@@ -129,32 +129,38 @@ const VideoModalComponent = () => {
|
|
|
129
129
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${item?.id}`;
|
|
130
130
|
|
|
131
131
|
return (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
>
|
|
140
|
-
<ScreenContextProvider pathname={pathname}>
|
|
141
|
-
<PathnameContext.Provider value={pathname}>
|
|
132
|
+
<>
|
|
133
|
+
{/* TODO: Workaround to avoid unnecessary UI effect when switching from portrait to fullscreen */}
|
|
134
|
+
<StatusBar hidden={false} />
|
|
135
|
+
{/* TODO: Workaround to avoid unnecessary UI effect when switching from portrait to fullscreen */}
|
|
136
|
+
|
|
137
|
+
<PathnameContext.Provider value={pathname}>
|
|
138
|
+
<ScreenContextProvider pathname={pathname}>
|
|
142
139
|
{itemIdHooksFinished === item?.id ? (
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
140
|
+
<AnimatedPlayerModalWrapper
|
|
141
|
+
style={[
|
|
142
|
+
styles.container,
|
|
143
|
+
{
|
|
144
|
+
backgroundColor,
|
|
145
|
+
},
|
|
146
|
+
]}
|
|
147
|
+
>
|
|
148
|
+
<HandlePlayable
|
|
149
|
+
item={item}
|
|
150
|
+
isModal={mode !== "PIP"}
|
|
151
|
+
modalHeight={modalSize.height}
|
|
152
|
+
modalWidth={modalSize.width}
|
|
153
|
+
mode={mode}
|
|
154
|
+
/>
|
|
155
|
+
</AnimatedPlayerModalWrapper>
|
|
150
156
|
) : (
|
|
151
157
|
<View style={styles.loaderContainer}>
|
|
152
158
|
<Spinner />
|
|
153
159
|
</View>
|
|
154
160
|
)}
|
|
155
|
-
</
|
|
156
|
-
</
|
|
157
|
-
|
|
161
|
+
</ScreenContextProvider>
|
|
162
|
+
</PathnameContext.Provider>
|
|
163
|
+
</>
|
|
158
164
|
);
|
|
159
165
|
};
|
|
160
166
|
|
|
@@ -8,6 +8,13 @@ const props = {
|
|
|
8
8
|
configuration: { modal_background_color: "transparent" },
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
jest.mock("@applicaster/zapp-react-native-utils/reactHooks/layout", () => ({
|
|
12
|
+
useDimensions: jest.fn(() => ({
|
|
13
|
+
width: 20,
|
|
14
|
+
height: 30,
|
|
15
|
+
})),
|
|
16
|
+
}));
|
|
17
|
+
|
|
11
18
|
jest.mock("react-native-safe-area-context", () => ({
|
|
12
19
|
useSafeAreaInsets: jest.fn(() => ({
|
|
13
20
|
top: 20,
|
|
@@ -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
|
}));
|
|
@@ -9,6 +9,7 @@ exports[`PlayerDetails renders properly 1`] = `
|
|
|
9
9
|
"flex": 1,
|
|
10
10
|
"marginTop": -8,
|
|
11
11
|
"paddingTop": -8,
|
|
12
|
+
"width": 750,
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
>
|
|
@@ -29,6 +30,7 @@ exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] =
|
|
|
29
30
|
"flex": 1,
|
|
30
31
|
"marginTop": -20,
|
|
31
32
|
"paddingTop": 40,
|
|
33
|
+
"width": 750,
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
36
|
>
|