@applicaster/zapp-react-native-ui-components 12.0.0-alpha.7623722215 → 12.0.0-alpha.8121552272
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/MasterCell/DefaultComponents/BorderContainerView/index.tsx +105 -80
- package/Components/PlayerContainer/PlayerContainer.tsx +8 -5
- package/Components/VideoModal/ModalAnimation/AnimatedScrollModal.tsx +11 -4
- package/Components/VideoModal/ModalAnimation/AnimatedVideoPlayerComponent.tsx +9 -2
- package/package.json +5 -5
|
@@ -7,24 +7,50 @@ type BorderPosition = "inside" | "outside" | "center";
|
|
|
7
7
|
interface Props {
|
|
8
8
|
style: ImageStyle | ViewStyle;
|
|
9
9
|
borderPosition: BorderPosition;
|
|
10
|
-
borderPaddingTop: number;
|
|
11
|
-
borderPaddingRight: number;
|
|
12
|
-
borderPaddingBottom: number;
|
|
13
|
-
borderPaddingLeft: number;
|
|
14
10
|
children: React.ReactNode;
|
|
15
11
|
}
|
|
16
12
|
|
|
17
|
-
const
|
|
13
|
+
const MARGINS = [
|
|
14
|
+
"marginTop",
|
|
15
|
+
"marginBottom",
|
|
16
|
+
"marginLeft",
|
|
17
|
+
"marginRight",
|
|
18
|
+
] as const;
|
|
18
19
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
});
|
|
20
|
+
const PADDINGS = [
|
|
21
|
+
"paddingTop",
|
|
22
|
+
"paddingBottom",
|
|
23
|
+
"paddingLeft",
|
|
24
|
+
"paddingRight",
|
|
25
|
+
] as const;
|
|
26
26
|
|
|
27
|
-
const
|
|
27
|
+
const isPercentageValue = (value: number | string) => {
|
|
28
|
+
if (typeof value === "string" && value.endsWith("%")) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const calculateContainerSpacing = ({
|
|
36
|
+
spacingKey,
|
|
37
|
+
style,
|
|
38
|
+
additionalSpacing,
|
|
39
|
+
}: {
|
|
40
|
+
spacingKey: typeof MARGINS[number] | typeof PADDINGS[number];
|
|
41
|
+
style: ImageStyle | ViewStyle;
|
|
42
|
+
additionalSpacing: number;
|
|
43
|
+
}) => {
|
|
44
|
+
return {
|
|
45
|
+
[spacingKey]:
|
|
46
|
+
toNumberWithDefaultZero(style[spacingKey]) + additionalSpacing,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const getContainerBorderWidth = (
|
|
51
|
+
borderPosition: BorderPosition,
|
|
52
|
+
borderWidth
|
|
53
|
+
) => {
|
|
28
54
|
switch (borderPosition) {
|
|
29
55
|
case "inside":
|
|
30
56
|
return 0;
|
|
@@ -37,103 +63,102 @@ const getBorderPadding = (borderPosition: BorderPosition, borderWidth) => {
|
|
|
37
63
|
}
|
|
38
64
|
};
|
|
39
65
|
|
|
66
|
+
const getContainerPadding = (borderPosition: BorderPosition, borderWidth) => {
|
|
67
|
+
switch (borderPosition) {
|
|
68
|
+
case "inside":
|
|
69
|
+
return borderWidth;
|
|
70
|
+
case "center":
|
|
71
|
+
return borderWidth / 2;
|
|
72
|
+
case "outside":
|
|
73
|
+
return 0;
|
|
74
|
+
default:
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
40
79
|
const InsideBorder = ({
|
|
41
80
|
style,
|
|
42
|
-
padding,
|
|
43
81
|
borderPosition,
|
|
44
82
|
}: {
|
|
45
83
|
style: ViewStyle;
|
|
46
|
-
padding: ViewStyle;
|
|
47
84
|
borderPosition: BorderPosition;
|
|
48
85
|
}) => {
|
|
49
|
-
if (
|
|
86
|
+
if (borderPosition === "outside") {
|
|
50
87
|
return null;
|
|
51
88
|
}
|
|
52
89
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const initialBorderRadius = toNumberWithDefaultZero(style.borderRadius);
|
|
57
|
-
const paddingTop = toNumberWithDefaultZero(padding.paddingTop);
|
|
58
|
-
const paddingRight = toNumberWithDefaultZero(padding.paddingRight);
|
|
59
|
-
const paddingBottom = toNumberWithDefaultZero(padding.paddingBottom);
|
|
60
|
-
const paddingLeft = toNumberWithDefaultZero(padding.paddingLeft);
|
|
61
|
-
|
|
62
|
-
const borderRadiusStyle = initialBorderRadius
|
|
63
|
-
? {
|
|
64
|
-
borderTopLeftRadius:
|
|
65
|
-
initialBorderRadius +
|
|
66
|
-
containerPadding +
|
|
67
|
-
Math.min(paddingTop, paddingLeft),
|
|
68
|
-
borderTopRightRadius:
|
|
69
|
-
initialBorderRadius +
|
|
70
|
-
containerPadding +
|
|
71
|
-
Math.min(paddingTop, paddingRight),
|
|
72
|
-
borderBottomLeftRadius:
|
|
73
|
-
initialBorderRadius +
|
|
74
|
-
containerPadding +
|
|
75
|
-
Math.min(paddingBottom, paddingLeft),
|
|
76
|
-
borderBottomRightRadius:
|
|
77
|
-
initialBorderRadius +
|
|
78
|
-
containerPadding +
|
|
79
|
-
Math.min(paddingBottom, paddingRight),
|
|
80
|
-
}
|
|
81
|
-
: {
|
|
82
|
-
borderTopLeftRadius: 0,
|
|
83
|
-
borderTopRightRadius: 0,
|
|
84
|
-
borderBottomLeftRadius: 0,
|
|
85
|
-
borderBottomRightRadius: 0,
|
|
86
|
-
};
|
|
90
|
+
const insideBorderWidth =
|
|
91
|
+
borderPosition === "center" ? style.borderWidth / 2 : style.borderWidth;
|
|
87
92
|
|
|
88
93
|
return (
|
|
89
94
|
<View
|
|
90
95
|
style={{
|
|
91
96
|
...StyleSheet.absoluteFillObject,
|
|
92
|
-
|
|
93
|
-
bottom: -containerPadding - paddingBottom,
|
|
94
|
-
left: -containerPadding - paddingLeft,
|
|
95
|
-
top: -containerPadding - paddingTop,
|
|
96
|
-
borderWidth,
|
|
97
|
+
borderWidth: insideBorderWidth,
|
|
97
98
|
borderColor: style.borderColor,
|
|
98
|
-
|
|
99
|
+
borderRadius: style.borderRadius,
|
|
99
100
|
}}
|
|
100
101
|
/>
|
|
101
102
|
);
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
export const BorderContainerView = (props: Props) => {
|
|
105
|
-
const {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
style,
|
|
112
|
-
children,
|
|
113
|
-
} = props;
|
|
106
|
+
const { style, children } = props;
|
|
107
|
+
// Return border position prop after re-implementing
|
|
108
|
+
const borderPosition = "outside";
|
|
109
|
+
|
|
110
|
+
const borderWidth = toNumberWithDefaultZero(style.borderWidth);
|
|
111
|
+
const spacing = getContainerPadding(borderPosition, borderWidth);
|
|
114
112
|
|
|
115
113
|
const borderStyleForMissingBorder =
|
|
116
114
|
style?.borderWidth === 0 || !style?.borderColor ? { borderRadius: 0 } : {};
|
|
117
115
|
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
116
|
+
const updatedMargins = MARGINS.reduce((acc, margin) => {
|
|
117
|
+
const marginValue = calculateContainerSpacing({
|
|
118
|
+
spacingKey: margin,
|
|
119
|
+
style,
|
|
120
|
+
additionalSpacing: spacing,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
return { ...acc, ...marginValue };
|
|
124
|
+
}, {});
|
|
125
|
+
|
|
126
|
+
const updatedPaddings = PADDINGS.reduce((acc, padding) => {
|
|
127
|
+
const paddingValue = calculateContainerSpacing({
|
|
128
|
+
spacingKey: padding,
|
|
129
|
+
style,
|
|
130
|
+
additionalSpacing: spacing,
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
return { ...acc, ...paddingValue };
|
|
134
|
+
}, {});
|
|
135
|
+
|
|
136
|
+
const updatedWidth = style.width
|
|
137
|
+
? isPercentageValue(style.width)
|
|
138
|
+
? style.width
|
|
139
|
+
: toNumberWithDefaultZero(style.width) - spacing * 2
|
|
140
|
+
: undefined;
|
|
141
|
+
|
|
142
|
+
const updatedHeight = style.height
|
|
143
|
+
? isPercentageValue(style.height)
|
|
144
|
+
? style.height
|
|
145
|
+
: toNumberWithDefaultZero(style.height) - spacing * 2
|
|
146
|
+
: undefined;
|
|
147
|
+
|
|
148
|
+
const containerStyle = {
|
|
149
|
+
borderWidth: getContainerBorderWidth(borderPosition, borderWidth),
|
|
150
|
+
padding: spacing,
|
|
151
|
+
...updatedMargins,
|
|
152
|
+
...updatedPaddings,
|
|
153
|
+
width: updatedWidth,
|
|
154
|
+
height: updatedHeight,
|
|
155
|
+
};
|
|
127
156
|
|
|
128
157
|
return (
|
|
129
|
-
<View
|
|
130
|
-
{...props}
|
|
131
|
-
style={[style, styles.container, borderStyleForMissingBorder]}
|
|
132
|
-
>
|
|
158
|
+
<View {...props} style={[style, containerStyle]}>
|
|
133
159
|
{children}
|
|
134
160
|
<InsideBorder
|
|
135
|
-
style={style}
|
|
136
|
-
padding={padding}
|
|
161
|
+
style={{ ...style, ...borderStyleForMissingBorder }}
|
|
137
162
|
borderPosition={borderPosition}
|
|
138
163
|
/>
|
|
139
164
|
</View>
|
|
@@ -54,7 +54,10 @@ import { toNumber } from "@applicaster/zapp-react-native-utils/numberUtils";
|
|
|
54
54
|
import { usePlayNextOverlay } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/usePlayNextOverlay";
|
|
55
55
|
import { PlayNextState } from "@applicaster/zapp-react-native-utils/appUtils/playerManager/OverlayObserver/OverlaysObserver";
|
|
56
56
|
|
|
57
|
-
import {
|
|
57
|
+
import {
|
|
58
|
+
useModalAnimationContext,
|
|
59
|
+
PlayerAnimationStateEnum,
|
|
60
|
+
} from "@applicaster/zapp-react-native-ui-components/Components/VideoModal/ModalAnimation";
|
|
58
61
|
|
|
59
62
|
type Props = {
|
|
60
63
|
Player: React.ComponentType<any>;
|
|
@@ -231,6 +234,9 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
231
234
|
const screenData = useTargetScreenData(item);
|
|
232
235
|
const { setVisible: showNavBar } = useSetNavbarState();
|
|
233
236
|
|
|
237
|
+
const { isActiveGesture, startComponentsAnimation, setPlayerAnimationState } =
|
|
238
|
+
useModalAnimationContext();
|
|
239
|
+
|
|
234
240
|
const playerEvent = (event, ...args) => {
|
|
235
241
|
playerManager.invokeHandler(event, ...args);
|
|
236
242
|
};
|
|
@@ -448,7 +454,7 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
448
454
|
if (disableMiniPlayer) {
|
|
449
455
|
navigator.closeVideoModal();
|
|
450
456
|
} else {
|
|
451
|
-
|
|
457
|
+
setPlayerAnimationState(PlayerAnimationStateEnum.minimize);
|
|
452
458
|
}
|
|
453
459
|
}
|
|
454
460
|
|
|
@@ -600,9 +606,6 @@ const PlayerContainerComponent = (props: Props) => {
|
|
|
600
606
|
pluginConfiguration,
|
|
601
607
|
};
|
|
602
608
|
|
|
603
|
-
const { isActiveGesture, startComponentsAnimation } =
|
|
604
|
-
useModalAnimationContext();
|
|
605
|
-
|
|
606
609
|
return (
|
|
607
610
|
<PlayerStateContext.Provider value={value}>
|
|
608
611
|
<PlayerContainerContextProvider
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
TapGestureHandler,
|
|
10
10
|
GestureHandlerRootView,
|
|
11
11
|
} from "react-native-gesture-handler";
|
|
12
|
+
|
|
13
|
+
import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
|
|
12
14
|
import {
|
|
13
15
|
useModalAnimationContext,
|
|
14
16
|
PlayerAnimationStateEnum,
|
|
@@ -58,6 +60,8 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
58
60
|
setLastSnap,
|
|
59
61
|
} = useModalAnimationContext();
|
|
60
62
|
|
|
63
|
+
const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
|
|
64
|
+
|
|
61
65
|
const { maximiseVideoModal, minimiseVideoModal, videoModalState } =
|
|
62
66
|
useNavigation();
|
|
63
67
|
|
|
@@ -69,6 +73,11 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
69
73
|
playerAnimationState !== PlayerAnimationStateEnum.minimize &&
|
|
70
74
|
playerAnimationState !== PlayerAnimationStateEnum.maximaze;
|
|
71
75
|
|
|
76
|
+
const isEnablePanGesture =
|
|
77
|
+
!isLanguageOverlayVisible &&
|
|
78
|
+
isNotMinimizeMaximazeAnimation &&
|
|
79
|
+
(isMaximazedModal || isMinimizedModal);
|
|
80
|
+
|
|
72
81
|
const isAudioItem = React.useMemo(
|
|
73
82
|
() =>
|
|
74
83
|
videoModalState.item?.content?.type?.includes?.("audio") ||
|
|
@@ -290,15 +299,13 @@ export const AnimatedScrollModalComponent = ({ children }: Props) => {
|
|
|
290
299
|
>
|
|
291
300
|
<View pointerEvents="box-none">
|
|
292
301
|
<PanGestureHandler
|
|
293
|
-
enabled={
|
|
294
|
-
(isMaximazedModal || isMinimizedModal) &&
|
|
295
|
-
isNotMinimizeMaximazeAnimation
|
|
296
|
-
}
|
|
302
|
+
enabled={isEnablePanGesture}
|
|
297
303
|
ref={panHandlerRef}
|
|
298
304
|
simultaneousHandlers={[scrollRef, tapHandlerRef]}
|
|
299
305
|
shouldCancelWhenOutside={isMaximazedModal}
|
|
300
306
|
onGestureEvent={onGestureEvent}
|
|
301
307
|
onHandlerStateChange={onHandlerStateChange}
|
|
308
|
+
activeOffsetY={[-5, 5]}
|
|
302
309
|
>
|
|
303
310
|
<Animated.View>
|
|
304
311
|
<NativeViewGestureHandler
|
|
@@ -3,6 +3,8 @@ import { Animated, StyleSheet } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
import { useNavigation } from "@applicaster/zapp-react-native-utils/reactHooks";
|
|
5
5
|
import { PanGestureHandler, State } from "react-native-gesture-handler";
|
|
6
|
+
|
|
7
|
+
import { PlayerContainerContext } from "@applicaster/zapp-react-native-ui-components/Components/PlayerContainer/PlayerContainerContext";
|
|
6
8
|
import {
|
|
7
9
|
useModalAnimationContext,
|
|
8
10
|
PlayerAnimationStateEnum,
|
|
@@ -35,9 +37,14 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
35
37
|
} = useModalAnimationContext();
|
|
36
38
|
|
|
37
39
|
const { videoModalState } = useNavigation();
|
|
40
|
+
const { isLanguageOverlayVisible } = React.useContext(PlayerContainerContext);
|
|
41
|
+
|
|
38
42
|
const isMaximazedModal = videoModalState.mode === "MAXIMIZED";
|
|
39
43
|
const isMinimizedModal = videoModalState.mode === "MINIMIZED";
|
|
40
44
|
|
|
45
|
+
const isEnablePanGesture =
|
|
46
|
+
!isLanguageOverlayVisible && (isMaximazedModal || isMinimizedModal);
|
|
47
|
+
|
|
41
48
|
const onGestureEvent = Animated.event(
|
|
42
49
|
[{ nativeEvent: { translationY: dragVideoPlayerY } }],
|
|
43
50
|
{ useNativeDriver: true }
|
|
@@ -53,7 +60,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
53
60
|
if (videoModalState.mode === "MAXIMIZED") {
|
|
54
61
|
if (translationY > 0) {
|
|
55
62
|
const endOffsetY =
|
|
56
|
-
lastSnap + preparedTranslationY + dragToss * velocityY +
|
|
63
|
+
lastSnap + preparedTranslationY + dragToss * velocityY + 200;
|
|
57
64
|
|
|
58
65
|
let destSnapPoint = modalSnapPoints[0];
|
|
59
66
|
|
|
@@ -127,7 +134,7 @@ export const AnimatedVideoPlayer = ({ children }: Props) => {
|
|
|
127
134
|
|
|
128
135
|
return (
|
|
129
136
|
<PanGestureHandler
|
|
130
|
-
enabled={
|
|
137
|
+
enabled={isEnablePanGesture}
|
|
131
138
|
shouldCancelWhenOutside={isMaximazedModal}
|
|
132
139
|
onGestureEvent={onGestureEvent}
|
|
133
140
|
onHandlerStateChange={onHandlerStateChange}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-alpha.
|
|
3
|
+
"version": "12.0.0-alpha.8121552272",
|
|
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",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"redux-mock-store": "^1.5.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@applicaster/applicaster-types": "12.0.0-alpha.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-alpha.8121552272",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.8121552272",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.8121552272",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.8121552272",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|