@applicaster/zapp-react-native-ui-components 13.0.0-alpha.3592913150 → 13.0.0-alpha.3637360334
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/AppContainer/__tests__/AppContainer.test.js +4 -6
- package/Components/AudioPlayer/AudioPlayer.tsx +7 -0
- package/Components/AudioPlayer/__tests__/Runtime.test.js +5 -8
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayer.test.js.snap +54 -111
- package/Components/AudioPlayer/__tests__/__snapshots__/audioPlayerLayout.test.js.snap +36 -20
- package/Components/AudioPlayer/__tests__/artWork.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayer.test.js +3 -5
- package/Components/AudioPlayer/__tests__/audioPlayerLayout.test.js +7 -8
- package/Components/AudioPlayer/__tests__/channel.test.js +3 -5
- package/Components/AudioPlayer/__tests__/summary.test.js +3 -5
- package/Components/AudioPlayer/__tests__/title.test.js +3 -5
- package/Components/AudioPlayer/helpers.tsx +1 -0
- package/Components/BaseFocusable/index.ios.ts +1 -1
- package/Components/BaseFocusable/index.tsx +2 -3
- package/Components/Cell/Cell.tsx +10 -16
- package/Components/Cell/CellWithFocusable.tsx +48 -59
- package/Components/Cell/CellWrapper.ts +5 -0
- package/Components/Cell/__tests__/CellWIthFocusable.test.js +13 -6
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/__tests__/cellRendererResolver.test.js +46 -48
- package/Components/ComponentResolver/__tests__/__snapshots__/componentResolver.test.js.snap +1 -42
- package/Components/ComponentResolver/__tests__/componentResolver.test.js +16 -22
- package/Components/ContentScreen/__tests__/contentScreen.test.js +3 -3
- package/Components/ErrorScreen/index.tsx +14 -6
- package/Components/Focusable/Focusable.tsx +1 -0
- package/Components/Focusable/Touchable.tsx +19 -20
- package/Components/Focusable/index.android.tsx +10 -3
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +34 -86
- package/Components/FocusableGroup/index.tsx +0 -3
- package/Components/FocusableList/index.tsx +1 -0
- package/Components/FocusableScrollView/index.tsx +6 -3
- package/Components/HandlePlayable/HandlePlayable.tsx +14 -27
- package/Components/Layout/TV/NavBarContainer.tsx +14 -19
- package/Components/Layout/TV/ScreenContainer.tsx +8 -1
- package/Components/Layout/TV/ScreenLayoutContextProvider.tsx +5 -0
- package/Components/Layout/TV/__tests__/ScreenContainer.test.tsx +2 -1
- package/Components/Layout/TV/__tests__/__snapshots__/NavBarContainer.test.tsx.snap +3 -2
- package/Components/Layout/TV/__tests__/__snapshots__/ScreenContainer.test.tsx.snap +3 -2
- package/Components/MasterCell/DefaultComponents/ActionButton.tsx +2 -3
- package/Components/MasterCell/DefaultComponents/BorderContainerView/__tests__/index.test.tsx +66 -0
- package/Components/MasterCell/DefaultComponents/BorderContainerView/index.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +9 -14
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/ImageBorderContainer/__tests__/index.test.ts +93 -0
- package/Components/MasterCell/DefaultComponents/LiveImage/index.tsx +2 -2
- package/Components/MasterCell/DefaultComponents/SecondaryImage/utils.ts +1 -1
- package/Components/MasterCell/DefaultComponents/__tests__/image.test.js +1 -1
- package/Components/MasterCell/SharedUI/ProgressBar/hooks/useFillInPercent.ts +2 -8
- package/Components/MasterCell/__tests__/__snapshots__/elementMapper.test.js.snap +4 -12
- package/Components/MasterCell/__tests__/__snapshots__/masterCell.test.js.snap +0 -229
- package/Components/MasterCell/__tests__/elementMapper.test.js +18 -5
- package/Components/MasterCell/__tests__/masterCell.test.js +26 -26
- package/Components/MasterCell/hooks/useAsyncRendering/MasterCellAsyncRenderManager.ts +2 -2
- package/Components/MasterCell/utils/behaviorProvider.ts +136 -0
- package/Components/MasterCell/utils/index.ts +9 -135
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +6 -6
- package/Components/ModalComponent/Header/index.tsx +3 -3
- package/Components/OfflineHandler/NotificationView/NotificationView.lg.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/NotificationView.samsung.tsx +2 -2
- package/Components/OfflineHandler/NotificationView/__tests__/index.test.tsx +0 -5
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +17 -13
- package/Components/PlayerContainer/ProgramInfo/index.tsx +2 -2
- package/Components/PlayerImageBackground/index.tsx +1 -1
- package/Components/River/ComponentsMap/ComponentsMap.tsx +42 -65
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +78 -51
- package/Components/River/RiverFooter.tsx +39 -9
- package/Components/River/RiverItem.tsx +37 -2
- package/Components/River/__tests__/__snapshots__/componentsMap.test.js.snap +100 -31
- package/Components/River/__tests__/__snapshots__/river.test.js.snap +20 -82
- package/Components/River/__tests__/componentsMap.test.js +17 -5
- package/Components/River/__tests__/river.test.js +75 -40
- package/Components/RouteManager/__tests__/__snapshots__/routeManager.test.js.snap +11 -4
- package/Components/RouteManager/__tests__/routeManager.test.js +29 -14
- package/Components/RouteManager/__tests__/testId.test.js +8 -6
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/hooks.ts +53 -0
- package/Components/Screen/index.tsx +16 -42
- package/Components/ScreenResolver/__tests__/screenResolver.test.js +91 -70
- package/Components/Tabs/Tab.tsx +11 -9
- package/Components/TextInputTv/index.tsx +4 -3
- package/Components/TrackedView/index.tsx +1 -0
- package/Components/Transitioner/AnimationManager.js +15 -15
- package/Components/Transitioner/Scene.tsx +53 -24
- package/Components/Transitioner/Transitioner.tsx +3 -3
- package/Components/Transitioner/__tests__/Scene.test.js +25 -14
- package/Components/Transitioner/__tests__/__snapshots__/Scene.test.js.snap +9 -49
- package/Components/Transitioner/__tests__/__snapshots__/transitioner.test.js.snap +2 -2
- package/Components/Transitioner/__tests__/transitioner.test.js +13 -4
- package/Components/Transitioner/index.js +8 -4
- package/Components/VideoLive/LiveImageManager.ts +27 -1
- package/Components/VideoLive/PlayerLiveImageComponent.tsx +36 -24
- package/Components/VideoLive/__tests__/PlayerLiveImageComponent.test.tsx +51 -1
- package/Components/VideoLive/__tests__/__snapshots__/PlayerLiveImageComponent.test.tsx.snap +1 -5
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +47 -31
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +43 -21
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +4 -5
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +108 -0
- package/Components/VideoModal/ModalAnimation/const.ts +5 -0
- package/Components/VideoModal/ModalAnimation/index.ts +2 -0
- package/Components/VideoModal/ModalAnimation/utils.ts +38 -2
- package/Components/VideoModal/OpaqueLayer.tsx +33 -0
- package/Components/VideoModal/PlayerDetails.tsx +9 -6
- package/Components/VideoModal/PlayerWrapper.tsx +17 -36
- package/Components/VideoModal/VideoModal.tsx +16 -25
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -1
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +0 -90
- package/Components/VideoModal/hooks/__tests__/useDelayedPlayerDetails.test.ts +89 -0
- package/Components/VideoModal/hooks/index.ts +7 -0
- package/Components/VideoModal/hooks/useDelayedPlayerDetails.ts +49 -0
- package/Components/VideoModal/hooks/utils/__tests__/showDetails.test.ts +91 -0
- package/Components/VideoModal/hooks/utils/index.ts +33 -0
- package/Components/VideoModal/utils.ts +1 -1
- package/Components/Viewport/ViewportAware/__tests__/__snapshots__/viewportAware.test.js.snap +24 -36
- package/Components/Viewport/ViewportAware/__tests__/viewportAware.test.js +12 -18
- package/Components/Viewport/__tests__/utils.test.js +5 -4
- package/Components/ZappUIComponent/Placeholder.tsx +3 -1
- package/Components/ZappUIComponent/__tests__/{ZappUIComponent.test.js → ZappUIComponent.test.tsx} +26 -10
- package/Components/ZappUIComponent/index.tsx +3 -16
- package/Components/default-cell-renderer/__tests__/defaultCellRenderer.test.tsx +20 -17
- package/Components/default-cell-renderer/viewTrees/tv/DefaultCell/__tests__/DefaultCell.test.tsx +15 -11
- package/Contexts/ComponentsMapOffsetContext/index.tsx +8 -5
- package/Contexts/FocusableGroupContext/withFocusableContext.tsx +4 -10
- package/Contexts/HeaderOffsetContext/index.tsx +4 -6
- package/Contexts/ScreenContext/index.tsx +6 -12
- package/Contexts/ScreenLayoutContext/index.tsx +5 -3
- package/Decorators/Navigator/__tests__/navigator.test.js +16 -16
- package/Decorators/Navigator/index.tsx +1 -1
- package/Decorators/RiverResolver/__tests__/riverResolver.test.tsx +18 -24
- package/Decorators/RiverResolver/index.tsx +6 -8
- package/Decorators/ZappPipesDataConnector/__tests__/Hero.js +1 -1
- package/Decorators/ZappPipesDataConnector/__tests__/zappPipesDataConnector.test.js +29 -22
- package/Decorators/ZappPipesDataConnector/index.tsx +6 -2
- package/package.json +7 -11
- package/tsconfig.json +2 -3
- package/.babelrc +0 -8
- package/Components/Cell/CellStyles/FallbackCellStyle/index.js +0 -157
- package/Components/Cell/CellStyles/Hero/index.js +0 -111
- package/Components/Cell/CellStyles/ScreenSelector/index.js +0 -68
- package/Components/Cell/CellStyles/cellStylesResolver.ts +0 -19
- package/Components/Cell/CellStyles/colors.js +0 -40
- package/Components/Cell/CellStyles/index.js +0 -15
- package/Components/CellRendererResolver/__tests__/__snapshots__/cellRendererResolver.test.js.snap +0 -53
- package/Components/RouteManager/__tests__/__snapshots__/testId.test.js.snap +0 -17
- package/Components/ScreenResolver/__tests__/__snapshots__/screenResolver.test.js.snap +0 -17
- package/Components/ZappUIComponent/__tests__/__snapshots__/ZappUIComponent.test.js.snap +0 -91
- package/Components/default-cell-renderer/__tests__/__snapshots__/defaultCellRenderer.test.tsx.snap +0 -338
- package/Decorators/Navigator/__tests__/__snapshots__/navigator.test.js.snap +0 -18
- package/Decorators/RiverResolver/__tests__/__snapshots__/riverResolver.test.tsx.snap +0 -28
|
@@ -4,28 +4,31 @@ import { Animated, View } from "react-native";
|
|
|
4
4
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
useModalAnimationContext,
|
|
8
7
|
PlayerAnimationStateEnum,
|
|
8
|
+
useModalAnimationContext,
|
|
9
9
|
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
10
10
|
|
|
11
11
|
import {
|
|
12
|
+
useDimensions,
|
|
12
13
|
useGetBottomTabBarHeight,
|
|
13
14
|
useNavigation,
|
|
14
|
-
useDimensions,
|
|
15
15
|
} from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
16
16
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
17
17
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
18
18
|
import { useAppState } from "@applicaster/zapp-react-native-utils/reactHooks/app";
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
AUDIO_PLAYER_HORIZONTAL_PADDING,
|
|
22
|
+
ComponentAnimationType,
|
|
23
23
|
defaultAspectRatioWidth,
|
|
24
|
+
gestureListenerHelper,
|
|
24
25
|
getAnimationDefaultValue,
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
getAnimationStyle,
|
|
27
|
+
getMoveUpValue,
|
|
27
28
|
} from "./utils";
|
|
28
29
|
|
|
30
|
+
import { DURATION_TO_MINIMIZE, DEFAULT_DURATION_FOR_ANIMATION } from "./const";
|
|
31
|
+
|
|
29
32
|
type Props = {
|
|
30
33
|
animationType: string;
|
|
31
34
|
children: React.ReactNode;
|
|
@@ -97,13 +100,16 @@ export const AnimationView = ({
|
|
|
97
100
|
|
|
98
101
|
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
99
102
|
|
|
100
|
-
const moveUpValue =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
const moveUpValue = getMoveUpValue({
|
|
104
|
+
additionalData,
|
|
105
|
+
insets,
|
|
106
|
+
isAudioItem,
|
|
107
|
+
progressBarHeight,
|
|
108
|
+
isTablet,
|
|
109
|
+
isTabletLandscape,
|
|
110
|
+
inlineAudioPlayer,
|
|
111
|
+
tabletLandscapePlayerTopPosition,
|
|
112
|
+
});
|
|
107
113
|
|
|
108
114
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
109
115
|
? isRTL
|
|
@@ -118,7 +124,10 @@ export const AnimationView = ({
|
|
|
118
124
|
(animationType, state) => {
|
|
119
125
|
const defaultConfig = {
|
|
120
126
|
toValue: 0,
|
|
121
|
-
duration:
|
|
127
|
+
duration:
|
|
128
|
+
state === PlayerAnimationStateEnum.minimize
|
|
129
|
+
? DURATION_TO_MINIMIZE
|
|
130
|
+
: DEFAULT_DURATION_FOR_ANIMATION,
|
|
122
131
|
useNativeDriver: true,
|
|
123
132
|
};
|
|
124
133
|
|
|
@@ -227,6 +236,8 @@ export const AnimationView = ({
|
|
|
227
236
|
isAudioItem,
|
|
228
237
|
moveUpValue,
|
|
229
238
|
moveComponentHorizontalValue,
|
|
239
|
+
isRTL,
|
|
240
|
+
inlineAudioPlayer,
|
|
230
241
|
]
|
|
231
242
|
);
|
|
232
243
|
|
|
@@ -245,7 +256,7 @@ export const AnimationView = ({
|
|
|
245
256
|
default:
|
|
246
257
|
return getAnimationValue(
|
|
247
258
|
animationType,
|
|
248
|
-
PlayerAnimationStateEnum.
|
|
259
|
+
PlayerAnimationStateEnum.maximize
|
|
249
260
|
).toValue;
|
|
250
261
|
}
|
|
251
262
|
}, [defaultValue, videoModalState]);
|
|
@@ -277,6 +288,11 @@ export const AnimationView = ({
|
|
|
277
288
|
moveUpValue,
|
|
278
289
|
moveComponentHorizontalValue,
|
|
279
290
|
videoModalMode,
|
|
291
|
+
isAudioItem,
|
|
292
|
+
isTablet,
|
|
293
|
+
isTabletLandscape,
|
|
294
|
+
isRTL,
|
|
295
|
+
inlineAudioPlayer,
|
|
280
296
|
]
|
|
281
297
|
);
|
|
282
298
|
|
|
@@ -305,7 +321,7 @@ export const AnimationView = ({
|
|
|
305
321
|
}
|
|
306
322
|
|
|
307
323
|
if (
|
|
308
|
-
videoModalMode === "MAXIMIZED" &&
|
|
324
|
+
(videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
|
|
309
325
|
defaultValue.x !== screenWidth &&
|
|
310
326
|
width &&
|
|
311
327
|
height
|
|
@@ -331,7 +347,13 @@ export const AnimationView = ({
|
|
|
331
347
|
animatedValue.setValue(value);
|
|
332
348
|
}
|
|
333
349
|
}
|
|
334
|
-
}, [
|
|
350
|
+
}, [
|
|
351
|
+
animatedValue,
|
|
352
|
+
animationType,
|
|
353
|
+
getAnimationValue,
|
|
354
|
+
playerAnimationState,
|
|
355
|
+
videoModalState,
|
|
356
|
+
]);
|
|
335
357
|
|
|
336
358
|
React.useEffect(() => {
|
|
337
359
|
if (
|
|
@@ -343,7 +365,7 @@ export const AnimationView = ({
|
|
|
343
365
|
animatedValue,
|
|
344
366
|
getAnimationValue(animationType, playerAnimationState)
|
|
345
367
|
).start();
|
|
346
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
368
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
347
369
|
animatedValue.setValue(defaultValue);
|
|
348
370
|
}
|
|
349
371
|
}, [playerAnimationState, startComponentsAnimation, defaultValue]);
|
|
@@ -404,7 +426,7 @@ export const AnimationView = ({
|
|
|
404
426
|
|
|
405
427
|
return (
|
|
406
428
|
<Animated.View
|
|
407
|
-
onLayout={additionalData.useLayoutMeasure
|
|
429
|
+
onLayout={additionalData.useLayoutMeasure ? measureView : undefined}
|
|
408
430
|
ref={animationComponentRef}
|
|
409
431
|
style={[
|
|
410
432
|
...preparedStyles,
|
|
@@ -434,8 +456,8 @@ export const AnimationComponent = (props: Props) => {
|
|
|
434
456
|
const Component = useAnimation
|
|
435
457
|
? AnimationView
|
|
436
458
|
: style
|
|
437
|
-
|
|
438
|
-
|
|
459
|
+
? View
|
|
460
|
+
: React.Fragment;
|
|
439
461
|
|
|
440
462
|
if (
|
|
441
463
|
additionalData.extraAnimation &&
|
|
@@ -14,12 +14,12 @@ import { useConfiguration } from "../utils";
|
|
|
14
14
|
|
|
15
15
|
export enum PlayerAnimationStateEnum {
|
|
16
16
|
minimize = "minimize",
|
|
17
|
-
|
|
17
|
+
maximize = "maximize",
|
|
18
18
|
drag_player = "drag_player",
|
|
19
19
|
drag_scroll = "drag_scroll",
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
22
|
+
export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
23
23
|
|
|
24
24
|
export type ModalAnimationContextT = {
|
|
25
25
|
isActiveGesture: boolean;
|
|
@@ -118,11 +118,10 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
118
118
|
If bottomTabBarHeight is equal 0 it means an app does not use bottomTabBar.
|
|
119
119
|
Because of this we need to minus bottom SafeArea offset.
|
|
120
120
|
*/
|
|
121
|
+
|
|
121
122
|
const minValue =
|
|
122
123
|
height -
|
|
123
|
-
minimisedHeight
|
|
124
|
-
(bottomTabBarHeight || bottomSafeArea) -
|
|
125
|
-
progressBarHeight;
|
|
124
|
+
(minimisedHeight + bottomTabBarHeight + progressBarHeight + bottomSafeArea);
|
|
126
125
|
|
|
127
126
|
const modalSnapPoints = React.useMemo(() => [0, minValue], [minValue]);
|
|
128
127
|
// Last snap state which will helps us to make smooth responder to scrollview animation
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { getMoveUpValue } from "../utils";
|
|
2
|
+
|
|
3
|
+
describe("getMoveUpValue", () => {
|
|
4
|
+
it("returns correct value when additionalData.saveArea is true and isAudioItem is false", () => {
|
|
5
|
+
const result = getMoveUpValue({
|
|
6
|
+
additionalData: { saveArea: true },
|
|
7
|
+
insets: { top: 20 },
|
|
8
|
+
isAudioItem: false,
|
|
9
|
+
progressBarHeight: 10,
|
|
10
|
+
isTablet: false,
|
|
11
|
+
isTabletLandscape: false,
|
|
12
|
+
inlineAudioPlayer: false,
|
|
13
|
+
tabletLandscapePlayerTopPosition: 100,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
expect(result).toBe(-20 + 10);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("returns correct value when additionalData.saveArea is true and isAudioItem is true", () => {
|
|
20
|
+
const result = getMoveUpValue({
|
|
21
|
+
additionalData: { saveArea: true },
|
|
22
|
+
insets: { top: 15 },
|
|
23
|
+
isAudioItem: true,
|
|
24
|
+
progressBarHeight: 5,
|
|
25
|
+
isTablet: false,
|
|
26
|
+
isTabletLandscape: false,
|
|
27
|
+
inlineAudioPlayer: false,
|
|
28
|
+
tabletLandscapePlayerTopPosition: 100,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(result).toBe(-15 + 0);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("returns correct value for audio item (tablet or not)", () => {
|
|
35
|
+
const result = getMoveUpValue({
|
|
36
|
+
additionalData: { marginTop: 30 },
|
|
37
|
+
insets: { top: 0 },
|
|
38
|
+
isAudioItem: true,
|
|
39
|
+
progressBarHeight: 0,
|
|
40
|
+
isTablet: false,
|
|
41
|
+
isTabletLandscape: false,
|
|
42
|
+
inlineAudioPlayer: false,
|
|
43
|
+
tabletLandscapePlayerTopPosition: 0,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(result).toBe(-30);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("returns correct value for tablet landscape with inline audio player", () => {
|
|
50
|
+
const result = getMoveUpValue({
|
|
51
|
+
additionalData: {},
|
|
52
|
+
insets: { top: 0 },
|
|
53
|
+
isAudioItem: true,
|
|
54
|
+
progressBarHeight: 8,
|
|
55
|
+
isTablet: true,
|
|
56
|
+
isTabletLandscape: true,
|
|
57
|
+
inlineAudioPlayer: true,
|
|
58
|
+
tabletLandscapePlayerTopPosition: 50,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
expect(result).toBe(-0);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it("returns correct value for tablet landscape without audio item", () => {
|
|
65
|
+
const result = getMoveUpValue({
|
|
66
|
+
additionalData: {},
|
|
67
|
+
insets: { top: 0 },
|
|
68
|
+
isAudioItem: false,
|
|
69
|
+
progressBarHeight: 12,
|
|
70
|
+
isTablet: true,
|
|
71
|
+
isTabletLandscape: true,
|
|
72
|
+
inlineAudioPlayer: false,
|
|
73
|
+
tabletLandscapePlayerTopPosition: 60,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
expect(result).toBe(-60 + 12);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it("returns -130 for tablet portrait (not landscape)", () => {
|
|
80
|
+
const result = getMoveUpValue({
|
|
81
|
+
additionalData: {},
|
|
82
|
+
insets: { top: 0 },
|
|
83
|
+
isAudioItem: false,
|
|
84
|
+
progressBarHeight: 0,
|
|
85
|
+
isTablet: true,
|
|
86
|
+
isTabletLandscape: false,
|
|
87
|
+
inlineAudioPlayer: false,
|
|
88
|
+
tabletLandscapePlayerTopPosition: 0,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(result).toBe(-130);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("returns -50 + progressBarHeight for mobile audio player in docked mode", () => {
|
|
95
|
+
const result = getMoveUpValue({
|
|
96
|
+
additionalData: {},
|
|
97
|
+
insets: { top: 0 },
|
|
98
|
+
isAudioItem: false,
|
|
99
|
+
progressBarHeight: 7,
|
|
100
|
+
isTablet: false,
|
|
101
|
+
isTabletLandscape: false,
|
|
102
|
+
inlineAudioPlayer: false,
|
|
103
|
+
tabletLandscapePlayerTopPosition: 0,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
expect(result).toBe(-50 + 7);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
@@ -14,3 +14,5 @@ export { useModalAnimationContext } from "./useModalAnimationContext";
|
|
|
14
14
|
export { AnimationComponent } from "./AnimationComponent";
|
|
15
15
|
|
|
16
16
|
export { ComponentAnimationType, defaultAspectRatioWidth } from "./utils";
|
|
17
|
+
|
|
18
|
+
export { DURATION_TO_MINIMIZE, DURATION_TO_MAXIMIZE } from "./const";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable padding-line-between-statements */
|
|
2
2
|
|
|
3
3
|
import { PlayerAnimationStateEnum } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
4
|
+
import { toNumberWithDefaultZero } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
4
5
|
|
|
5
6
|
export enum ComponentAnimationType {
|
|
6
7
|
bottomBar = "bottomBar",
|
|
@@ -108,8 +109,8 @@ export const calculateAnimationValue = (animationType, dragPosition, data) => {
|
|
|
108
109
|
: { forWidth: 3, forHeight: 3 }
|
|
109
110
|
: { forWidth: 2, forHeight: 2 }
|
|
110
111
|
: isTabletLandscape
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
? { forWidth: 8, forHeight: 6.5 }
|
|
113
|
+
: { forWidth: 3.5, forHeight: 2 };
|
|
113
114
|
|
|
114
115
|
const minWidth =
|
|
115
116
|
isAudioItem && !inlineAudioPlayer ? minimisedHeight : minimisedWidth;
|
|
@@ -300,3 +301,38 @@ export const resetScrollAnimatedValues = (
|
|
|
300
301
|
dragScrollY.setValue(0);
|
|
301
302
|
dragVideoPlayerY.setValue(0);
|
|
302
303
|
};
|
|
304
|
+
|
|
305
|
+
export const getMoveUpValue = ({
|
|
306
|
+
additionalData,
|
|
307
|
+
insets,
|
|
308
|
+
isAudioItem,
|
|
309
|
+
progressBarHeight,
|
|
310
|
+
isTablet,
|
|
311
|
+
isTabletLandscape,
|
|
312
|
+
inlineAudioPlayer,
|
|
313
|
+
tabletLandscapePlayerTopPosition,
|
|
314
|
+
}) => {
|
|
315
|
+
if (additionalData.saveArea) {
|
|
316
|
+
return -insets.top + (isAudioItem ? 0 : progressBarHeight);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (isAudioItem) {
|
|
320
|
+
// for tablet and audioPlayer
|
|
321
|
+
return -1 * toNumberWithDefaultZero(additionalData?.marginTop);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if (isTablet) {
|
|
325
|
+
if (
|
|
326
|
+
isTabletLandscape &&
|
|
327
|
+
(!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
328
|
+
) {
|
|
329
|
+
return -tabletLandscapePlayerTopPosition + progressBarHeight;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// for audioPlayer(tablet/isTabletPortrait) in docked mode
|
|
333
|
+
return -130;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// for audioPlayer(mobile) in docked mode
|
|
337
|
+
return -50 + progressBarHeight;
|
|
338
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleSheet, View } from "react-native";
|
|
3
|
+
|
|
4
|
+
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
5
|
+
|
|
6
|
+
import { Spinner } from "../Spinner";
|
|
7
|
+
|
|
8
|
+
const styles = StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
...StyleSheet.absoluteFillObject,
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
justifyContent: "center",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const OpaqueLayer = () => {
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<View
|
|
21
|
+
style={[
|
|
22
|
+
styles.container,
|
|
23
|
+
{
|
|
24
|
+
// we assume that it's non-transparent and we could show spinner always until it will be covered by player
|
|
25
|
+
// this spinner hides all content under modal
|
|
26
|
+
backgroundColor: theme?.app_background_color,
|
|
27
|
+
},
|
|
28
|
+
]}
|
|
29
|
+
>
|
|
30
|
+
<Spinner />
|
|
31
|
+
</View>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from "react";
|
|
2
2
|
import {
|
|
3
|
-
StyleProp,
|
|
4
|
-
ViewStyle,
|
|
5
3
|
Animated,
|
|
6
|
-
Easing,
|
|
7
4
|
Dimensions,
|
|
5
|
+
Easing,
|
|
6
|
+
StyleProp,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
StyleSheet,
|
|
8
9
|
} from "react-native";
|
|
9
10
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
10
11
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
@@ -90,17 +91,19 @@ export const PlayerDetails = ({
|
|
|
90
91
|
{
|
|
91
92
|
// workaround for avoid wrong text-height after going back to portrait rotation
|
|
92
93
|
// we don't see this view in landscape mode, so we are able to use fixed width from portrait mode
|
|
93
|
-
width: isTablet
|
|
94
|
+
width: isTablet
|
|
95
|
+
? undefined
|
|
96
|
+
: (StyleSheet.flatten(style)?.width ?? SCREEN_WIDTH),
|
|
94
97
|
},
|
|
95
98
|
]}
|
|
96
99
|
>
|
|
97
|
-
{screenData
|
|
100
|
+
{screenData ? (
|
|
98
101
|
<ComponentsMap
|
|
99
102
|
riverId={screenData.id}
|
|
100
103
|
feed={screenData?.data?.source}
|
|
101
104
|
riverComponents={screenData.ui_components}
|
|
102
105
|
/>
|
|
103
|
-
)}
|
|
106
|
+
) : null}
|
|
104
107
|
</Animated.View>
|
|
105
108
|
);
|
|
106
109
|
};
|
|
@@ -10,7 +10,8 @@ import { Edge, SafeAreaView } from "react-native-safe-area-context";
|
|
|
10
10
|
import { isTV } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
11
11
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
12
12
|
import { PlayerDetails } from "./PlayerDetails";
|
|
13
|
-
import {
|
|
13
|
+
import { playerDimensionsHack } from "./utils";
|
|
14
|
+
import { useDelayedPlayerDetails } from "./hooks";
|
|
14
15
|
|
|
15
16
|
import {
|
|
16
17
|
AnimatedScrollModal,
|
|
@@ -121,34 +122,6 @@ const getTabletWidth = (
|
|
|
121
122
|
return Number(width) - sidebarWidth;
|
|
122
123
|
};
|
|
123
124
|
|
|
124
|
-
const showDetails = (
|
|
125
|
-
isMobile: boolean,
|
|
126
|
-
docked: boolean,
|
|
127
|
-
isInlineModal,
|
|
128
|
-
pip
|
|
129
|
-
): boolean => {
|
|
130
|
-
if (pip) {
|
|
131
|
-
return false;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
if (!isInlineModal) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// for mobile we always show details. Mounting of it very heavy operation.
|
|
139
|
-
if (isMobile) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// workaround for tablets we need to mount/unmount in order to avoid PlayerDetails content dissappearing
|
|
144
|
-
// FIXME - find out the reason of dissapearing of content
|
|
145
|
-
if (docked) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return true;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
125
|
const PlayerWrapperComponent = (props: Props) => {
|
|
153
126
|
const {
|
|
154
127
|
entry,
|
|
@@ -167,7 +140,15 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
167
140
|
|
|
168
141
|
const isInlineModal = inline && isModal;
|
|
169
142
|
|
|
170
|
-
//
|
|
143
|
+
// Mounting the PlayerDetails component is a resource-intensive process.
|
|
144
|
+
// Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
|
|
145
|
+
// The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
|
|
146
|
+
// This helps to avoid blocking the rotation and any animations related to the rotation.
|
|
147
|
+
const isShowPlayerDetails = useDelayedPlayerDetails({
|
|
148
|
+
isInline: isInlineModal,
|
|
149
|
+
isDocked: docked,
|
|
150
|
+
isPip: pip,
|
|
151
|
+
});
|
|
171
152
|
|
|
172
153
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
173
154
|
|
|
@@ -203,8 +184,8 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
203
184
|
const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
|
|
204
185
|
|
|
205
186
|
const childrenStyles = React.useMemo(
|
|
206
|
-
() => ({ ...playerDimensions, ...
|
|
207
|
-
[containerDimensions,
|
|
187
|
+
() => ({ ...playerDimensions, ...playerDimensionsHack }),
|
|
188
|
+
[containerDimensions, playerDimensionsHack]
|
|
208
189
|
);
|
|
209
190
|
|
|
210
191
|
return (
|
|
@@ -213,7 +194,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
213
194
|
style={[
|
|
214
195
|
safeAreaStyles(configuration, isTablet),
|
|
215
196
|
style,
|
|
216
|
-
|
|
197
|
+
playerDimensionsHack,
|
|
217
198
|
]}
|
|
218
199
|
>
|
|
219
200
|
<AnimationComponent
|
|
@@ -227,7 +208,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
227
208
|
defaultStyles.playerContainer,
|
|
228
209
|
containerDimensions,
|
|
229
210
|
containerStyle,
|
|
230
|
-
|
|
211
|
+
playerDimensionsHack,
|
|
231
212
|
]}
|
|
232
213
|
>
|
|
233
214
|
<AnimationComponent
|
|
@@ -246,7 +227,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
246
227
|
</View>
|
|
247
228
|
|
|
248
229
|
<AnimatedScrollModal>
|
|
249
|
-
{
|
|
230
|
+
{isShowPlayerDetails ? (
|
|
250
231
|
<AnimationComponent
|
|
251
232
|
animationType={ComponentAnimationType.componentFade}
|
|
252
233
|
style={defaultStyles.flex}
|
|
@@ -259,7 +240,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
259
240
|
isTablet={isTablet}
|
|
260
241
|
/>
|
|
261
242
|
</AnimationComponent>
|
|
262
|
-
)}
|
|
243
|
+
) : null}
|
|
263
244
|
</AnimatedScrollModal>
|
|
264
245
|
</AnimationComponent>
|
|
265
246
|
</WrapperView>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
import { StyleSheet,
|
|
2
|
+
import { equals } from "ramda";
|
|
3
|
+
import { StyleSheet, StatusBar } from "react-native";
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
@@ -17,17 +17,20 @@ import {
|
|
|
17
17
|
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks/device/useIsTablet";
|
|
18
18
|
|
|
19
19
|
import { withModalNavigationContextProvider } from "../../Contexts/ModalNavigationContext";
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
import {
|
|
21
|
+
useModalSize,
|
|
22
|
+
useBackgroundColor,
|
|
23
|
+
useInitialPlayerState,
|
|
24
|
+
} from "./hooks";
|
|
25
|
+
|
|
23
26
|
import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
|
|
24
|
-
import { Spinner } from "../Spinner";
|
|
25
27
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
26
28
|
import { ROUTE_TYPES } from "@applicaster/zapp-react-native-utils/navigationUtils/routeTypes";
|
|
27
29
|
import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHooks/useSubscriberFor";
|
|
28
30
|
import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
29
31
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
30
32
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
33
|
+
import { OpaqueLayer } from "./OpaqueLayer";
|
|
31
34
|
|
|
32
35
|
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
33
36
|
|
|
@@ -39,17 +42,6 @@ const styles = StyleSheet.create({
|
|
|
39
42
|
bottom: 0,
|
|
40
43
|
position: "absolute",
|
|
41
44
|
},
|
|
42
|
-
// eslint-disable-next-line react-native/no-color-literals
|
|
43
|
-
loaderContainer: {
|
|
44
|
-
top: 0,
|
|
45
|
-
left: 0,
|
|
46
|
-
right: 0,
|
|
47
|
-
bottom: 0,
|
|
48
|
-
position: "absolute",
|
|
49
|
-
alignItems: "center",
|
|
50
|
-
justifyContent: "center",
|
|
51
|
-
backgroundColor: "rgba(64,64,64,.5)",
|
|
52
|
-
},
|
|
53
45
|
});
|
|
54
46
|
|
|
55
47
|
const VideoModalComponent = () => {
|
|
@@ -100,7 +92,7 @@ const VideoModalComponent = () => {
|
|
|
100
92
|
|
|
101
93
|
const onHooksSuccess = ({ payload }) => {
|
|
102
94
|
// set new modified entry
|
|
103
|
-
if (!
|
|
95
|
+
if (!equals(payload, item)) {
|
|
104
96
|
onVideoModalHookSuccessAnalyticsEvent();
|
|
105
97
|
setVideoModalItem(payload);
|
|
106
98
|
}
|
|
@@ -136,27 +128,26 @@ const VideoModalComponent = () => {
|
|
|
136
128
|
|
|
137
129
|
<PathnameContext.Provider value={pathname}>
|
|
138
130
|
<ScreenContextProvider pathname={pathname}>
|
|
139
|
-
{
|
|
131
|
+
{/* Hide content underneath when we switch to next video in fullscreen mode */}
|
|
132
|
+
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
133
|
+
|
|
134
|
+
{itemIdHooksFinished === item?.id && (
|
|
140
135
|
<AnimatedPlayerModalWrapper
|
|
141
136
|
style={[
|
|
142
137
|
styles.container,
|
|
143
138
|
{
|
|
144
139
|
backgroundColor,
|
|
140
|
+
width: modalSize.width,
|
|
141
|
+
height: modalSize.height,
|
|
145
142
|
},
|
|
146
143
|
]}
|
|
147
144
|
>
|
|
148
145
|
<HandlePlayable
|
|
149
146
|
item={item}
|
|
150
147
|
isModal={mode !== "PIP"}
|
|
151
|
-
modalHeight={modalSize.height}
|
|
152
|
-
modalWidth={modalSize.width}
|
|
153
148
|
mode={mode}
|
|
154
149
|
/>
|
|
155
150
|
</AnimatedPlayerModalWrapper>
|
|
156
|
-
) : (
|
|
157
|
-
<View style={styles.loaderContainer}>
|
|
158
|
-
<Spinner />
|
|
159
|
-
</View>
|
|
160
151
|
)}
|
|
161
152
|
</ScreenContextProvider>
|
|
162
153
|
</PathnameContext.Provider>
|
|
@@ -62,7 +62,7 @@ jest.mock("@applicaster/zapp-react-native-utils/reactHooks/navigation", () => ({
|
|
|
62
62
|
})),
|
|
63
63
|
}));
|
|
64
64
|
|
|
65
|
-
jest.mock("../utils", () => ({
|
|
65
|
+
jest.mock("../utils", () => ({ playerDimensionsHack: {} }));
|
|
66
66
|
|
|
67
67
|
const { PlayerWrapper } = require("../PlayerWrapper");
|
|
68
68
|
|