@applicaster/zapp-react-native-ui-components 13.0.6-alpha.1053258310 → 13.0.6-alpha.4144634915
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/Cell/Cell.tsx +4 -11
- package/Components/Focusable/Focusable.tsx +0 -8
- package/Components/PlayerContainer/PlayerContainer.tsx +15 -6
- package/Components/TextInputTv/__tests__/__snapshots__/TextInputTv.test.js.snap +0 -13
- package/Components/TextInputTv/index.tsx +0 -11
- package/Components/VideoModal/ModalAnimation/ModalAnimationContext.tsx +32 -8
- package/Components/VideoModal/PlayerDetails.tsx +24 -2
- package/Components/VideoModal/PlayerWrapper.tsx +26 -142
- package/Components/VideoModal/VideoModal.tsx +3 -17
- package/Components/VideoModal/__tests__/PlayerWrapper.test.tsx +1 -7
- package/Components/VideoModal/__tests__/__snapshots__/PlayerWrapper.test.tsx.snap +44 -240
- package/Components/VideoModal/hooks/index.ts +0 -2
- package/Components/VideoModal/hooks/useModalSize.ts +18 -2
- package/Components/VideoModal/utils.ts +6 -0
- package/package.json +5 -5
- package/Components/VideoModal/hooks/useBackgroundColor.ts +0 -10
package/Components/Cell/Cell.tsx
CHANGED
|
@@ -15,7 +15,6 @@ import { AccessibilityManager } from "@applicaster/zapp-react-native-utils/appUt
|
|
|
15
15
|
import { styles } from "./styles";
|
|
16
16
|
|
|
17
17
|
type Props = {
|
|
18
|
-
dataLength: number;
|
|
19
18
|
item: ZappEntry;
|
|
20
19
|
index: number;
|
|
21
20
|
shouldScrollHorizontally: (arg1: [any]) => boolean | null | undefined;
|
|
@@ -71,8 +70,6 @@ type State = {
|
|
|
71
70
|
};
|
|
72
71
|
|
|
73
72
|
export class CellComponent extends React.Component<Props, State> {
|
|
74
|
-
accessibilityManager: AccessibilityManager;
|
|
75
|
-
|
|
76
73
|
constructor(props) {
|
|
77
74
|
super(props);
|
|
78
75
|
this.onPress = this.onPress.bind(this);
|
|
@@ -86,8 +83,6 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
86
83
|
this.state = {
|
|
87
84
|
hasFocusableInside: props.CellRenderer.hasFocusableInside?.(props.item),
|
|
88
85
|
};
|
|
89
|
-
|
|
90
|
-
this.accessibilityManager = AccessibilityManager.getInstance();
|
|
91
86
|
}
|
|
92
87
|
|
|
93
88
|
setScreenLayout(componentAnchorPointY, screenLayout) {
|
|
@@ -202,7 +197,6 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
202
197
|
const {
|
|
203
198
|
item,
|
|
204
199
|
index,
|
|
205
|
-
dataLength,
|
|
206
200
|
component,
|
|
207
201
|
offsetUpdater,
|
|
208
202
|
preferredFocus,
|
|
@@ -263,22 +257,21 @@ export class CellComponent extends React.Component<Props, State> {
|
|
|
263
257
|
style={styles.baseCell}
|
|
264
258
|
isFocusable={isFocusable}
|
|
265
259
|
skipFocusManagerRegistration={skipFocusManagerRegistration}
|
|
266
|
-
{...this.accessibilityManager.getButtonAccessibilityProps(
|
|
267
|
-
item?.extensions?.accessibility?.label || item?.title
|
|
268
|
-
)}
|
|
269
260
|
>
|
|
270
261
|
{(focused, event) => {
|
|
271
262
|
const isFocused = this.isCellFocused(focused);
|
|
272
263
|
|
|
273
264
|
if (isFocused) {
|
|
265
|
+
const accessibilityManager = AccessibilityManager.getInstance();
|
|
266
|
+
|
|
274
267
|
const accessibilityTitle =
|
|
275
268
|
item?.extensions?.accessibility?.label || item?.title || "";
|
|
276
269
|
|
|
277
270
|
const accessibilityHint =
|
|
278
271
|
item?.extensions?.accessibility?.hint || "";
|
|
279
272
|
|
|
280
|
-
|
|
281
|
-
text:
|
|
273
|
+
accessibilityManager.readText({
|
|
274
|
+
text: `${accessibilityTitle} ${accessibilityHint}`,
|
|
282
275
|
});
|
|
283
276
|
}
|
|
284
277
|
|
|
@@ -5,7 +5,6 @@ import { BaseFocusable } from "../BaseFocusable";
|
|
|
5
5
|
import { focusManager } from "@applicaster/zapp-react-native-utils/appUtils/focusManager";
|
|
6
6
|
import { LONG_KEY_PRESS_TIMEOUT } from "@applicaster/quick-brick-core/const";
|
|
7
7
|
import { withFocusableContext } from "../../Contexts/FocusableGroupContext/withFocusableContext";
|
|
8
|
-
import { AccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager";
|
|
9
8
|
|
|
10
9
|
type Props = {
|
|
11
10
|
initialFocus?: boolean;
|
|
@@ -29,7 +28,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
29
28
|
isGroup: boolean;
|
|
30
29
|
mouse: boolean;
|
|
31
30
|
longPressTimeout = null;
|
|
32
|
-
accessibilityManager: AccessibilityManager;
|
|
33
31
|
|
|
34
32
|
constructor(props) {
|
|
35
33
|
super(props);
|
|
@@ -44,8 +42,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
44
42
|
this.resetLongPressTimeout = this.resetLongPressTimeout.bind(this);
|
|
45
43
|
this.longPress = this.longPress.bind(this);
|
|
46
44
|
this.press = this.press.bind(this);
|
|
47
|
-
|
|
48
|
-
this.accessibilityManager = AccessibilityManager.getInstance();
|
|
49
45
|
}
|
|
50
46
|
|
|
51
47
|
/**
|
|
@@ -132,9 +128,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
132
128
|
const id = this.getId();
|
|
133
129
|
const focusableId = `focusable-${id}`;
|
|
134
130
|
|
|
135
|
-
const accessibilityProps =
|
|
136
|
-
this.accessibilityManager.getWebAccessibilityProps(this.props);
|
|
137
|
-
|
|
138
131
|
return (
|
|
139
132
|
<div
|
|
140
133
|
id={focusableId}
|
|
@@ -147,7 +140,6 @@ class Focusable extends BaseFocusable<Props> {
|
|
|
147
140
|
data-testid={focusableId}
|
|
148
141
|
focused-teststate={focused ? "focused" : "default"}
|
|
149
142
|
style={style}
|
|
150
|
-
{...accessibilityProps}
|
|
151
143
|
>
|
|
152
144
|
{children(focused, { mouse: this.mouse })}
|
|
153
145
|
</div>
|
|
@@ -88,7 +88,7 @@ export const VideoModalMode = {
|
|
|
88
88
|
MAXIMIZED: "MAXIMIZED",
|
|
89
89
|
MINIMIZED: "MINIMIZED",
|
|
90
90
|
FULLSCREEN: "FULLSCREEN",
|
|
91
|
-
};
|
|
91
|
+
} as const;
|
|
92
92
|
|
|
93
93
|
export type PlayNextData = {
|
|
94
94
|
state: PlayNextState;
|
|
@@ -132,7 +132,7 @@ const webStyles = {
|
|
|
132
132
|
playerScreen: {
|
|
133
133
|
flex: 1,
|
|
134
134
|
height: "100vh",
|
|
135
|
-
|
|
135
|
+
backgroundColor: "black",
|
|
136
136
|
},
|
|
137
137
|
playerWrapper: {
|
|
138
138
|
height: "100%",
|
|
@@ -150,7 +150,6 @@ const nativeStyles = {
|
|
|
150
150
|
},
|
|
151
151
|
playerScreen: {
|
|
152
152
|
flex: 1,
|
|
153
|
-
backgroundColor: "black",
|
|
154
153
|
overflow: "hidden",
|
|
155
154
|
},
|
|
156
155
|
playerWrapper: {
|
|
@@ -570,8 +569,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
570
569
|
const isInlineTV = isInlineTVUtil(screenData);
|
|
571
570
|
|
|
572
571
|
const inline =
|
|
573
|
-
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
574
|
-
|
|
572
|
+
[VideoModalMode.MAXIMIZED, VideoModalMode.MINIMIZED].includes(
|
|
573
|
+
mode as any
|
|
574
|
+
) || isInlineTV;
|
|
575
575
|
|
|
576
576
|
const value = React.useMemo(
|
|
577
577
|
() => ({ playerId: state.playerId }),
|
|
@@ -592,7 +592,11 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
592
592
|
);
|
|
593
593
|
}
|
|
594
594
|
|
|
595
|
-
if (
|
|
595
|
+
if (
|
|
596
|
+
screen_background_color &&
|
|
597
|
+
mode !== VideoModalMode.FULLSCREEN &&
|
|
598
|
+
isTV()
|
|
599
|
+
) {
|
|
596
600
|
updatedStyles.playerScreen.backgroundColor = screen_background_color;
|
|
597
601
|
}
|
|
598
602
|
|
|
@@ -622,6 +626,8 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
622
626
|
playNextData,
|
|
623
627
|
};
|
|
624
628
|
|
|
629
|
+
const pointerEventsProp = mode === "MINIMIZED" ? "box-none" : "auto";
|
|
630
|
+
|
|
625
631
|
return (
|
|
626
632
|
<PlayerStateContext.Provider value={value}>
|
|
627
633
|
<PlayerContainerContextProvider
|
|
@@ -642,14 +648,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
642
648
|
preferredFocus
|
|
643
649
|
shouldUsePreferredFocus
|
|
644
650
|
groupId={groupId}
|
|
651
|
+
pointerEvents={pointerEventsProp}
|
|
645
652
|
>
|
|
646
653
|
{/* Video player and components */}
|
|
647
654
|
<View
|
|
648
655
|
style={styles.playerScreen}
|
|
649
656
|
testID={"player-screen-container"}
|
|
657
|
+
pointerEvents={pointerEventsProp}
|
|
650
658
|
>
|
|
651
659
|
{/* Player container */}
|
|
652
660
|
<View
|
|
661
|
+
pointerEvents={pointerEventsProp}
|
|
653
662
|
style={[
|
|
654
663
|
styles.playerWrapper,
|
|
655
664
|
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
@@ -2,19 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<TextInputTv /> renders 1`] = `
|
|
4
4
|
<input
|
|
5
|
-
accessibilityProps={
|
|
6
|
-
{
|
|
7
|
-
"accessibilityHint": "Enter text into Search",
|
|
8
|
-
"accessibilityLabel": "Search",
|
|
9
|
-
"accessibilityRole": "text",
|
|
10
|
-
"accessible": true,
|
|
11
|
-
"aria-description": "Enter text into Search",
|
|
12
|
-
"aria-label": "Search",
|
|
13
|
-
"aria-role": "text",
|
|
14
|
-
"role": "text",
|
|
15
|
-
"tabindex": 0,
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
5
|
testID="TextInput-tv"
|
|
19
6
|
/>
|
|
20
7
|
`;
|
|
@@ -4,7 +4,6 @@ import { Appearance, Platform, StyleSheet, TextInput } from "react-native";
|
|
|
4
4
|
import { isFunction } from "@applicaster/zapp-react-native-utils/functionUtils";
|
|
5
5
|
import { isWeb } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
6
6
|
import { useIsRTL } from "@applicaster/zapp-react-native-utils/localizationUtils";
|
|
7
|
-
import { useAccessibilityManager } from "@applicaster/zapp-react-native-utils/appUtils/accessibilityManager/hooks";
|
|
8
7
|
|
|
9
8
|
type Props = Partial<{
|
|
10
9
|
style: any;
|
|
@@ -43,8 +42,6 @@ function TextInputTV(props: Props, ref) {
|
|
|
43
42
|
const [colorScheme, setColorScheme] = useState(getInitialColorScheme());
|
|
44
43
|
const isRTL = useIsRTL();
|
|
45
44
|
|
|
46
|
-
const accessibilityManager = useAccessibilityManager({});
|
|
47
|
-
|
|
48
45
|
const onColorChange = useCallback(
|
|
49
46
|
({ colorScheme: color }) => {
|
|
50
47
|
if (color !== colorScheme) {
|
|
@@ -156,13 +153,6 @@ function TextInputTV(props: Props, ref) {
|
|
|
156
153
|
])
|
|
157
154
|
)(props);
|
|
158
155
|
|
|
159
|
-
const getAccessibilityProps = () => {
|
|
160
|
-
return {
|
|
161
|
-
accessibilityProps:
|
|
162
|
-
accessibilityManager.getInputAccessibilityProps("Search"),
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
|
|
166
156
|
const inputProps = {
|
|
167
157
|
...getProps(),
|
|
168
158
|
...getStyle(),
|
|
@@ -171,7 +161,6 @@ function TextInputTV(props: Props, ref) {
|
|
|
171
161
|
...getSecureTextEntry(),
|
|
172
162
|
...getOnEndEditing(),
|
|
173
163
|
...getOnPress(),
|
|
174
|
-
...getAccessibilityProps(),
|
|
175
164
|
};
|
|
176
165
|
|
|
177
166
|
if (
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { Animated } from "react-native";
|
|
2
|
+
import { Animated, Dimensions } from "react-native";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
useSafeAreaInsets,
|
|
@@ -11,6 +11,7 @@ import { isLive } from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
|
11
11
|
|
|
12
12
|
import { PROGRESS_BAR_HEIGHT } from "./utils";
|
|
13
13
|
import { useConfiguration } from "../utils";
|
|
14
|
+
import { useIsTabletLandscape } from "@applicaster/zapp-react-native-utils/reactHooks/device/useMemoizedIsTablet";
|
|
14
15
|
|
|
15
16
|
export enum PlayerAnimationStateEnum {
|
|
16
17
|
minimize = "minimize",
|
|
@@ -23,6 +24,7 @@ export enum PlayerAnimationStateEnum {
|
|
|
23
24
|
export type PlayerAnimationStateT = number | PlayerAnimationStateEnum | null;
|
|
24
25
|
|
|
25
26
|
export type ModalAnimationContextT = {
|
|
27
|
+
yTranslate: React.MutableRefObject<Animated.Value | null>;
|
|
26
28
|
isActiveGesture: boolean;
|
|
27
29
|
playerAnimationState: PlayerAnimationStateT;
|
|
28
30
|
setPlayerAnimationState: (value: PlayerAnimationStateT) => void;
|
|
@@ -48,6 +50,7 @@ export type ModalAnimationContextT = {
|
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
53
|
+
yTranslate: React.createRef<Animated.Value | null>(),
|
|
51
54
|
isActiveGesture: false,
|
|
52
55
|
playerAnimationState: null,
|
|
53
56
|
setPlayerAnimationState: () => null,
|
|
@@ -73,6 +76,10 @@ export const ReactContext = React.createContext<ModalAnimationContextT>({
|
|
|
73
76
|
});
|
|
74
77
|
|
|
75
78
|
const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
79
|
+
const yTranslate = React.useRef(
|
|
80
|
+
new Animated.Value(Dimensions.get("window").height)
|
|
81
|
+
);
|
|
82
|
+
|
|
76
83
|
const [playerAnimationState, setPlayerAnimationState] =
|
|
77
84
|
React.useState<PlayerAnimationStateT>(null);
|
|
78
85
|
|
|
@@ -96,13 +103,6 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
96
103
|
setStartComponentsAnimation(false);
|
|
97
104
|
}, []);
|
|
98
105
|
|
|
99
|
-
useEffect(() => {
|
|
100
|
-
// Reset player animation state when video modal is closed
|
|
101
|
-
if (!visible) {
|
|
102
|
-
resetPlayerAnimationState();
|
|
103
|
-
}
|
|
104
|
-
}, [visible, resetPlayerAnimationState]);
|
|
105
|
-
|
|
106
106
|
// Animated values
|
|
107
107
|
const lastScrollY = React.useRef(new Animated.Value(0)).current;
|
|
108
108
|
const dragScrollY = React.useRef(new Animated.Value(0)).current;
|
|
@@ -115,6 +115,29 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
115
115
|
const { bottom: bottomSafeArea } = useSafeAreaInsets();
|
|
116
116
|
const bottomTabBarHeight = useGetBottomTabBarHeight();
|
|
117
117
|
const startComponentsAnimationDistance = Math.round((height * 60) / 100);
|
|
118
|
+
const isTabletLandscape = useIsTabletLandscape();
|
|
119
|
+
const windowDimensions = Dimensions.get("window");
|
|
120
|
+
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
// Reset player animation state when video modal is closed
|
|
123
|
+
if (!visible) {
|
|
124
|
+
resetPlayerAnimationState();
|
|
125
|
+
|
|
126
|
+
if (!isTabletLandscape) {
|
|
127
|
+
// restore to portrait ( in portrait mode height is bigger)
|
|
128
|
+
if (windowDimensions.height > windowDimensions.width) {
|
|
129
|
+
yTranslate.current?.setValue(windowDimensions.height);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
yTranslate.current?.setValue(windowDimensions.height);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}, [
|
|
136
|
+
visible,
|
|
137
|
+
resetPlayerAnimationState,
|
|
138
|
+
windowDimensions.height,
|
|
139
|
+
isTabletLandscape,
|
|
140
|
+
]);
|
|
118
141
|
|
|
119
142
|
React.useEffect(() => {
|
|
120
143
|
if (visible && mode === "MAXIMIZED" && height !== safeAreaFrameHeight) {
|
|
@@ -141,6 +164,7 @@ const Provider = ({ children }: { children: React.ReactNode }) => {
|
|
|
141
164
|
return (
|
|
142
165
|
<ReactContext.Provider
|
|
143
166
|
value={{
|
|
167
|
+
yTranslate,
|
|
144
168
|
startComponentsAnimation,
|
|
145
169
|
setStartComponentsAnimation,
|
|
146
170
|
isActiveGesture: playerAnimationState !== null,
|
|
@@ -11,6 +11,8 @@ import { useTargetScreenData } from "@applicaster/zapp-react-native-utils/reactH
|
|
|
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
13
|
import { isNilOrEmpty } from "@applicaster/zapp-react-native-utils/reactUtils/helpers";
|
|
14
|
+
import { useIsTablet } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
15
|
+
import { useDelayedPlayerDetails } from "./hooks";
|
|
14
16
|
|
|
15
17
|
const { width: SCREEN_WIDTH } = Dimensions.get("screen");
|
|
16
18
|
|
|
@@ -26,6 +28,10 @@ type Props = {
|
|
|
26
28
|
isTabletLandscape?: boolean;
|
|
27
29
|
isAudioPlayer?: boolean;
|
|
28
30
|
isTablet?: boolean;
|
|
31
|
+
inline?: any;
|
|
32
|
+
docked?: boolean;
|
|
33
|
+
isModal?: boolean;
|
|
34
|
+
pip?: boolean;
|
|
29
35
|
};
|
|
30
36
|
|
|
31
37
|
const containerStyle = ({
|
|
@@ -42,8 +48,24 @@ export const PlayerDetails = ({
|
|
|
42
48
|
configuration,
|
|
43
49
|
isTabletLandscape = false,
|
|
44
50
|
isAudioPlayer,
|
|
45
|
-
|
|
51
|
+
inline,
|
|
52
|
+
docked,
|
|
53
|
+
isModal,
|
|
54
|
+
pip,
|
|
46
55
|
}: Props) => {
|
|
56
|
+
const isInlineModal = inline && isModal;
|
|
57
|
+
|
|
58
|
+
// Mounting the PlayerDetails component is a resource-intensive process.
|
|
59
|
+
// Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
|
|
60
|
+
// The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
|
|
61
|
+
// This helps to avoid blocking the rotation and any animations related to the rotation.
|
|
62
|
+
const isShowPlayerDetails = useDelayedPlayerDetails({
|
|
63
|
+
isInline: isInlineModal,
|
|
64
|
+
isDocked: docked,
|
|
65
|
+
isPip: pip,
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const isTablet = useIsTablet();
|
|
47
69
|
const screenData = useTargetScreenData(entry);
|
|
48
70
|
const insets = useSafeAreaInsets();
|
|
49
71
|
|
|
@@ -79,7 +101,7 @@ export const PlayerDetails = ({
|
|
|
79
101
|
}
|
|
80
102
|
}, [isAudioPlayer]);
|
|
81
103
|
|
|
82
|
-
if (isNilOrEmpty(screenData?.ui_components)) {
|
|
104
|
+
if (isNilOrEmpty(screenData?.ui_components) || !isShowPlayerDetails) {
|
|
83
105
|
return null;
|
|
84
106
|
}
|
|
85
107
|
|
|
@@ -9,16 +9,8 @@ import {
|
|
|
9
9
|
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
|
-
import { PlayerDetails } from "./PlayerDetails";
|
|
13
12
|
import { playerDimensionsHack } from "./utils";
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
import {
|
|
17
|
-
AnimatedScrollModal,
|
|
18
|
-
AnimatedVideoPlayerComponent,
|
|
19
|
-
AnimationComponent,
|
|
20
|
-
ComponentAnimationType,
|
|
21
|
-
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
13
|
+
import { getTabletWidth } from "@applicaster/zapp-react-native-utils/playerUtils";
|
|
22
14
|
|
|
23
15
|
const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get("screen");
|
|
24
16
|
|
|
@@ -44,29 +36,15 @@ type Props = {
|
|
|
44
36
|
isModal?: boolean;
|
|
45
37
|
fullscreen?: boolean;
|
|
46
38
|
isTabletPortrait?: boolean;
|
|
47
|
-
children: (playerDimensions: DimensionsT) => React.ReactNode;
|
|
48
39
|
configuration: Configuration;
|
|
40
|
+
|
|
41
|
+
playerContent: (styles: ViewStyle) => React.ReactNode;
|
|
49
42
|
};
|
|
50
43
|
|
|
51
44
|
const defaultStyles = StyleSheet.create({
|
|
52
45
|
playerContainer: { position: "relative", alignSelf: "center", zIndex: 200 },
|
|
53
|
-
playerDetails: { flex: 1, paddingTop: 20 },
|
|
54
|
-
flex: { flex: 1 },
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const orientationStyles = StyleSheet.create({
|
|
58
|
-
landscape: { flexDirection: "row" },
|
|
59
|
-
portrait: { flexDirection: "column" },
|
|
60
46
|
});
|
|
61
47
|
|
|
62
|
-
const directionStyles = (isTabletLandscape: boolean): ViewStyle => {
|
|
63
|
-
if (isTabletLandscape) {
|
|
64
|
-
return orientationStyles.landscape;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return orientationStyles.portrait;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
48
|
const getScreenAspectRatio = () => {
|
|
71
49
|
const longEdge = Math.max(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
72
50
|
const shortEdge = Math.min(SCREEN_WIDTH, SCREEN_HEIGHT);
|
|
@@ -86,51 +64,6 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
|
86
64
|
return ["top"];
|
|
87
65
|
};
|
|
88
66
|
|
|
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
|
-
|
|
107
|
-
const getTabletWidth = (
|
|
108
|
-
configuration: Configuration,
|
|
109
|
-
dimensions: DimensionsT
|
|
110
|
-
) => {
|
|
111
|
-
const tablet_landscape_sidebar_width =
|
|
112
|
-
configuration?.tablet_landscape_sidebar_width;
|
|
113
|
-
|
|
114
|
-
const { width } = dimensions;
|
|
115
|
-
let widthValue = Number(width);
|
|
116
|
-
|
|
117
|
-
if (isPercentage(width)) {
|
|
118
|
-
widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
|
|
122
|
-
|
|
123
|
-
if (tablet_landscape_sidebar_width?.includes("%")) {
|
|
124
|
-
return widthValue * (1 - sidebarWidth / 100);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (Number.isNaN(sidebarWidth)) {
|
|
128
|
-
return widthValue * 0.65;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return widthValue - sidebarWidth;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
67
|
const PlayerWrapperComponent = (props: Props) => {
|
|
135
68
|
const {
|
|
136
69
|
entry,
|
|
@@ -139,35 +72,26 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
139
72
|
inline,
|
|
140
73
|
docked,
|
|
141
74
|
isModal,
|
|
142
|
-
children,
|
|
143
75
|
isTabletPortrait,
|
|
144
76
|
configuration,
|
|
145
|
-
fullscreen,
|
|
146
77
|
pip,
|
|
78
|
+
playerContent,
|
|
147
79
|
} = props;
|
|
148
80
|
|
|
149
81
|
const isTablet = useIsTablet();
|
|
150
82
|
|
|
151
83
|
const isInlineModal = inline && isModal;
|
|
152
84
|
|
|
153
|
-
// Mounting the PlayerDetails component is a resource-intensive process.
|
|
154
|
-
// Therefore, for performance reasons, we mount it with a delay to make the rotation process as smooth as possible.
|
|
155
|
-
// The flow is as follows: the rotation occurs first, and then, after a short delay, we mount the PlayerDetails component.
|
|
156
|
-
// This helps to avoid blocking the rotation and any animations related to the rotation.
|
|
157
|
-
const isShowPlayerDetails = useDelayedPlayerDetails({
|
|
158
|
-
isInline: isInlineModal,
|
|
159
|
-
isDocked: docked,
|
|
160
|
-
isPip: pip,
|
|
161
|
-
});
|
|
162
|
-
|
|
163
85
|
const isTabletLandscape = !isTV() && isTablet && !isTabletPortrait;
|
|
164
86
|
|
|
165
|
-
const tabletWidth = getTabletWidth(
|
|
87
|
+
const tabletWidth = getTabletWidth(
|
|
88
|
+
configuration.tablet_landscape_sidebar_width,
|
|
89
|
+
style
|
|
90
|
+
);
|
|
166
91
|
|
|
167
92
|
const baseDimensions: DimensionsT = React.useMemo(
|
|
168
93
|
() => ({
|
|
169
|
-
width:
|
|
170
|
-
isInlineModal && !docked && isTabletLandscape ? tabletWidth : "100%",
|
|
94
|
+
width: isInlineModal && isTabletLandscape ? tabletWidth : "100%",
|
|
171
95
|
height: undefined,
|
|
172
96
|
}),
|
|
173
97
|
[isInlineModal, tabletWidth, docked]
|
|
@@ -176,7 +100,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
176
100
|
const playerDimensions: DimensionsT = React.useMemo(
|
|
177
101
|
() => ({
|
|
178
102
|
...baseDimensions,
|
|
179
|
-
width:
|
|
103
|
+
width: baseDimensions.width,
|
|
180
104
|
aspectRatio: !isInlineModal && !pip ? getScreenAspectRatio() : 16 / 9,
|
|
181
105
|
}),
|
|
182
106
|
[baseDimensions, isInlineModal, pip]
|
|
@@ -185,8 +109,7 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
185
109
|
const containerDimensions: DimensionsT = React.useMemo(
|
|
186
110
|
() => ({
|
|
187
111
|
...baseDimensions,
|
|
188
|
-
aspectRatio:
|
|
189
|
-
isInlineModal && docked ? undefined : playerDimensions.aspectRatio,
|
|
112
|
+
aspectRatio: playerDimensions.aspectRatio,
|
|
190
113
|
}),
|
|
191
114
|
[baseDimensions, isInlineModal, docked, playerDimensions.aspectRatio]
|
|
192
115
|
);
|
|
@@ -194,68 +117,29 @@ const PlayerWrapperComponent = (props: Props) => {
|
|
|
194
117
|
const WrapperView = React.useMemo(() => (isTV() ? View : SafeAreaView), []);
|
|
195
118
|
|
|
196
119
|
const childrenStyles = React.useMemo(
|
|
197
|
-
() => ({
|
|
120
|
+
() => ({
|
|
121
|
+
...playerDimensions,
|
|
122
|
+
...playerDimensionsHack,
|
|
123
|
+
}),
|
|
198
124
|
[containerDimensions, playerDimensionsHack]
|
|
199
125
|
);
|
|
200
126
|
|
|
201
|
-
const wrapperViewStyle: ViewStyle = {
|
|
202
|
-
backgroundColor:
|
|
203
|
-
isTablet && !fullscreen
|
|
204
|
-
? configuration?.tablet_landscape_player_container_background_color
|
|
205
|
-
: "transparent",
|
|
206
|
-
};
|
|
207
|
-
|
|
208
127
|
return (
|
|
209
128
|
<WrapperView
|
|
210
129
|
edges={getEdges(isTablet, isInlineModal) as readonly Edge[]}
|
|
211
|
-
style={
|
|
130
|
+
style={playerDimensionsHack}
|
|
212
131
|
>
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
132
|
+
<View
|
|
133
|
+
testID={`${entry?.id}-player-container`}
|
|
134
|
+
style={[
|
|
135
|
+
defaultStyles.playerContainer,
|
|
136
|
+
playerDimensionsHack,
|
|
137
|
+
containerDimensions,
|
|
138
|
+
containerStyle,
|
|
139
|
+
]}
|
|
217
140
|
>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
style={[
|
|
221
|
-
defaultStyles.playerContainer,
|
|
222
|
-
containerDimensions,
|
|
223
|
-
containerStyle,
|
|
224
|
-
playerDimensionsHack,
|
|
225
|
-
]}
|
|
226
|
-
>
|
|
227
|
-
<AnimationComponent
|
|
228
|
-
animationType={ComponentAnimationType.moveUpComponent}
|
|
229
|
-
style={isTabletLandscape ? defaultStyles.flex : undefined}
|
|
230
|
-
additionalData={{
|
|
231
|
-
useLayoutMeasure: isTabletLandscape,
|
|
232
|
-
disableAnimatedComponent: !isTabletLandscape,
|
|
233
|
-
resetAnimationValue: isTabletLandscape && docked,
|
|
234
|
-
}}
|
|
235
|
-
>
|
|
236
|
-
<AnimatedVideoPlayerComponent>
|
|
237
|
-
{children(childrenStyles)}
|
|
238
|
-
</AnimatedVideoPlayerComponent>
|
|
239
|
-
</AnimationComponent>
|
|
240
|
-
</View>
|
|
241
|
-
|
|
242
|
-
<AnimatedScrollModal>
|
|
243
|
-
{isShowPlayerDetails ? (
|
|
244
|
-
<AnimationComponent
|
|
245
|
-
animationType={ComponentAnimationType.componentFade}
|
|
246
|
-
style={defaultStyles.flex}
|
|
247
|
-
>
|
|
248
|
-
<PlayerDetails
|
|
249
|
-
configuration={configuration}
|
|
250
|
-
style={defaultStyles.playerDetails}
|
|
251
|
-
entry={entry}
|
|
252
|
-
isTabletLandscape={isTabletLandscape}
|
|
253
|
-
isTablet={isTablet}
|
|
254
|
-
/>
|
|
255
|
-
</AnimationComponent>
|
|
256
|
-
) : null}
|
|
257
|
-
</AnimatedScrollModal>
|
|
258
|
-
</AnimationComponent>
|
|
141
|
+
{playerContent(childrenStyles)}
|
|
142
|
+
</View>
|
|
259
143
|
</WrapperView>
|
|
260
144
|
);
|
|
261
145
|
};
|
|
@@ -17,11 +17,7 @@ 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
|
-
useModalSize,
|
|
22
|
-
useBackgroundColor,
|
|
23
|
-
useInitialPlayerState,
|
|
24
|
-
} from "./hooks";
|
|
20
|
+
import { useModalSize, useInitialPlayerState } from "./hooks";
|
|
25
21
|
|
|
26
22
|
import { APP_EVENTS } from "@applicaster/zapp-react-native-utils/appUtils/events";
|
|
27
23
|
import { PathnameContext } from "@applicaster/zapp-react-native-ui-components/Contexts/PathnameContext";
|
|
@@ -33,8 +29,6 @@ import { ScreenContextProvider } from "../../Contexts/ScreenContext";
|
|
|
33
29
|
import { Spinner } from "../Spinner";
|
|
34
30
|
import { OpaqueLayer } from "./OpaqueLayer";
|
|
35
31
|
|
|
36
|
-
import { AnimatedPlayerModalWrapper } from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
37
|
-
|
|
38
32
|
const LOADER_BACKGROUND_COLOR = "rgba(64,64,64,0.5)";
|
|
39
33
|
|
|
40
34
|
const styles = StyleSheet.create({
|
|
@@ -65,7 +59,6 @@ const VideoModalComponent = () => {
|
|
|
65
59
|
|
|
66
60
|
const modalSize = useModalSize();
|
|
67
61
|
const isFirstRender = useIsInitialRender();
|
|
68
|
-
const backgroundColor = useBackgroundColor();
|
|
69
62
|
|
|
70
63
|
const {
|
|
71
64
|
closeVideoModal,
|
|
@@ -145,20 +138,13 @@ const VideoModalComponent = () => {
|
|
|
145
138
|
{mode === "FULLSCREEN" && <OpaqueLayer />}
|
|
146
139
|
|
|
147
140
|
{itemIdHooksFinished === item?.id ? (
|
|
148
|
-
<
|
|
149
|
-
style={[
|
|
150
|
-
styles.container,
|
|
151
|
-
{
|
|
152
|
-
backgroundColor,
|
|
153
|
-
},
|
|
154
|
-
]}
|
|
155
|
-
>
|
|
141
|
+
<View pointerEvents="box-none" style={styles.container}>
|
|
156
142
|
<HandlePlayable
|
|
157
143
|
item={item}
|
|
158
144
|
isModal={mode !== "PIP"}
|
|
159
145
|
mode={mode}
|
|
160
146
|
/>
|
|
161
|
-
</
|
|
147
|
+
</View>
|
|
162
148
|
) : (
|
|
163
149
|
<View style={styles.loaderContainer}>
|
|
164
150
|
<Spinner />
|
|
@@ -13,6 +13,7 @@ const props = {
|
|
|
13
13
|
tablet_landscape_sidebar_width: "35%",
|
|
14
14
|
tablet_landscape_player_container_background_color: "red",
|
|
15
15
|
},
|
|
16
|
+
playerContent: jest.fn(() => <></>),
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
const mockUseIsDeviceTablet = jest.fn();
|
|
@@ -122,13 +123,6 @@ describe("PlayerWrapper", () => {
|
|
|
122
123
|
</PlayerWrapper>
|
|
123
124
|
);
|
|
124
125
|
|
|
125
|
-
const expectDimensions = {
|
|
126
|
-
...dimensions,
|
|
127
|
-
width: undefined,
|
|
128
|
-
aspectRatio: 16 / 9,
|
|
129
|
-
};
|
|
130
|
-
|
|
131
126
|
expect(element).toMatchSnapshot();
|
|
132
|
-
expect(children).toHaveBeenCalledWith(expectDimensions);
|
|
133
127
|
});
|
|
134
128
|
});
|
|
@@ -21,87 +21,27 @@ exports[`PlayerWrapper renders inline 1`] = `
|
|
|
21
21
|
"top": "additive",
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
style={
|
|
25
|
-
[
|
|
26
|
-
{
|
|
27
|
-
"backgroundColor": "transparent",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"height": 800,
|
|
31
|
-
"width": 300,
|
|
32
|
-
},
|
|
33
|
-
{},
|
|
34
|
-
]
|
|
35
|
-
}
|
|
24
|
+
style={{}}
|
|
36
25
|
>
|
|
37
26
|
<View
|
|
38
|
-
additionalData={
|
|
39
|
-
{
|
|
40
|
-
"saveArea": true,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
animationType="moveUpComponent"
|
|
44
27
|
style={
|
|
45
28
|
[
|
|
46
29
|
{
|
|
47
|
-
"
|
|
30
|
+
"alignSelf": "center",
|
|
31
|
+
"position": "relative",
|
|
32
|
+
"zIndex": 200,
|
|
48
33
|
},
|
|
34
|
+
{},
|
|
49
35
|
{
|
|
50
|
-
"
|
|
36
|
+
"aspectRatio": 1.7777777777777777,
|
|
37
|
+
"height": undefined,
|
|
38
|
+
"width": "100%",
|
|
51
39
|
},
|
|
40
|
+
{},
|
|
52
41
|
]
|
|
53
42
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
style={
|
|
57
|
-
[
|
|
58
|
-
{
|
|
59
|
-
"alignSelf": "center",
|
|
60
|
-
"position": "relative",
|
|
61
|
-
"zIndex": 200,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"aspectRatio": 1.7777777777777777,
|
|
65
|
-
"height": undefined,
|
|
66
|
-
"width": "100%",
|
|
67
|
-
},
|
|
68
|
-
{},
|
|
69
|
-
{},
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
testID="test-player-container"
|
|
73
|
-
/>
|
|
74
|
-
<View
|
|
75
|
-
animationType="componentFade"
|
|
76
|
-
style={
|
|
77
|
-
{
|
|
78
|
-
"flex": 1,
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
>
|
|
82
|
-
<View
|
|
83
|
-
configuration={
|
|
84
|
-
{
|
|
85
|
-
"tablet_landscape_player_container_background_color": "red",
|
|
86
|
-
"tablet_landscape_sidebar_width": "35%",
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
entry={
|
|
90
|
-
{
|
|
91
|
-
"id": "test",
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
isTablet={false}
|
|
95
|
-
isTabletLandscape={false}
|
|
96
|
-
style={
|
|
97
|
-
{
|
|
98
|
-
"flex": 1,
|
|
99
|
-
"paddingTop": 20,
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
/>
|
|
103
|
-
</View>
|
|
104
|
-
</View>
|
|
43
|
+
testID="test-player-container"
|
|
44
|
+
/>
|
|
105
45
|
</RNCSafeAreaView>
|
|
106
46
|
</RNCSafeAreaProvider>
|
|
107
47
|
`;
|
|
@@ -127,57 +67,27 @@ exports[`PlayerWrapper renders inline and docked 1`] = `
|
|
|
127
67
|
"top": "additive",
|
|
128
68
|
}
|
|
129
69
|
}
|
|
130
|
-
style={
|
|
131
|
-
[
|
|
132
|
-
{
|
|
133
|
-
"backgroundColor": "transparent",
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
"height": undefined,
|
|
137
|
-
"width": 300,
|
|
138
|
-
},
|
|
139
|
-
{},
|
|
140
|
-
]
|
|
141
|
-
}
|
|
70
|
+
style={{}}
|
|
142
71
|
>
|
|
143
72
|
<View
|
|
144
|
-
additionalData={
|
|
145
|
-
{
|
|
146
|
-
"saveArea": true,
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
animationType="moveUpComponent"
|
|
150
73
|
style={
|
|
151
74
|
[
|
|
152
75
|
{
|
|
153
|
-
"
|
|
76
|
+
"alignSelf": "center",
|
|
77
|
+
"position": "relative",
|
|
78
|
+
"zIndex": 200,
|
|
154
79
|
},
|
|
80
|
+
{},
|
|
155
81
|
{
|
|
156
|
-
"
|
|
82
|
+
"aspectRatio": 1.7777777777777777,
|
|
83
|
+
"height": undefined,
|
|
84
|
+
"width": "100%",
|
|
157
85
|
},
|
|
86
|
+
{},
|
|
158
87
|
]
|
|
159
88
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
style={
|
|
163
|
-
[
|
|
164
|
-
{
|
|
165
|
-
"alignSelf": "center",
|
|
166
|
-
"position": "relative",
|
|
167
|
-
"zIndex": 200,
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
"aspectRatio": undefined,
|
|
171
|
-
"height": undefined,
|
|
172
|
-
"width": "100%",
|
|
173
|
-
},
|
|
174
|
-
{},
|
|
175
|
-
{},
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
testID="test-player-container"
|
|
179
|
-
/>
|
|
180
|
-
</View>
|
|
89
|
+
testID="test-player-container"
|
|
90
|
+
/>
|
|
181
91
|
</RNCSafeAreaView>
|
|
182
92
|
</RNCSafeAreaProvider>
|
|
183
93
|
`;
|
|
@@ -203,103 +113,27 @@ exports[`PlayerWrapper renders inline on tablet in landscape orientation 1`] = `
|
|
|
203
113
|
"top": "additive",
|
|
204
114
|
}
|
|
205
115
|
}
|
|
206
|
-
style={
|
|
207
|
-
[
|
|
208
|
-
{
|
|
209
|
-
"backgroundColor": "red",
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
"height": 800,
|
|
213
|
-
"width": 300,
|
|
214
|
-
},
|
|
215
|
-
{},
|
|
216
|
-
]
|
|
217
|
-
}
|
|
116
|
+
style={{}}
|
|
218
117
|
>
|
|
219
118
|
<View
|
|
220
|
-
additionalData={
|
|
221
|
-
{
|
|
222
|
-
"saveArea": true,
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
animationType="moveUpComponent"
|
|
226
119
|
style={
|
|
227
120
|
[
|
|
228
121
|
{
|
|
229
|
-
"
|
|
122
|
+
"alignSelf": "center",
|
|
123
|
+
"position": "relative",
|
|
124
|
+
"zIndex": 200,
|
|
230
125
|
},
|
|
126
|
+
{},
|
|
231
127
|
{
|
|
232
|
-
"
|
|
128
|
+
"aspectRatio": 1.7777777777777777,
|
|
129
|
+
"height": undefined,
|
|
130
|
+
"width": 195,
|
|
233
131
|
},
|
|
132
|
+
{},
|
|
234
133
|
]
|
|
235
134
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
style={
|
|
239
|
-
[
|
|
240
|
-
{
|
|
241
|
-
"alignSelf": "center",
|
|
242
|
-
"position": "relative",
|
|
243
|
-
"zIndex": 200,
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"aspectRatio": 1.7777777777777777,
|
|
247
|
-
"height": undefined,
|
|
248
|
-
"width": 195,
|
|
249
|
-
},
|
|
250
|
-
{},
|
|
251
|
-
{},
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
testID="test-player-container"
|
|
255
|
-
>
|
|
256
|
-
<View
|
|
257
|
-
additionalData={
|
|
258
|
-
{
|
|
259
|
-
"disableAnimatedComponent": false,
|
|
260
|
-
"resetAnimationValue": undefined,
|
|
261
|
-
"useLayoutMeasure": true,
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
animationType="moveUpComponent"
|
|
265
|
-
style={
|
|
266
|
-
{
|
|
267
|
-
"flex": 1,
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/>
|
|
271
|
-
</View>
|
|
272
|
-
<View
|
|
273
|
-
animationType="componentFade"
|
|
274
|
-
style={
|
|
275
|
-
{
|
|
276
|
-
"flex": 1,
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
>
|
|
280
|
-
<View
|
|
281
|
-
configuration={
|
|
282
|
-
{
|
|
283
|
-
"tablet_landscape_player_container_background_color": "red",
|
|
284
|
-
"tablet_landscape_sidebar_width": "35%",
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
entry={
|
|
288
|
-
{
|
|
289
|
-
"id": "test",
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
isTablet={true}
|
|
293
|
-
isTabletLandscape={true}
|
|
294
|
-
style={
|
|
295
|
-
{
|
|
296
|
-
"flex": 1,
|
|
297
|
-
"paddingTop": 20,
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
/>
|
|
301
|
-
</View>
|
|
302
|
-
</View>
|
|
135
|
+
testID="test-player-container"
|
|
136
|
+
/>
|
|
303
137
|
</RNCSafeAreaView>
|
|
304
138
|
</RNCSafeAreaProvider>
|
|
305
139
|
`;
|
|
@@ -325,57 +159,27 @@ exports[`PlayerWrapper renders properly 1`] = `
|
|
|
325
159
|
"top": "additive",
|
|
326
160
|
}
|
|
327
161
|
}
|
|
328
|
-
style={
|
|
329
|
-
[
|
|
330
|
-
{
|
|
331
|
-
"backgroundColor": "transparent",
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"height": 800,
|
|
335
|
-
"width": 300,
|
|
336
|
-
},
|
|
337
|
-
{},
|
|
338
|
-
]
|
|
339
|
-
}
|
|
162
|
+
style={{}}
|
|
340
163
|
>
|
|
341
164
|
<View
|
|
342
|
-
additionalData={
|
|
343
|
-
{
|
|
344
|
-
"saveArea": true,
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
animationType="moveUpComponent"
|
|
348
165
|
style={
|
|
349
166
|
[
|
|
350
167
|
{
|
|
351
|
-
"
|
|
168
|
+
"alignSelf": "center",
|
|
169
|
+
"position": "relative",
|
|
170
|
+
"zIndex": 200,
|
|
352
171
|
},
|
|
172
|
+
{},
|
|
353
173
|
{
|
|
354
|
-
"
|
|
174
|
+
"aspectRatio": 1.7786666666666666,
|
|
175
|
+
"height": undefined,
|
|
176
|
+
"width": "100%",
|
|
355
177
|
},
|
|
178
|
+
{},
|
|
356
179
|
]
|
|
357
180
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
style={
|
|
361
|
-
[
|
|
362
|
-
{
|
|
363
|
-
"alignSelf": "center",
|
|
364
|
-
"position": "relative",
|
|
365
|
-
"zIndex": 200,
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
"aspectRatio": 1.7786666666666666,
|
|
369
|
-
"height": undefined,
|
|
370
|
-
"width": "100%",
|
|
371
|
-
},
|
|
372
|
-
{},
|
|
373
|
-
{},
|
|
374
|
-
]
|
|
375
|
-
}
|
|
376
|
-
testID="test-player-container"
|
|
377
|
-
/>
|
|
378
|
-
</View>
|
|
181
|
+
testID="test-player-container"
|
|
182
|
+
/>
|
|
379
183
|
</RNCSafeAreaView>
|
|
380
184
|
</RNCSafeAreaProvider>
|
|
381
185
|
`;
|
|
@@ -9,6 +9,12 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import { getXray } from "@applicaster/zapp-react-native-utils/logger";
|
|
11
11
|
import { useSafeAreaFrame } from "react-native-safe-area-context";
|
|
12
|
+
import {
|
|
13
|
+
isAndroidPlatform,
|
|
14
|
+
isAndroidVersionAtLeast,
|
|
15
|
+
} from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
16
|
+
import { StatusBar } from "react-native";
|
|
17
|
+
import { isAndroidTablet } from "@applicaster/zapp-react-native-utils/reactHooks/layout/isTablet";
|
|
12
18
|
|
|
13
19
|
const { Logger } = getXray();
|
|
14
20
|
|
|
@@ -27,12 +33,17 @@ const MODAL_SIZE_FOR_LANDSCAPE: Size = {
|
|
|
27
33
|
height: "100%",
|
|
28
34
|
};
|
|
29
35
|
|
|
36
|
+
const isOldAndroidDevice =
|
|
37
|
+
isAndroidPlatform() && !isAndroidVersionAtLeast(35) && !isAndroidTablet();
|
|
38
|
+
|
|
30
39
|
export const useModalSize = (): Size => {
|
|
31
40
|
const frame = useSafeAreaFrame();
|
|
32
41
|
|
|
33
42
|
const [modalSize, setModalSize] = React.useState<Size>({
|
|
34
43
|
width: frame.width,
|
|
35
|
-
height:
|
|
44
|
+
height: isOldAndroidDevice
|
|
45
|
+
? frame.height + StatusBar.currentHeight
|
|
46
|
+
: frame.height,
|
|
36
47
|
});
|
|
37
48
|
|
|
38
49
|
const setNewModalSize = React.useCallback((newSize, log) => {
|
|
@@ -44,7 +55,12 @@ export const useModalSize = (): Size => {
|
|
|
44
55
|
return oldSize;
|
|
45
56
|
}
|
|
46
57
|
|
|
47
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
width: newSize.width,
|
|
60
|
+
height: isOldAndroidDevice
|
|
61
|
+
? newSize.height + StatusBar.currentHeight
|
|
62
|
+
: newSize.height,
|
|
63
|
+
};
|
|
48
64
|
});
|
|
49
65
|
|
|
50
66
|
logger.debug({
|
|
@@ -34,6 +34,9 @@ export const useConfiguration = () => {
|
|
|
34
34
|
minimised_height = 0,
|
|
35
35
|
minimised_height_tablet = 0,
|
|
36
36
|
modal_background_color,
|
|
37
|
+
tablet_landscape_player_container_background_color,
|
|
38
|
+
screen_background_color,
|
|
39
|
+
audio_player_background_color,
|
|
37
40
|
} = config;
|
|
38
41
|
|
|
39
42
|
const minimisedHeight = useIsTablet()
|
|
@@ -43,6 +46,9 @@ export const useConfiguration = () => {
|
|
|
43
46
|
return {
|
|
44
47
|
minimised_height: Number(minimisedHeight),
|
|
45
48
|
modal_background_color,
|
|
49
|
+
tablet_landscape_player_container_background_color,
|
|
50
|
+
audio_player_background_color,
|
|
51
|
+
screen_background_color,
|
|
46
52
|
};
|
|
47
53
|
};
|
|
48
54
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.6-alpha.
|
|
3
|
+
"version": "13.0.6-alpha.4144634915",
|
|
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",
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"redux-mock-store": "^1.5.3"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@applicaster/applicaster-types": "13.0.6-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "13.0.6-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "13.0.6-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.6-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.6-alpha.4144634915",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.6-alpha.4144634915",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.6-alpha.4144634915",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.6-alpha.4144634915",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"react-router-native": "^5.1.2",
|
|
40
40
|
"url": "^0.11.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
2
|
-
import { useConfiguration } from "../utils";
|
|
3
|
-
|
|
4
|
-
export const useBackgroundColor = (): string => {
|
|
5
|
-
const { modal_background_color: modalBackgroundColor } = useConfiguration();
|
|
6
|
-
|
|
7
|
-
const theme = useTheme<BaseThemePropertiesMobile>();
|
|
8
|
-
|
|
9
|
-
return modalBackgroundColor || theme?.status_background_color;
|
|
10
|
-
};
|