@applicaster/zapp-react-native-ui-components 13.0.0-alpha.6234681660 → 13.0.0-alpha.6400875052
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/HandlePlayable/HandlePlayable.tsx +10 -3
- package/Components/ModalComponent/BottomSheetModalContent.tsx +38 -15
- package/Components/ModalComponent/Button/Item.tsx +1 -0
- package/Components/ModalComponent/Button/index.tsx +29 -42
- package/Components/ModalComponent/utils.ts +52 -4
- package/Components/PlayerContainer/PlayerContainer.tsx +11 -1
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +1 -3
- package/Components/VideoModal/ModalAnimation/AnimationComponent.tsx +13 -17
- package/Components/VideoModal/ModalAnimation/index.ts +0 -2
- package/Components/VideoModal/ModalAnimation/utils.ts +0 -36
- package/Components/VideoModal/PlayerDetails.tsx +4 -4
- package/Components/VideoModal/PlayerWrapper.tsx +26 -3
- package/Components/VideoModal/VideoModal.tsx +19 -4
- package/Components/ZappUIComponent/index.tsx +4 -4
- package/package.json +5 -5
- package/Components/VideoModal/ModalAnimation/__tests__/getMoveUpValue.test.ts +0 -108
- package/Components/VideoModal/ModalAnimation/const.ts +0 -5
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { BufferAnimation } from "../PlayerContainer/BufferAnimation";
|
|
14
14
|
import { PlayerContainer } from "../PlayerContainer";
|
|
15
|
+
import { useModalSize } from "../VideoModal/hooks";
|
|
15
16
|
|
|
16
17
|
type Props = {
|
|
17
18
|
item: ZappEntry;
|
|
@@ -136,12 +137,18 @@ export function HandlePlayable({
|
|
|
136
137
|
|
|
137
138
|
const { width: screenWidth, height: screenHeight } = useDimensions("window");
|
|
138
139
|
|
|
140
|
+
const modalSize = useModalSize();
|
|
141
|
+
|
|
139
142
|
const style = React.useMemo(
|
|
140
143
|
() => ({
|
|
141
|
-
width: isModal ?
|
|
142
|
-
height: isModal
|
|
144
|
+
width: isModal ? modalSize.width : mode === "PIP" ? "100%" : screenWidth,
|
|
145
|
+
height: isModal
|
|
146
|
+
? modalSize.height
|
|
147
|
+
: mode === "PIP"
|
|
148
|
+
? "100%"
|
|
149
|
+
: screenHeight,
|
|
143
150
|
}),
|
|
144
|
-
[screenWidth, screenHeight, isModal, mode]
|
|
151
|
+
[screenWidth, screenHeight, modalSize, isModal, mode]
|
|
145
152
|
);
|
|
146
153
|
|
|
147
154
|
const Component = playable?.Component;
|
|
@@ -10,13 +10,11 @@ import { Button } from "./Button";
|
|
|
10
10
|
import { ItemIconProps } from "./Button/ItemIcon";
|
|
11
11
|
import { ItemProps } from "./Button/Item";
|
|
12
12
|
import { ItemLabelProps } from "./Button/ItemLabel";
|
|
13
|
-
import {
|
|
14
|
-
defaultItemIconProps,
|
|
15
|
-
defaultItemLabelProps,
|
|
16
|
-
defaultItemProps,
|
|
17
|
-
} from "./utils";
|
|
13
|
+
import { getItemIconProps, getItemLabelProps, getItemProps } from "./utils";
|
|
18
14
|
import { useTheme } from "@applicaster/zapp-react-native-utils/theme";
|
|
19
15
|
|
|
16
|
+
import type { PluginConfiguration } from "./";
|
|
17
|
+
|
|
20
18
|
import { ModalHeader } from "./Header";
|
|
21
19
|
|
|
22
20
|
type ModalComponentProps = {
|
|
@@ -30,6 +28,20 @@ type ModalComponentProps = {
|
|
|
30
28
|
maxHeight?: number;
|
|
31
29
|
dismiss: () => void;
|
|
32
30
|
buttonComponent?: React.ComponentType;
|
|
31
|
+
iconProps?: ItemIconProps | ((theme: PluginConfiguration) => ItemIconProps);
|
|
32
|
+
itemProps?:
|
|
33
|
+
| ItemProps
|
|
34
|
+
| ((theme: PluginConfiguration, width: number) => ItemProps);
|
|
35
|
+
labelProps?:
|
|
36
|
+
| ItemLabelProps
|
|
37
|
+
| ((theme: PluginConfiguration, width: number) => ItemLabelProps);
|
|
38
|
+
getSelectedItemIcon: (
|
|
39
|
+
theme: PluginConfiguration
|
|
40
|
+
) => ItemIconProps["asset"] | null;
|
|
41
|
+
getDefaultItemIcon: (
|
|
42
|
+
theme: PluginConfiguration
|
|
43
|
+
) => ItemIconProps["asset"] | null;
|
|
44
|
+
iconPlacement?: "left" | "right";
|
|
33
45
|
};
|
|
34
46
|
|
|
35
47
|
export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
@@ -43,6 +55,10 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
|
43
55
|
summary,
|
|
44
56
|
title,
|
|
45
57
|
buttonComponent: ButtonComponent = Button,
|
|
58
|
+
getSelectedItemIcon = (theme) =>
|
|
59
|
+
theme.modal_bottom_sheet_item_selected_icon,
|
|
60
|
+
getDefaultItemIcon = () => null,
|
|
61
|
+
iconPlacement,
|
|
46
62
|
} = props;
|
|
47
63
|
|
|
48
64
|
const [headerHeight, setHeaderHeight] = useState(0);
|
|
@@ -64,21 +80,24 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
|
64
80
|
}, [currentRoute]);
|
|
65
81
|
|
|
66
82
|
const iconBaseProps = useMemo<ItemIconProps>(() => {
|
|
67
|
-
return
|
|
68
|
-
}, [theme]);
|
|
83
|
+
return getItemIconProps(theme, props.iconProps);
|
|
84
|
+
}, [theme, props.iconProps]);
|
|
69
85
|
|
|
70
86
|
const itemBaseProps = useMemo<ItemProps>(() => {
|
|
71
|
-
return
|
|
72
|
-
}, [theme, props.width]);
|
|
87
|
+
return getItemProps(theme, props.width, props.itemProps);
|
|
88
|
+
}, [theme, props.width, props.itemProps]);
|
|
73
89
|
|
|
74
90
|
const labelBaseProps = useMemo<ItemLabelProps>(() => {
|
|
75
|
-
return
|
|
76
|
-
}, [theme, props.width]);
|
|
91
|
+
return getItemLabelProps(theme, props.width, props.labelProps);
|
|
92
|
+
}, [theme, props.width, props.labelProps]);
|
|
77
93
|
|
|
78
|
-
const handlePress = (
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
const handlePress = useCallback(
|
|
95
|
+
(item: any) => {
|
|
96
|
+
onPress(item);
|
|
97
|
+
dismiss();
|
|
98
|
+
},
|
|
99
|
+
[onPress, dismiss]
|
|
100
|
+
);
|
|
82
101
|
|
|
83
102
|
return (
|
|
84
103
|
<View
|
|
@@ -110,9 +129,13 @@ export function BottomSheetModalContent(props: ModalComponentProps) {
|
|
|
110
129
|
selectedItem={current_selection}
|
|
111
130
|
item={item}
|
|
112
131
|
onPress={handlePress}
|
|
132
|
+
label={theme[item?.label] ?? item?.label}
|
|
113
133
|
iconBaseProps={iconBaseProps}
|
|
114
134
|
itemBaseProps={itemBaseProps}
|
|
115
135
|
labelBaseProps={labelBaseProps}
|
|
136
|
+
selectedItemIcon={getSelectedItemIcon(theme)}
|
|
137
|
+
defaultItemIcon={getDefaultItemIcon(theme)}
|
|
138
|
+
iconPlacement={iconPlacement}
|
|
116
139
|
/>
|
|
117
140
|
))}
|
|
118
141
|
</ScrollView>
|
|
@@ -3,7 +3,6 @@ import { StyleSheet, TouchableOpacity, View } from "react-native";
|
|
|
3
3
|
import { Item, ItemProps } from "./Item";
|
|
4
4
|
import { ItemIcon, ItemIconProps } from "./ItemIcon";
|
|
5
5
|
import { ItemLabel, ItemLabelProps } from "./ItemLabel";
|
|
6
|
-
import * as assets from "./assets";
|
|
7
6
|
import { defaultSelectedAsset } from "./assets";
|
|
8
7
|
|
|
9
8
|
type ButtonProps = {
|
|
@@ -17,6 +16,9 @@ type ButtonProps = {
|
|
|
17
16
|
labelBaseProps?: ItemLabelProps;
|
|
18
17
|
disabled?: boolean;
|
|
19
18
|
label?: string | Record<string, string>;
|
|
19
|
+
iconPlacement?: "left" | "right";
|
|
20
|
+
selectedItemIcon?: ItemIconProps["asset"];
|
|
21
|
+
defaultItemIcon?: ItemIconProps["asset"];
|
|
20
22
|
};
|
|
21
23
|
|
|
22
24
|
const styles = StyleSheet.create({
|
|
@@ -33,52 +35,32 @@ export function Button({
|
|
|
33
35
|
configuration,
|
|
34
36
|
width,
|
|
35
37
|
iconBaseProps,
|
|
36
|
-
itemBaseProps,
|
|
38
|
+
itemBaseProps: itemProps,
|
|
37
39
|
labelBaseProps,
|
|
38
40
|
label,
|
|
41
|
+
iconPlacement = "left",
|
|
42
|
+
defaultItemIcon,
|
|
43
|
+
selectedItemIcon,
|
|
39
44
|
disabled = false,
|
|
40
45
|
}: ButtonProps) {
|
|
41
46
|
const [focused, setFocused] = useState(false);
|
|
42
47
|
|
|
43
|
-
const selected =
|
|
44
|
-
() => selectedItem && item.value === selectedItem?.value,
|
|
45
|
-
[selectedItem, selectedItem]
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
const itemProps = useMemo<ItemProps>(
|
|
49
|
-
() => ({
|
|
50
|
-
...itemBaseProps,
|
|
51
|
-
width,
|
|
52
|
-
}),
|
|
53
|
-
[configuration, width]
|
|
54
|
-
);
|
|
48
|
+
const selected = selectedItem && item.value === selectedItem?.value;
|
|
55
49
|
|
|
56
|
-
const
|
|
57
|
-
() =>
|
|
58
|
-
|
|
59
|
-
asset: configuration[item.asset] ?? assets[item.asset] ?? item.asset,
|
|
60
|
-
}),
|
|
61
|
-
[configuration, item.asset]
|
|
50
|
+
const itemIconPropsAssets = useMemo<ItemIconProps["asset"]>(
|
|
51
|
+
() => configuration[item.asset] ?? item.asset ?? defaultItemIcon,
|
|
52
|
+
[item.asset, defaultItemIcon]
|
|
62
53
|
);
|
|
63
54
|
|
|
64
|
-
const
|
|
65
|
-
() =>
|
|
66
|
-
|
|
67
|
-
asset:
|
|
68
|
-
configuration["modal_bottom_sheet_item_selected_icon"] ||
|
|
69
|
-
defaultSelectedAsset,
|
|
70
|
-
marginRight: 10,
|
|
71
|
-
}),
|
|
72
|
-
[configuration]
|
|
55
|
+
const selectedItemIconPropsAssets = useMemo<ItemIconProps["asset"]>(
|
|
56
|
+
() => selectedItemIcon || defaultSelectedAsset,
|
|
57
|
+
[selectedItemIcon]
|
|
73
58
|
);
|
|
74
59
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
...
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
[configuration, item?.label]
|
|
81
|
-
);
|
|
60
|
+
const renderItemIcon =
|
|
61
|
+
itemIconPropsAssets && itemIconPropsAssets.length > 0 ? (
|
|
62
|
+
<ItemIcon {...iconBaseProps} asset={itemIconPropsAssets} />
|
|
63
|
+
) : null;
|
|
82
64
|
|
|
83
65
|
if (disabled) return null;
|
|
84
66
|
|
|
@@ -92,18 +74,23 @@ export function Button({
|
|
|
92
74
|
>
|
|
93
75
|
<Item {...itemProps} focused={focused} selected={selected}>
|
|
94
76
|
<View style={styles.label_icon_container}>
|
|
95
|
-
{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{itemLabelProps.label ? (
|
|
77
|
+
{iconPlacement === "left" && renderItemIcon}
|
|
78
|
+
|
|
79
|
+
{label ? (
|
|
99
80
|
<ItemLabel
|
|
100
|
-
{...
|
|
81
|
+
{...labelBaseProps}
|
|
82
|
+
label={label ?? null}
|
|
101
83
|
focused={focused}
|
|
102
84
|
selected={selected}
|
|
103
85
|
/>
|
|
104
86
|
) : null}
|
|
105
87
|
</View>
|
|
106
|
-
|
|
88
|
+
|
|
89
|
+
{selected ? (
|
|
90
|
+
<ItemIcon {...iconBaseProps} asset={selectedItemIconPropsAssets} />
|
|
91
|
+
) : (
|
|
92
|
+
iconPlacement === "right" && renderItemIcon
|
|
93
|
+
)}
|
|
107
94
|
</Item>
|
|
108
95
|
</TouchableOpacity>
|
|
109
96
|
</View>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { platformSelect } from "@applicaster/zapp-react-native-utils/reactUtils";
|
|
2
|
-
import { PluginConfiguration } from "./
|
|
2
|
+
import { PluginConfiguration } from "./";
|
|
3
|
+
import { ItemIconProps } from "./Button/ItemIcon";
|
|
4
|
+
import { ItemLabelProps } from "./Button/ItemLabel";
|
|
5
|
+
import { ItemProps } from "./Button/Item";
|
|
3
6
|
|
|
4
7
|
export function defaultItemProps(
|
|
5
8
|
config: PluginConfiguration,
|
|
6
9
|
maxWidth: number
|
|
7
|
-
) {
|
|
10
|
+
): ItemProps {
|
|
8
11
|
const {
|
|
9
12
|
modal_bottom_sheet_item_background_color,
|
|
10
13
|
modal_bottom_sheet_item_focus_background_color,
|
|
@@ -43,7 +46,7 @@ export function defaultItemProps(
|
|
|
43
46
|
export function defaultItemLabelProps(
|
|
44
47
|
config: PluginConfiguration,
|
|
45
48
|
sheetWidth: number
|
|
46
|
-
) {
|
|
49
|
+
): ItemLabelProps {
|
|
47
50
|
const {
|
|
48
51
|
modal_bottom_sheet_item_label_android_letter_spacing,
|
|
49
52
|
modal_bottom_sheet_item_label_ios_letter_spacing,
|
|
@@ -103,7 +106,9 @@ export function defaultItemLabelProps(
|
|
|
103
106
|
};
|
|
104
107
|
}
|
|
105
108
|
|
|
106
|
-
export function defaultItemIconProps(
|
|
109
|
+
export function defaultItemIconProps(
|
|
110
|
+
config: PluginConfiguration
|
|
111
|
+
): ItemIconProps {
|
|
107
112
|
const {
|
|
108
113
|
modal_bottom_sheet_item_icon_height,
|
|
109
114
|
modal_bottom_sheet_item_icon_width,
|
|
@@ -124,3 +129,46 @@ export function defaultItemIconProps(config: PluginConfiguration) {
|
|
|
124
129
|
marginRight: modal_bottom_sheet_item_icon_margin_right,
|
|
125
130
|
};
|
|
126
131
|
}
|
|
132
|
+
|
|
133
|
+
export function getItemIconProps(
|
|
134
|
+
theme: PluginConfiguration,
|
|
135
|
+
iconProps?: ((theme: PluginConfiguration) => ItemIconProps) | ItemIconProps
|
|
136
|
+
) {
|
|
137
|
+
if (iconProps) {
|
|
138
|
+
return typeof iconProps === "function" ? iconProps(theme) : iconProps;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return defaultItemIconProps(theme);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function getItemLabelProps(
|
|
145
|
+
theme: PluginConfiguration,
|
|
146
|
+
width: number,
|
|
147
|
+
labelProps?:
|
|
148
|
+
| ((theme: PluginConfiguration, width: number) => ItemLabelProps)
|
|
149
|
+
| ItemLabelProps
|
|
150
|
+
) {
|
|
151
|
+
if (labelProps) {
|
|
152
|
+
return typeof labelProps === "function"
|
|
153
|
+
? labelProps(theme, width)
|
|
154
|
+
: labelProps;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return defaultItemLabelProps(theme, width);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function getItemProps(
|
|
161
|
+
theme: PluginConfiguration,
|
|
162
|
+
width: number,
|
|
163
|
+
itemProps?:
|
|
164
|
+
| ((theme: PluginConfiguration, width: number) => ItemProps)
|
|
165
|
+
| ItemProps
|
|
166
|
+
) {
|
|
167
|
+
if (itemProps) {
|
|
168
|
+
return typeof itemProps === "function"
|
|
169
|
+
? itemProps(theme, width)
|
|
170
|
+
: itemProps;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return defaultItemProps(theme, width);
|
|
174
|
+
}
|
|
@@ -644,7 +644,17 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
644
644
|
testID={"player-screen-container"}
|
|
645
645
|
>
|
|
646
646
|
{/* Player container */}
|
|
647
|
-
<View
|
|
647
|
+
<View
|
|
648
|
+
style={[
|
|
649
|
+
styles.playerWrapper,
|
|
650
|
+
// eslint-disable-next-line react-native/no-inline-styles, react-native/no-color-literals
|
|
651
|
+
{
|
|
652
|
+
borderWidth: 1,
|
|
653
|
+
borderColor: "transparent",
|
|
654
|
+
} /* @HACK: see GH#7269 */,
|
|
655
|
+
]}
|
|
656
|
+
testID={"player-wrapper"}
|
|
657
|
+
>
|
|
648
658
|
<PlayerFocusableWrapperView
|
|
649
659
|
nextFocusDown={context.bottomFocusableId}
|
|
650
660
|
>
|
|
@@ -23,12 +23,10 @@ import {
|
|
|
23
23
|
setScrollModalAnimatedValue,
|
|
24
24
|
} from "./utils";
|
|
25
25
|
|
|
26
|
-
import { DURATION_TO_MINIMIZE } from "./const";
|
|
27
|
-
|
|
28
26
|
const getAnimatedConfig = (toValue) => {
|
|
29
27
|
return {
|
|
30
28
|
toValue,
|
|
31
|
-
duration:
|
|
29
|
+
duration: 200,
|
|
32
30
|
useNativeDriver: true,
|
|
33
31
|
};
|
|
34
32
|
};
|
|
@@ -24,11 +24,8 @@ import {
|
|
|
24
24
|
gestureListenerHelper,
|
|
25
25
|
getAnimationDefaultValue,
|
|
26
26
|
getAnimationStyle,
|
|
27
|
-
getMoveUpValue,
|
|
28
27
|
} from "./utils";
|
|
29
28
|
|
|
30
|
-
import { DURATION_TO_MINIMIZE, DEFAULT_DURATION_FOR_ANIMATION } from "./const";
|
|
31
|
-
|
|
32
29
|
type Props = {
|
|
33
30
|
animationType: string;
|
|
34
31
|
children: React.ReactNode;
|
|
@@ -100,16 +97,14 @@ export const AnimationView = ({
|
|
|
100
97
|
|
|
101
98
|
const inlineAudioPlayer = additionalData.inlineAudioPlayer;
|
|
102
99
|
|
|
103
|
-
const moveUpValue =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
tabletLandscapePlayerTopPosition,
|
|
112
|
-
});
|
|
100
|
+
const moveUpValue = additionalData.saveArea
|
|
101
|
+
? -insets.top + (isAudioItem ? 0 : progressBarHeight)
|
|
102
|
+
: isTablet
|
|
103
|
+
? isTabletLandscape &&
|
|
104
|
+
(!isAudioItem || (isAudioItem && inlineAudioPlayer))
|
|
105
|
+
? -tabletLandscapePlayerTopPosition + progressBarHeight
|
|
106
|
+
: -130
|
|
107
|
+
: -50 + progressBarHeight;
|
|
113
108
|
|
|
114
109
|
const moveComponentHorizontalValue = additionalData.moveValue
|
|
115
110
|
? isRTL
|
|
@@ -124,10 +119,7 @@ export const AnimationView = ({
|
|
|
124
119
|
(animationType, state) => {
|
|
125
120
|
const defaultConfig = {
|
|
126
121
|
toValue: 0,
|
|
127
|
-
duration:
|
|
128
|
-
state === PlayerAnimationStateEnum.minimize
|
|
129
|
-
? DURATION_TO_MINIMIZE
|
|
130
|
-
: DEFAULT_DURATION_FOR_ANIMATION,
|
|
122
|
+
duration: state === PlayerAnimationStateEnum.minimize ? 150 : 100,
|
|
131
123
|
useNativeDriver: true,
|
|
132
124
|
};
|
|
133
125
|
|
|
@@ -448,6 +440,10 @@ export const AnimationComponent = (props: Props) => {
|
|
|
448
440
|
videoModalState: { visible },
|
|
449
441
|
} = useNavigation();
|
|
450
442
|
|
|
443
|
+
if (additionalData?.disableAnimatedComponent) {
|
|
444
|
+
return <>{props.children}</>;
|
|
445
|
+
}
|
|
446
|
+
|
|
451
447
|
const useAnimation =
|
|
452
448
|
visible && !additionalData.disableAnimatedComponent && !isTV();
|
|
453
449
|
|
|
@@ -14,5 +14,3 @@ 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,7 +1,6 @@
|
|
|
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";
|
|
5
4
|
|
|
6
5
|
export enum ComponentAnimationType {
|
|
7
6
|
bottomBar = "bottomBar",
|
|
@@ -301,38 +300,3 @@ export const resetScrollAnimatedValues = (
|
|
|
301
300
|
dragScrollY.setValue(0);
|
|
302
301
|
dragVideoPlayerY.setValue(0);
|
|
303
302
|
};
|
|
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 any layouts in 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
|
-
};
|
|
@@ -22,9 +22,9 @@ type Props = {
|
|
|
22
22
|
entry: ZappEntry;
|
|
23
23
|
style: StyleProp<ViewStyle>;
|
|
24
24
|
configuration: Configuration;
|
|
25
|
-
isTabletLandscape
|
|
25
|
+
isTabletLandscape?: boolean;
|
|
26
26
|
isAudioPlayer?: boolean;
|
|
27
|
-
isTablet
|
|
27
|
+
isTablet?: boolean;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
const containerStyle = ({
|
|
@@ -39,9 +39,9 @@ export const PlayerDetails = ({
|
|
|
39
39
|
entry,
|
|
40
40
|
style,
|
|
41
41
|
configuration,
|
|
42
|
-
isTabletLandscape,
|
|
42
|
+
isTabletLandscape = false,
|
|
43
43
|
isAudioPlayer,
|
|
44
|
-
isTablet,
|
|
44
|
+
isTablet = false,
|
|
45
45
|
}: Props) => {
|
|
46
46
|
const screenData = useTargetScreenData(entry);
|
|
47
47
|
const insets = useSafeAreaInsets();
|
|
@@ -100,6 +100,24 @@ const getEdges = (isTablet: boolean, isInlineModal: boolean) => {
|
|
|
100
100
|
return ["top"];
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
const isPercentage = (value: string | number): boolean => {
|
|
104
|
+
if (typeof value === "string") {
|
|
105
|
+
return value.includes("%");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return false;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const getPercentageOf = (percent: string, value: number) => {
|
|
112
|
+
const percentageValue = parseFloat(percent.replace("%", ""));
|
|
113
|
+
|
|
114
|
+
if (isNaN(percentageValue)) {
|
|
115
|
+
return value;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return (value * percentageValue) / 100;
|
|
119
|
+
};
|
|
120
|
+
|
|
103
121
|
const getTabletWidth = (
|
|
104
122
|
configuration: Configuration,
|
|
105
123
|
dimensions: DimensionsT
|
|
@@ -108,18 +126,23 @@ const getTabletWidth = (
|
|
|
108
126
|
configuration?.tablet_landscape_sidebar_width;
|
|
109
127
|
|
|
110
128
|
const { width } = dimensions;
|
|
129
|
+
let widthValue = Number(width);
|
|
130
|
+
|
|
131
|
+
if (isPercentage(width)) {
|
|
132
|
+
widthValue = getPercentageOf(width.toString(), SCREEN_WIDTH);
|
|
133
|
+
}
|
|
111
134
|
|
|
112
135
|
const sidebarWidth = Number(tablet_landscape_sidebar_width?.replace("%", ""));
|
|
113
136
|
|
|
114
137
|
if (tablet_landscape_sidebar_width?.includes("%")) {
|
|
115
|
-
return
|
|
138
|
+
return widthValue * (1 - sidebarWidth / 100);
|
|
116
139
|
}
|
|
117
140
|
|
|
118
141
|
if (Number.isNaN(sidebarWidth)) {
|
|
119
|
-
return
|
|
142
|
+
return widthValue * 0.65;
|
|
120
143
|
}
|
|
121
144
|
|
|
122
|
-
return
|
|
145
|
+
return widthValue - sidebarWidth;
|
|
123
146
|
};
|
|
124
147
|
|
|
125
148
|
const PlayerWrapperComponent = (props: Props) => {
|
|
@@ -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,14 +144,12 @@ 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,
|
|
138
151
|
{
|
|
139
152
|
backgroundColor,
|
|
140
|
-
width: modalSize.width,
|
|
141
|
-
height: modalSize.height,
|
|
142
153
|
},
|
|
143
154
|
]}
|
|
144
155
|
>
|
|
@@ -148,6 +159,10 @@ const VideoModalComponent = () => {
|
|
|
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>
|
|
@@ -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();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "13.0.0-alpha.
|
|
3
|
+
"version": "13.0.0-alpha.6400875052",
|
|
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.0-alpha.
|
|
35
|
-
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.
|
|
36
|
-
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.
|
|
37
|
-
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.
|
|
34
|
+
"@applicaster/applicaster-types": "13.0.0-alpha.6400875052",
|
|
35
|
+
"@applicaster/zapp-react-native-bridge": "13.0.0-alpha.6400875052",
|
|
36
|
+
"@applicaster/zapp-react-native-redux": "13.0.0-alpha.6400875052",
|
|
37
|
+
"@applicaster/zapp-react-native-utils": "13.0.0-alpha.6400875052",
|
|
38
38
|
"promise": "^8.3.0",
|
|
39
39
|
"react-router-native": "^5.1.2",
|
|
40
40
|
"url": "^0.11.0",
|
|
@@ -1,108 +0,0 @@
|
|
|
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
|
-
});
|