@applicaster/zapp-react-native-ui-components 13.0.0-alpha.5144285042 → 13.0.0-alpha.5145183145
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/AudioPlayer/AudioPlayer.tsx +5 -9
- package/Components/AudioPlayer/helpers.tsx +1 -2
- package/Components/Cell/Cell.tsx +3 -13
- package/Components/Cell/CellWithFocusable.tsx +21 -15
- package/Components/Cell/CellWrapper.tsx +18 -0
- package/Components/Cell/styles.ts +17 -0
- package/Components/CellRendererResolver/index.ts +2 -1
- package/Components/ErrorScreen/index.tsx +8 -0
- package/Components/FocusableCell/index.tsx +1 -1
- package/Components/FocusableGroup/FocusableTvOS.tsx +3 -6
- package/Components/FocusableGroup/index.tsx +0 -1
- package/Components/GeneralContentScreen/GeneralContentScreen.tsx +3 -0
- package/Components/GeneralContentScreen/utils/useCurationAPI.ts +4 -2
- package/Components/GeneralContentScreen/utils/useEventAlerts.ts +30 -0
- package/Components/HandlePlayable/HandlePlayable.tsx +21 -27
- package/Components/Layout/TV/LayoutBackground.tsx +28 -0
- package/Components/Layout/TV/ScreenContainer.tsx +0 -1
- package/Components/Layout/TV/__tests__/__snapshots__/index.test.tsx.snap +15 -10
- package/Components/Layout/TV/__tests__/index.test.tsx +8 -2
- package/Components/Layout/TV/index.tsx +6 -20
- package/Components/Layout/TV/index.web.tsx +4 -1
- package/Components/MasterCell/DefaultComponents/Image/Image.ios.tsx +4 -3
- package/Components/MasterCell/DefaultComponents/Image/hooks/useImage.ts +11 -7
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/const.ts +3 -0
- package/Components/MasterCell/DefaultComponents/tv/TvActionButtons/index.ts +6 -6
- package/Components/MasterCell/utils/behaviorProvider.ts +4 -1
- package/Components/MasterCell/utils/index.ts +6 -6
- package/Components/ModalComponent/BottomSheetModalContent.tsx +49 -41
- package/Components/ModalComponent/Button/Item.tsx +6 -5
- package/Components/ModalComponent/Button/assets.ts +1 -1
- package/Components/ModalComponent/Button/index.tsx +45 -62
- package/Components/ModalComponent/Header/index.tsx +9 -8
- package/Components/ModalComponent/utils.ts +55 -7
- package/Components/OfflineHandler/utils/index.ts +1 -1
- package/Components/PlayerContainer/PlayerContainer.tsx +34 -7
- package/Components/PlayerImageBackground/index.tsx +4 -24
- package/Components/River/ComponentsMap/ComponentsMap.tsx +3 -0
- package/Components/River/ComponentsMap/hooks/useLoadingState.ts +3 -3
- package/Components/River/RiverItem.tsx +2 -1
- package/Components/Screen/TV/__tests__/index.web.test.tsx +26 -0
- package/Components/Screen/TV/index.web.tsx +5 -6
- package/Components/Screen/__tests__/Screen.test.tsx +22 -14
- package/Components/Screen/__tests__/__snapshots__/Screen.test.tsx.snap +2 -2
- package/Components/Screen/hooks.ts +3 -6
- package/Components/TopMarginApplicator/TopMarginApplicator.tsx +2 -3
- package/Components/VideoModal/ModalAnimation/AnimatedPlayerModalWrapper.tsx +1 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +35 -19
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +3 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +38 -14
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +10 -3
- 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 +30 -0
- package/Components/VideoModal/PlayerDetails.tsx +9 -4
- package/Components/VideoModal/PlayerWrapper.tsx +35 -22
- package/Components/VideoModal/VideoModal.tsx +19 -4
- package/Components/VideoModal/__tests__/__snapshots__/PlayerDetails.test.tsx.snap +2 -40
- package/Components/VideoModal/utils.ts +3 -4
- package/Components/ZappUIComponent/index.tsx +4 -4
- package/Decorators/ZappPipesDataConnector/index.tsx +2 -1
- package/package.json +5 -6
- 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
|
@@ -24,8 +24,11 @@ import {
|
|
|
24
24
|
gestureListenerHelper,
|
|
25
25
|
getAnimationDefaultValue,
|
|
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;
|
|
@@ -91,20 +94,21 @@ export const AnimationView = ({
|
|
|
91
94
|
const isAudioItem = React.useMemo(
|
|
92
95
|
() =>
|
|
93
96
|
videoModalItem?.content?.type?.includes?.("audio") ||
|
|
94
|
-
videoModalItem?.type?.value
|
|
97
|
+
videoModalItem?.type?.value?.includes?.("audio"),
|
|
95
98
|
[videoModalItem]
|
|
96
99
|
);
|
|
97
100
|
|
|
98
101
|
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
99
102
|
|
|
100
|
-
const moveUpValue =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
const moveUpValue = getMoveUpValue({
|
|
104
|
+
additionalData,
|
|
105
|
+
insets,
|
|
106
|
+
isAudioItem,
|
|
107
|
+
progressBarHeight,
|
|
108
|
+
isTablet,
|
|
109
|
+
isTabletLandscape,
|
|
110
|
+
tabletLandscapePlayerTopPosition,
|
|
111
|
+
});
|
|
108
112
|
|
|
109
113
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
110
114
|
? isRTL
|
|
@@ -119,7 +123,10 @@ export const AnimationView = ({
|
|
|
119
123
|
(animationType, state) => {
|
|
120
124
|
const defaultConfig = {
|
|
121
125
|
toValue: 0,
|
|
122
|
-
duration:
|
|
126
|
+
duration:
|
|
127
|
+
state === PlayerAnimationStateEnum.minimize
|
|
128
|
+
? DURATION_TO_MINIMIZE
|
|
129
|
+
: DEFAULT_DURATION_FOR_ANIMATION,
|
|
123
130
|
useNativeDriver: true,
|
|
124
131
|
};
|
|
125
132
|
|
|
@@ -228,6 +235,8 @@ export const AnimationView = ({
|
|
|
228
235
|
isAudioItem,
|
|
229
236
|
moveUpValue,
|
|
230
237
|
moveComponentHorizontalValue,
|
|
238
|
+
isRTL,
|
|
239
|
+
inlineAudioPlayer,
|
|
231
240
|
]
|
|
232
241
|
);
|
|
233
242
|
|
|
@@ -246,7 +255,7 @@ export const AnimationView = ({
|
|
|
246
255
|
default:
|
|
247
256
|
return getAnimationValue(
|
|
248
257
|
animationType,
|
|
249
|
-
PlayerAnimationStateEnum.
|
|
258
|
+
PlayerAnimationStateEnum.maximize
|
|
250
259
|
).toValue;
|
|
251
260
|
}
|
|
252
261
|
}, [defaultValue, videoModalState]);
|
|
@@ -278,6 +287,11 @@ export const AnimationView = ({
|
|
|
278
287
|
moveUpValue,
|
|
279
288
|
moveComponentHorizontalValue,
|
|
280
289
|
videoModalMode,
|
|
290
|
+
isAudioItem,
|
|
291
|
+
isTablet,
|
|
292
|
+
isTabletLandscape,
|
|
293
|
+
isRTL,
|
|
294
|
+
inlineAudioPlayer,
|
|
281
295
|
]
|
|
282
296
|
);
|
|
283
297
|
|
|
@@ -306,7 +320,7 @@ export const AnimationView = ({
|
|
|
306
320
|
}
|
|
307
321
|
|
|
308
322
|
if (
|
|
309
|
-
videoModalMode === "MAXIMIZED" &&
|
|
323
|
+
(videoModalMode === "MAXIMIZED" || videoModalMode === "MINIMIZED") &&
|
|
310
324
|
defaultValue.x !== screenWidth &&
|
|
311
325
|
width &&
|
|
312
326
|
height
|
|
@@ -332,7 +346,13 @@ export const AnimationView = ({
|
|
|
332
346
|
animatedValue.setValue(value);
|
|
333
347
|
}
|
|
334
348
|
}
|
|
335
|
-
}, [
|
|
349
|
+
}, [
|
|
350
|
+
animatedValue,
|
|
351
|
+
animationType,
|
|
352
|
+
getAnimationValue,
|
|
353
|
+
playerAnimationState,
|
|
354
|
+
videoModalState,
|
|
355
|
+
]);
|
|
336
356
|
|
|
337
357
|
React.useEffect(() => {
|
|
338
358
|
if (
|
|
@@ -344,7 +364,7 @@ export const AnimationView = ({
|
|
|
344
364
|
animatedValue,
|
|
345
365
|
getAnimationValue(animationType, playerAnimationState)
|
|
346
366
|
).start();
|
|
347
|
-
} else if (playerAnimationState === PlayerAnimationStateEnum.
|
|
367
|
+
} else if (playerAnimationState === PlayerAnimationStateEnum.maximize) {
|
|
348
368
|
animatedValue.setValue(defaultValue);
|
|
349
369
|
}
|
|
350
370
|
}, [playerAnimationState, startComponentsAnimation, defaultValue]);
|
|
@@ -427,6 +447,10 @@ export const AnimationComponent = (props: Props) => {
|
|
|
427
447
|
videoModalState: { visible },
|
|
428
448
|
} = useNavigation();
|
|
429
449
|
|
|
450
|
+
if (additionalData?.disableAnimatedComponent) {
|
|
451
|
+
return <>{props.children}</>;
|
|
452
|
+
}
|
|
453
|
+
|
|
430
454
|
const useAnimation =
|
|
431
455
|
visible && !additionalData.disableAnimatedComponent && !isTV();
|
|
432
456
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { useEffect } from "react";
|
|
2
2
|
import { Animated } from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
@@ -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;
|
|
@@ -95,6 +95,13 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
95
95
|
setStartComponentsAnimation(false);
|
|
96
96
|
}, []);
|
|
97
97
|
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
// Reset player animation state when video modal is closed
|
|
100
|
+
if (!visible) {
|
|
101
|
+
resetPlayerAnimationState();
|
|
102
|
+
}
|
|
103
|
+
}, [visible, resetPlayerAnimationState]);
|
|
104
|
+
|
|
98
105
|
// Animated values
|
|
99
106
|
const lastScrollY = React.useRef(new Animated.Value(0)).current;
|
|
100
107
|
const dragScrollY = React.useRef(new Animated.Value(0)).current;
|
|
@@ -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",
|
|
@@ -300,3 +301,32 @@ 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
|
+
tabletLandscapePlayerTopPosition,
|
|
313
|
+
}) => {
|
|
314
|
+
if (additionalData.saveArea) {
|
|
315
|
+
return -insets.top + (isAudioItem ? 0 : progressBarHeight);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
if (isAudioItem) {
|
|
319
|
+
// for any layouts in audioPlayer
|
|
320
|
+
return -1 * toNumberWithDefaultZero(additionalData?.marginTop);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
if (isTablet) {
|
|
324
|
+
if (isTabletLandscape) {
|
|
325
|
+
return -tabletLandscapePlayerTopPosition + progressBarHeight;
|
|
326
|
+
} else {
|
|
327
|
+
return -130;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return -50 + progressBarHeight;
|
|
332
|
+
};
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactHooks/screen";
|
|
11
11
|
import { ComponentsMap } from "@applicaster/zapp-react-native-ui-components/Components/River/ComponentsMap";
|
|
12
12
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
13
|
+
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
13
14
|
|
|
14
15
|
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
15
16
|
|
|
@@ -22,9 +23,9 @@ type Props = {
|
|
|
22
23
|
entry: ZappEntry;
|
|
23
24
|
style: StyleProp<ViewStyle>;
|
|
24
25
|
configuration: Configuration;
|
|
25
|
-
isTabletLandscape
|
|
26
|
+
isTabletLandscape?: boolean;
|
|
26
27
|
isAudioPlayer?: boolean;
|
|
27
|
-
isTablet
|
|
28
|
+
isTablet?: boolean;
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
const containerStyle = ({
|
|
@@ -39,9 +40,9 @@ export const PlayerDetails = ({
|
|
|
39
40
|
entry,
|
|
40
41
|
style,
|
|
41
42
|
configuration,
|
|
42
|
-
isTabletLandscape,
|
|
43
|
+
isTabletLandscape = false,
|
|
43
44
|
isAudioPlayer,
|
|
44
|
-
isTablet,
|
|
45
|
+
isTablet = false,
|
|
45
46
|
}: Props) => {
|
|
46
47
|
const screenData = useTargetScreenData(entry);
|
|
47
48
|
const insets = useSafeAreaInsets();
|
|
@@ -78,6 +79,10 @@ export const PlayerDetails = ({
|
|
|
78
79
|
}
|
|
79
80
|
}, [isAudioPlayer]);
|
|
80
81
|
|
|
82
|
+
if (isNilOrEmpty(screenData?.ui_components)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
return (
|
|
82
87
|
<Animated.View
|
|
83
88
|
style={[
|
|
@@ -74,20 +74,6 @@ const getScreenAspectRatio = () => {
|
|
|
74
74
|
return longEdge / shortEdge;
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
-
const safeAreaStyles = (
|
|
78
|
-
configuration: Configuration,
|
|
79
|
-
isTablet: boolean
|
|
80
|
-
): ViewStyle => {
|
|
81
|
-
const tablet_landscape_player_container_background_color =
|
|
82
|
-
configuration?.tablet_landscape_player_container_background_color;
|
|
83
|
-
|
|
84
|
-
return {
|
|
85
|
-
backgroundColor: isTablet
|
|
86
|
-
? tablet_landscape_player_container_background_color
|
|
87
|
-
: "transparent",
|
|
88
|
-
};
|
|
89
|
-
};
|
|
90
|
-
|
|
91
77
|
const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
92
78
|
if (isTablet) {
|
|
93
79
|
return ["top"];
|
|
@@ -100,6 +86,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
|
100
86
|
return ["top"];
|
|
101
87
|
};
|
|
102
88
|
|
|
89
|
+
const isPercentage = (value: string | number): boolean => {
|
|
90
|
+
if (typeof value === "string") {
|
|
91
|
+
return value.includes("%");
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return false;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const getPercentageOf = (percent: string, value: number) => {
|
|
98
|
+
const percentageValue = parseFloat(percent.replace("%", ""));
|
|
99
|
+
|
|
100
|
+
if (isNaN(percentageValue)) {
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (value * percentageValue) / 100;
|
|
105
|
+
};
|
|
106
|
+
|
|
103
107
|
const getTabletWidth = (
|
|
104
108
|
configuration: Configuration,
|
|
105
109
|
dimensions: DimensionsT
|
|
@@ -108,18 +112,23 @@ const getTabletWidth = (
|
|
|
108
112
|
configuration?.tablet_landscape_sidebar_width;
|
|
109
113
|
|
|
110
114
|
const { width } = dimensions;
|
|
115
|
+
let widthValue = Number(width);
|
|
116
|
+
|
|
117
|
+
if (isPercentage(width)) {
|
|
118
|
+
widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
|
|
119
|
+
}
|
|
111
120
|
|
|
112
121
|
const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
|
|
113
122
|
|
|
114
123
|
if (tablet_landscape_sidebar_width?.includes("%")) {
|
|
115
|
-
return
|
|
124
|
+
return widthValue * (1 - sidebarWidth / 100);
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
if (Number.isNaN(sidebarWidth)) {
|
|
119
|
-
return
|
|
128
|
+
return widthValue * 0.65;
|
|
120
129
|
}
|
|
121
130
|
|
|
122
|
-
return
|
|
131
|
+
return widthValue - sidebarWidth;
|
|
123
132
|
};
|
|
124
133
|
|
|
125
134
|
const PlayerWrapperComponent = (props: Props) => {
|
|
@@ -133,6 +142,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
133
142
|
children,
|
|
134
143
|
isTabletPortrait,
|
|
135
144
|
configuration,
|
|
145
|
+
fullscreen,
|
|
136
146
|
pip,
|
|
137
147
|
} = props;
|
|
138
148
|
|
|
@@ -188,14 +198,17 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
188
198
|
[containerDimensions, playerDimensionsHack]
|
|
189
199
|
);
|
|
190
200
|
|
|
201
|
+
const wrapperViewStyle: ViewStyle = {
|
|
202
|
+
backgroundColor:
|
|
203
|
+
isTablet && !fullscreen
|
|
204
|
+
? configuration?.tablet_landscape_player_container_background_color
|
|
205
|
+
: "transparent",
|
|
206
|
+
};
|
|
207
|
+
|
|
191
208
|
return (
|
|
192
209
|
<WrapperView
|
|
193
210
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
194
|
-
style={[
|
|
195
|
-
safeAreaStyles(configuration, isTablet),
|
|
196
|
-
style,
|
|
197
|
-
playerDimensionsHack,
|
|
198
|
-
]}
|
|
211
|
+
style={[wrapperViewStyle, style, playerDimensionsHack]}
|
|
199
212
|
>
|
|
200
213
|
<AnimationComponent
|
|
201
214
|
animationType={ComponentAnimationType.moveUpComponent}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { equals } from "ramda";
|
|
3
|
-
import { StyleSheet, StatusBar } from "react-native";
|
|
3
|
+
import { StyleSheet, StatusBar, View } from "react-native";
|
|
4
4
|
|
|
5
5
|
import { HandlePlayable } from "@applicaster/zapp-react-native-ui-components/Components/HandlePlayable";
|
|
6
6
|
import {
|
|
@@ -30,10 +30,13 @@ import { useSubscriberFor } from "@applicaster/zapp-react-native-utils/reactHook
|
|
|
30
30
|
import { requiresAuthentication } from "@applicaster/zapp-react-native-utils/configurationUtils";
|
|
31
31
|
import { playerManager } from "@applicaster/zapp-react-native-utils/appUtils";
|
|
32
32
|
import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
33
|
+
import { Spinner } from "../Spinner";
|
|
33
34
|
import { OpaqueLayer } from "./OpaqueLayer";
|
|
34
35
|
|
|
35
36
|
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
36
37
|
|
|
38
|
+
const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
|
|
39
|
+
|
|
37
40
|
const styles = StyleSheet.create({
|
|
38
41
|
container: {
|
|
39
42
|
top: 0,
|
|
@@ -42,6 +45,16 @@ const styles = StyleSheet.create({
|
|
|
42
45
|
bottom: 0,
|
|
43
46
|
position: "absolute",
|
|
44
47
|
},
|
|
48
|
+
loaderContainer: {
|
|
49
|
+
top: 0,
|
|
50
|
+
left: 0,
|
|
51
|
+
right: 0,
|
|
52
|
+
bottom: 0,
|
|
53
|
+
position: "absolute",
|
|
54
|
+
alignItems: "center",
|
|
55
|
+
justifyContent: "center",
|
|
56
|
+
backgroundColor: LOADER_BACKGROUND_COLOR,
|
|
57
|
+
},
|
|
45
58
|
});
|
|
46
59
|
|
|
47
60
|
const VideoModalComponent = () => {
|
|
@@ -131,7 +144,7 @@ const VideoModalComponent = () => {
|
|
|
131
144
|
{/* Hide content underneath when we switch to next video in fullscreen mode */}
|
|
132
145
|
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
133
146
|
|
|
134
|
-
{itemIdHooksFinished === item?.id
|
|
147
|
+
{itemIdHooksFinished === item?.id ? (
|
|
135
148
|
<AnimatedPlayerModalWrapper
|
|
136
149
|
style={[
|
|
137
150
|
styles.container,
|
|
@@ -143,11 +156,13 @@ const VideoModalComponent = () => {
|
|
|
143
156
|
<HandlePlayable
|
|
144
157
|
item={item}
|
|
145
158
|
isModal={mode !== "PIP"}
|
|
146
|
-
modalHeight={modalSize.height}
|
|
147
|
-
modalWidth={modalSize.width}
|
|
148
159
|
mode={mode}
|
|
149
160
|
/>
|
|
150
161
|
</AnimatedPlayerModalWrapper>
|
|
162
|
+
) : (
|
|
163
|
+
<View style={styles.loaderContainer}>
|
|
164
|
+
<Spinner />
|
|
165
|
+
</View>
|
|
151
166
|
)}
|
|
152
167
|
</ScreenContextProvider>
|
|
153
168
|
</PathnameContext.Provider>
|
|
@@ -1,43 +1,5 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`PlayerDetails renders properly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
collapsable={false}
|
|
6
|
-
style={
|
|
7
|
-
{
|
|
8
|
-
"backgroundColor": "transparent",
|
|
9
|
-
"flex": 1,
|
|
10
|
-
"marginTop": -8,
|
|
11
|
-
"paddingTop": -8,
|
|
12
|
-
"width": 750,
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
>
|
|
16
|
-
<View
|
|
17
|
-
feed="test-source"
|
|
18
|
-
riverComponents={[]}
|
|
19
|
-
riverId="test-id"
|
|
20
|
-
/>
|
|
21
|
-
</View>
|
|
22
|
-
`;
|
|
3
|
+
exports[`PlayerDetails renders properly 1`] = `null`;
|
|
23
4
|
|
|
24
|
-
exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `
|
|
25
|
-
<View
|
|
26
|
-
collapsable={false}
|
|
27
|
-
style={
|
|
28
|
-
{
|
|
29
|
-
"backgroundColor": "transparent",
|
|
30
|
-
"flex": 1,
|
|
31
|
-
"marginTop": -20,
|
|
32
|
-
"paddingTop": 40,
|
|
33
|
-
"width": 750,
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
>
|
|
37
|
-
<View
|
|
38
|
-
feed="test-source"
|
|
39
|
-
riverComponents={[]}
|
|
40
|
-
riverId="test-id"
|
|
41
|
-
/>
|
|
42
|
-
</View>
|
|
43
|
-
`;
|
|
5
|
+
exports[`PlayerDetails renders properly on tablet in landscape orientation 1`] = `null`;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { mergeRight } from "ramda";
|
|
3
2
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
4
3
|
import { usePickFromState } from "@applicaster/zapp-react-native-redux/hooks";
|
|
5
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks/navigation/useNavigation";
|
|
@@ -25,10 +24,10 @@ export const useConfiguration = () => {
|
|
|
25
24
|
|
|
26
25
|
const playerPluginConfig = playerManager.getPluginConfiguration();
|
|
27
26
|
|
|
28
|
-
const config =
|
|
27
|
+
const config = mergeRight(playerPluginConfig, {
|
|
28
|
+
...pluginConfiguration,
|
|
29
29
|
...targetScreenConfiguration?.general,
|
|
30
30
|
...targetScreenConfiguration?.styles,
|
|
31
|
-
...pluginConfiguration,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
const {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import { Placeholder } from "./Placeholder";
|
|
10
10
|
import { useInitialLoading } from "./hooks";
|
|
11
|
-
import { useIsFocusable } from "@applicaster/zapp-react-native-utils/focusManager";
|
|
12
11
|
|
|
13
12
|
type ReactComponent = React.ComponentType<any>;
|
|
14
13
|
|
|
@@ -138,12 +137,13 @@ New signature: {Component, ErrorComponent, LoadingComponent, options}`
|
|
|
138
137
|
);
|
|
139
138
|
|
|
140
139
|
const componentProps = React.useMemo(
|
|
141
|
-
() => ({
|
|
140
|
+
() => ({
|
|
141
|
+
...props,
|
|
142
|
+
parent,
|
|
143
|
+
}),
|
|
142
144
|
[props, parent]
|
|
143
145
|
);
|
|
144
146
|
|
|
145
|
-
useIsFocusable(componentProps);
|
|
146
|
-
|
|
147
147
|
React.useEffect(() => {
|
|
148
148
|
if (!skipOnLoadFinished && !isLoading) {
|
|
149
149
|
onLoadFinished();
|
|
@@ -230,7 +230,8 @@ export function zappPipesDataConnector(
|
|
|
230
230
|
const entryContext =
|
|
231
231
|
(shouldUseNestedContext && screenContextData?.nested?.entry
|
|
232
232
|
? screenContextData?.nested?.entry
|
|
233
|
-
: screenContextData?.entry) ||
|
|
233
|
+
: (screenContextData?.entry?.payload ?? screenContextData?.entry)) ||
|
|
234
|
+
{};
|
|
234
235
|
|
|
235
236
|
const screenContext =
|
|
236
237
|
(shouldUseNestedContext && screenContextData?.nested?.screen
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.5145183145",
|
|
4
4
|
"description": "Applicaster Zapp React Native ui components for the Quick Brick App",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "jest -w=2",
|
|
9
8
|
"build": "echo skipping hybrid typescript build for now"
|
|
10
9
|
},
|
|
11
10
|
"publishConfig": {
|
|
@@ -32,10 +31,10 @@
|
|
|
32
31
|
"redux-mock-store": "^1.5.3"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@applicaster/applicaster-types": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.5145183145",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.5145183145",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.5145183145",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.5145183145",
|
|
39
38
|
"promise": "^8.3.0",
|
|
40
39
|
"react-router-native": "^5.1.2",
|
|
41
40
|
"url": "^0.11.0",
|