@applicaster/zapp-react-native-ui-components 12.0.0-alpha.4201443043 → 12.0.0-alpha.4223432180
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 +2 -2
- package/Components/Cell/Cell.tsx +34 -6
- package/Components/Cell/CellWithFocusable.tsx +6 -4
- package/Components/Cell/TvOSCellComponent.tsx +3 -7
- package/Components/Focusable/Focusable.tsx +6 -1
- package/Components/Focusable/__tests__/index.android.test.tsx +72 -0
- package/Components/Focusable/index.android.tsx +15 -9
- package/Components/FocusableGroup/index.tsx +10 -2
- package/Components/FocusableList/FocusableChild.ts +2 -4
- package/Components/FocusableList/index.tsx +11 -12
- package/Components/FocusableScrollView/index.tsx +1 -1
- 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__/index.test.tsx +3 -2
- package/Components/Layout/TV/index.tsx +52 -9
- package/Components/Layout/TV/index.web.tsx +33 -0
- package/Components/Layout/index.tsx +15 -11
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -1
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +86 -116
- package/Components/MasterCell/DefaultComponents/FocusableView/index.tsx +16 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +6 -5
- package/Components/MasterCell/DefaultComponents/Image/Image.web.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/index.ts +71 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +20 -0
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/DefaultComponents/index.ts +2 -0
- package/Components/MasterCell/DefaultComponents/tv/ButtonContainerView/index.tsx +6 -1
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +7 -1
- package/Components/MasterCell/dataAdapter.ts +21 -7
- 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/Navigator/StackNavigator.tsx +14 -5
- package/Components/PlayerContainer/PlayerContainer.tsx +16 -8
- package/Components/Screen/TV/hooks/index.ts +0 -2
- package/Components/Screen/TV/index.web.tsx +40 -41
- 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 +20 -12
- package/Components/Transitioner/Transitioner.tsx +52 -51
- package/Components/Transitioner/__tests__/Scene.test.js +7 -0
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +8 -4
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +1 -0
- package/Components/VideoLive/LiveImageManager.ts +10 -0
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +52 -24
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +31 -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 +32 -4
- package/Components/VideoModal/ModalAnimation/utils.ts +7 -4
- package/Components/VideoModal/PlayerDetails.tsx +19 -5
- package/Components/VideoModal/PlayerWrapper.tsx +49 -19
- package/Components/VideoModal/VideoModal.tsx +31 -25
- package/Components/VideoModal/__tests__/PlayerDetails.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/ZappFrameworkComponents/BarView/BarView.tsx +7 -3
- package/Components/ZappFrameworkComponents/BarView/Buttons/BackButton.tsx +7 -2
- package/Components/ZappFrameworkComponents/BarView/Buttons/CloseButton.tsx +7 -2
- package/Components/ZappFrameworkComponents/BarView/__tests__/BarView.test.tsx +87 -0
- package/Components/ZappFrameworkComponents/Buttons/ActionButton.tsx +9 -4
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +4 -4
- package/Contexts/CachedDimensionsContext/index.ts +13 -9
- 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 +6 -1
- package/Contexts/ScreenDataContext/index.tsx +20 -0
- package/const.ts +6 -0
- package/index.js +3 -0
- package/package.json +5 -5
- package/Components/Screen/TV/hooks/useRestoreFocus.ts +0 -22
- package/Contexts/ScreenDataContext/index.ts +0 -3
- /package/Components/FocusableGroup/{index.android.js → index.android.ts} +0 -0
- /package/Components/FocusableGroup/{index.ios.js → index.ios.ts} +0 -0
|
@@ -2,11 +2,16 @@ import React, { useContext } from "react";
|
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
useSafeAreaFrame,
|
|
6
5
|
useSafeAreaInsets,
|
|
6
|
+
useSafeAreaFrame,
|
|
7
7
|
} from "react-native-safe-area-context";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
useGetBottomTabBarHeight,
|
|
10
|
+
useNavigation,
|
|
11
|
+
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
|
+
import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
9
13
|
|
|
14
|
+
import { PROGRESS_BAR_HEIGHT } from "./utils";
|
|
10
15
|
import { useConfiguration } from "../utils";
|
|
11
16
|
|
|
12
17
|
export enum PlayerAnimationStateEnum {
|
|
@@ -39,6 +44,8 @@ export type ModalAnimationContextT = {
|
|
|
39
44
|
setLastSnap: (value: number) => void;
|
|
40
45
|
tabletLandscapePlayerTopPosition: number;
|
|
41
46
|
setTabletLandscapePlayerTopPosition: (value: number) => void;
|
|
47
|
+
startComponentsAnimationDistance: number;
|
|
48
|
+
progressBarHeight: number;
|
|
42
49
|
};
|
|
43
50
|
|
|
44
51
|
const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
@@ -62,6 +69,8 @@ const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
62
69
|
setLastSnap: () => null,
|
|
63
70
|
tabletLandscapePlayerTopPosition: 0,
|
|
64
71
|
setTabletLandscapePlayerTopPosition: () => null,
|
|
72
|
+
startComponentsAnimationDistance: 0,
|
|
73
|
+
progressBarHeight: 0,
|
|
65
74
|
});
|
|
66
75
|
|
|
67
76
|
export function useModalAnimationContext() {
|
|
@@ -80,6 +89,11 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
80
89
|
const [startComponentsAnimation, setStartComponentsAnimation] =
|
|
81
90
|
React.useState<boolean>(false);
|
|
82
91
|
|
|
92
|
+
const {
|
|
93
|
+
videoModalState: { mode, visible, item },
|
|
94
|
+
} = useNavigation();
|
|
95
|
+
|
|
96
|
+
const isLiveItem = isLive(item);
|
|
83
97
|
const { minimised_height: minimisedHeight } = useConfiguration();
|
|
84
98
|
|
|
85
99
|
const resetPlayerAnimationState = React.useCallback(() => {
|
|
@@ -93,16 +107,28 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
93
107
|
const translateYOffset = React.useRef(new Animated.Value(0)).current;
|
|
94
108
|
const dragVideoPlayerY = React.useRef(new Animated.Value(0)).current;
|
|
95
109
|
|
|
96
|
-
const { height } = useSafeAreaFrame();
|
|
110
|
+
const { height: safeAreaFrameHeight } = useSafeAreaFrame();
|
|
111
|
+
const [height, setHeight] = React.useState<number>(safeAreaFrameHeight);
|
|
112
|
+
const progressBarHeight = isLiveItem ? 0 : PROGRESS_BAR_HEIGHT;
|
|
97
113
|
const { bottom: bottomSafeArea } = useSafeAreaInsets();
|
|
98
114
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
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]);
|
|
99
122
|
|
|
100
123
|
/*
|
|
101
124
|
If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
|
|
102
125
|
Because of this we need to minus bottom SafeArea offset.
|
|
103
126
|
*/
|
|
104
127
|
const minValue =
|
|
105
|
-
height -
|
|
128
|
+
height -
|
|
129
|
+
minimisedHeight -
|
|
130
|
+
(bottomTabBarHeight || bottomSafeArea) -
|
|
131
|
+
progressBarHeight;
|
|
106
132
|
|
|
107
133
|
const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
|
|
108
134
|
// Last snap state which will helps us to make smooth responder to scrollview animation
|
|
@@ -134,6 +160,8 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
134
160
|
setLastSnap,
|
|
135
161
|
tabletLandscapePlayerTopPosition,
|
|
136
162
|
setTabletLandscapePlayerTopPosition,
|
|
163
|
+
startComponentsAnimationDistance,
|
|
164
|
+
progressBarHeight,
|
|
137
165
|
}}
|
|
138
166
|
>
|
|
139
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,7 +7,6 @@ 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";
|
|
@@ -23,6 +22,8 @@ import {
|
|
|
23
22
|
ComponentAnimationType,
|
|
24
23
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
25
24
|
|
|
25
|
+
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
26
|
+
|
|
26
27
|
type DimensionsT = {
|
|
27
28
|
width: number | string;
|
|
28
29
|
height: number | string | undefined;
|
|
@@ -69,10 +70,8 @@ const directionStyles = (isTabletLandscape: boolean): ViewStyle => {
|
|
|
69
70
|
};
|
|
70
71
|
|
|
71
72
|
const getScreenAspectRatio = () => {
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
const longEdge = Math.max(width, height);
|
|
75
|
-
const shortEdge = Math.min(width, height);
|
|
73
|
+
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
74
|
+
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
76
75
|
|
|
77
76
|
return longEdge / shortEdge;
|
|
78
77
|
};
|
|
@@ -125,10 +124,37 @@ const getTabletWidth = (
|
|
|
125
124
|
return Number(width) - sidebarWidth;
|
|
126
125
|
};
|
|
127
126
|
|
|
128
|
-
|
|
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) => {
|
|
129
155
|
const {
|
|
130
156
|
entry,
|
|
131
|
-
style,
|
|
157
|
+
style: baseStyle,
|
|
132
158
|
containerStyle,
|
|
133
159
|
inline,
|
|
134
160
|
docked,
|
|
@@ -143,6 +169,8 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
143
169
|
|
|
144
170
|
const isInlineModal = inline && isModal;
|
|
145
171
|
|
|
172
|
+
const style = getStyles(baseStyle, !isTablet, isInlineModal);
|
|
173
|
+
|
|
146
174
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
147
175
|
|
|
148
176
|
const tabletWidth = getTabletWidth(configuration, style);
|
|
@@ -184,8 +212,8 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
184
212
|
const pathname = `${ROUTE_TYPES.VIDEO_MODAL}/${entry?.id}`;
|
|
185
213
|
|
|
186
214
|
return (
|
|
187
|
-
<
|
|
188
|
-
<
|
|
215
|
+
<PathnameContext.Provider value={pathname}>
|
|
216
|
+
<ScreenContextProvider pathname={pathname}>
|
|
189
217
|
<WrapperView
|
|
190
218
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
191
219
|
style={[
|
|
@@ -197,10 +225,10 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
197
225
|
<AnimationComponent
|
|
198
226
|
animationType={ComponentAnimationType.moveUpComponent}
|
|
199
227
|
additionalData={{ saveArea: true }}
|
|
200
|
-
style={directionStyles(isTabletLandscape)}
|
|
228
|
+
style={[directionStyles(isTabletLandscape), defaultStyles.flex]}
|
|
201
229
|
>
|
|
202
|
-
<
|
|
203
|
-
<
|
|
230
|
+
<PathnameContext.Provider value={pathname}>
|
|
231
|
+
<ScreenContextProvider pathname={pathname}>
|
|
204
232
|
<View
|
|
205
233
|
testID={`${entry?.id}-player-container`}
|
|
206
234
|
style={[
|
|
@@ -224,8 +252,9 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
224
252
|
</AnimatedVideoPlayerComponent>
|
|
225
253
|
</AnimationComponent>
|
|
226
254
|
</View>
|
|
255
|
+
|
|
227
256
|
<AnimatedScrollModal>
|
|
228
|
-
{
|
|
257
|
+
{showDetails(!isTablet, docked) && (
|
|
229
258
|
<AnimationComponent
|
|
230
259
|
animationType={ComponentAnimationType.componentFade}
|
|
231
260
|
style={defaultStyles.flex}
|
|
@@ -235,17 +264,18 @@ export const PlayerWrapper = (props: Props) => {
|
|
|
235
264
|
style={defaultStyles.playerDetails}
|
|
236
265
|
entry={entry}
|
|
237
266
|
isTabletLandscape={isTabletLandscape}
|
|
267
|
+
isTablet={isTablet}
|
|
238
268
|
/>
|
|
239
269
|
</AnimationComponent>
|
|
240
|
-
) : (
|
|
241
|
-
<View style={defaultStyles.playerDetails} />
|
|
242
270
|
)}
|
|
243
271
|
</AnimatedScrollModal>
|
|
244
|
-
</
|
|
245
|
-
</
|
|
272
|
+
</ScreenContextProvider>
|
|
273
|
+
</PathnameContext.Provider>
|
|
246
274
|
</AnimationComponent>
|
|
247
275
|
</WrapperView>
|
|
248
|
-
</
|
|
249
|
-
</
|
|
276
|
+
</ScreenContextProvider>
|
|
277
|
+
</PathnameContext.Provider>
|
|
250
278
|
);
|
|
251
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
|
-
|
|
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
|
+
|
|
133
137
|
<PathnameContext.Provider value={pathname}>
|
|
134
|
-
{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
<
|
|
154
|
-
|
|
155
|
-
|
|
138
|
+
<ScreenContextProvider pathname={pathname}>
|
|
139
|
+
{itemIdHooksFinished === item?.id ? (
|
|
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>
|
|
156
|
+
) : (
|
|
157
|
+
<View style={styles.loaderContainer}>
|
|
158
|
+
<Spinner />
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
161
|
+
</ScreenContextProvider>
|
|
156
162
|
</PathnameContext.Provider>
|
|
157
|
-
|
|
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,
|
|
@@ -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
|
>
|
|
@@ -27,8 +27,8 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
27
27
|
"backgroundColor": "transparent",
|
|
28
28
|
},
|
|
29
29
|
Object {
|
|
30
|
-
"height":
|
|
31
|
-
"width":
|
|
30
|
+
"height": 1334,
|
|
31
|
+
"width": 750,
|
|
32
32
|
},
|
|
33
33
|
Object {},
|
|
34
34
|
]
|
|
@@ -42,9 +42,14 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
42
42
|
}
|
|
43
43
|
animationType="moveUpComponent"
|
|
44
44
|
style={
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
Array [
|
|
46
|
+
Object {
|
|
47
|
+
"flexDirection": "column",
|
|
48
|
+
},
|
|
49
|
+
Object {
|
|
50
|
+
"flex": 1,
|
|
51
|
+
},
|
|
52
|
+
]
|
|
48
53
|
}
|
|
49
54
|
>
|
|
50
55
|
<View
|
|
@@ -67,12 +72,35 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
67
72
|
testID="test-player-container"
|
|
68
73
|
/>
|
|
69
74
|
<View
|
|
75
|
+
animationType="componentFade"
|
|
70
76
|
style={
|
|
71
77
|
Object {
|
|
72
78
|
"flex": 1,
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
|
-
|
|
81
|
+
>
|
|
82
|
+
<View
|
|
83
|
+
configuration={
|
|
84
|
+
Object {
|
|
85
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
86
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
entry={
|
|
90
|
+
Object {
|
|
91
|
+
"id": "test",
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
isTablet={false}
|
|
95
|
+
isTabletLandscape={false}
|
|
96
|
+
style={
|
|
97
|
+
Object {
|
|
98
|
+
"flex": 1,
|
|
99
|
+
"paddingTop": 20,
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
/>
|
|
103
|
+
</View>
|
|
76
104
|
</View>
|
|
77
105
|
</RNCSafeAreaView>
|
|
78
106
|
</RNCSafeAreaProvider>
|
|
@@ -105,8 +133,8 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
105
133
|
"backgroundColor": "transparent",
|
|
106
134
|
},
|
|
107
135
|
Object {
|
|
108
|
-
"height":
|
|
109
|
-
"width":
|
|
136
|
+
"height": 1334,
|
|
137
|
+
"width": 750,
|
|
110
138
|
},
|
|
111
139
|
Object {},
|
|
112
140
|
]
|
|
@@ -120,9 +148,14 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
120
148
|
}
|
|
121
149
|
animationType="moveUpComponent"
|
|
122
150
|
style={
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
151
|
+
Array [
|
|
152
|
+
Object {
|
|
153
|
+
"flexDirection": "column",
|
|
154
|
+
},
|
|
155
|
+
Object {
|
|
156
|
+
"flex": 1,
|
|
157
|
+
},
|
|
158
|
+
]
|
|
126
159
|
}
|
|
127
160
|
>
|
|
128
161
|
<View
|
|
@@ -145,12 +178,35 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
145
178
|
testID="test-player-container"
|
|
146
179
|
/>
|
|
147
180
|
<View
|
|
181
|
+
animationType="componentFade"
|
|
148
182
|
style={
|
|
149
183
|
Object {
|
|
150
184
|
"flex": 1,
|
|
151
185
|
}
|
|
152
186
|
}
|
|
153
|
-
|
|
187
|
+
>
|
|
188
|
+
<View
|
|
189
|
+
configuration={
|
|
190
|
+
Object {
|
|
191
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
192
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
entry={
|
|
196
|
+
Object {
|
|
197
|
+
"id": "test",
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
isTablet={false}
|
|
201
|
+
isTabletLandscape={false}
|
|
202
|
+
style={
|
|
203
|
+
Object {
|
|
204
|
+
"flex": 1,
|
|
205
|
+
"paddingTop": 20,
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/>
|
|
209
|
+
</View>
|
|
154
210
|
</View>
|
|
155
211
|
</RNCSafeAreaView>
|
|
156
212
|
</RNCSafeAreaProvider>
|
|
@@ -198,9 +254,14 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
198
254
|
}
|
|
199
255
|
animationType="moveUpComponent"
|
|
200
256
|
style={
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
257
|
+
Array [
|
|
258
|
+
Object {
|
|
259
|
+
"flexDirection": "row",
|
|
260
|
+
},
|
|
261
|
+
Object {
|
|
262
|
+
"flex": 1,
|
|
263
|
+
},
|
|
264
|
+
]
|
|
204
265
|
}
|
|
205
266
|
>
|
|
206
267
|
<View
|
|
@@ -239,12 +300,35 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
239
300
|
/>
|
|
240
301
|
</View>
|
|
241
302
|
<View
|
|
303
|
+
animationType="componentFade"
|
|
242
304
|
style={
|
|
243
305
|
Object {
|
|
244
306
|
"flex": 1,
|
|
245
307
|
}
|
|
246
308
|
}
|
|
247
|
-
|
|
309
|
+
>
|
|
310
|
+
<View
|
|
311
|
+
configuration={
|
|
312
|
+
Object {
|
|
313
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
314
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
entry={
|
|
318
|
+
Object {
|
|
319
|
+
"id": "test",
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
isTablet={true}
|
|
323
|
+
isTabletLandscape={true}
|
|
324
|
+
style={
|
|
325
|
+
Object {
|
|
326
|
+
"flex": 1,
|
|
327
|
+
"paddingTop": 20,
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/>
|
|
331
|
+
</View>
|
|
248
332
|
</View>
|
|
249
333
|
</RNCSafeAreaView>
|
|
250
334
|
</RNCSafeAreaProvider>
|
|
@@ -277,8 +361,8 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
277
361
|
"backgroundColor": "transparent",
|
|
278
362
|
},
|
|
279
363
|
Object {
|
|
280
|
-
"height":
|
|
281
|
-
"width":
|
|
364
|
+
"height": 750,
|
|
365
|
+
"width": 1334,
|
|
282
366
|
},
|
|
283
367
|
Object {},
|
|
284
368
|
]
|
|
@@ -292,9 +376,14 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
292
376
|
}
|
|
293
377
|
animationType="moveUpComponent"
|
|
294
378
|
style={
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
379
|
+
Array [
|
|
380
|
+
Object {
|
|
381
|
+
"flexDirection": "column",
|
|
382
|
+
},
|
|
383
|
+
Object {
|
|
384
|
+
"flex": 1,
|
|
385
|
+
},
|
|
386
|
+
]
|
|
298
387
|
}
|
|
299
388
|
>
|
|
300
389
|
<View
|
|
@@ -317,12 +406,35 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
317
406
|
testID="test-player-container"
|
|
318
407
|
/>
|
|
319
408
|
<View
|
|
409
|
+
animationType="componentFade"
|
|
320
410
|
style={
|
|
321
411
|
Object {
|
|
322
412
|
"flex": 1,
|
|
323
413
|
}
|
|
324
414
|
}
|
|
325
|
-
|
|
415
|
+
>
|
|
416
|
+
<View
|
|
417
|
+
configuration={
|
|
418
|
+
Object {
|
|
419
|
+
"tablet_landscape_player_container_background_color": "red",
|
|
420
|
+
"tablet_landscape_sidebar_width": "35%",
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
entry={
|
|
424
|
+
Object {
|
|
425
|
+
"id": "test",
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
isTablet={false}
|
|
429
|
+
isTabletLandscape={false}
|
|
430
|
+
style={
|
|
431
|
+
Object {
|
|
432
|
+
"flex": 1,
|
|
433
|
+
"paddingTop": 20,
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/>
|
|
437
|
+
</View>
|
|
326
438
|
</View>
|
|
327
439
|
</RNCSafeAreaView>
|
|
328
440
|
</RNCSafeAreaProvider>
|