@applicaster/zapp-react-native-ui-components 12.0.0-rc.67 → 12.0.0-rc.69
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.
|
@@ -7,50 +7,24 @@ 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;
|
|
10
14
|
children: React.ReactNode;
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
const
|
|
14
|
-
"marginTop",
|
|
15
|
-
"marginBottom",
|
|
16
|
-
"marginLeft",
|
|
17
|
-
"marginRight",
|
|
18
|
-
] as const;
|
|
17
|
+
const COLOR_TRANSPARENT = "transparent";
|
|
19
18
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const styles = StyleSheet.create({
|
|
20
|
+
container: {
|
|
21
|
+
overflow: "visible",
|
|
22
|
+
borderWidth: 0,
|
|
23
|
+
borderColor: COLOR_TRANSPARENT,
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
26
|
|
|
27
|
-
const
|
|
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
|
-
) => {
|
|
27
|
+
const getBorderPadding = (borderPosition: BorderPosition, borderWidth) => {
|
|
54
28
|
switch (borderPosition) {
|
|
55
29
|
case "inside":
|
|
56
30
|
return 0;
|
|
@@ -63,104 +37,101 @@ const getContainerBorderWidth = (
|
|
|
63
37
|
}
|
|
64
38
|
};
|
|
65
39
|
|
|
66
|
-
const
|
|
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
|
-
|
|
79
|
-
const InsideBorder = ({
|
|
40
|
+
const Border = ({
|
|
80
41
|
style,
|
|
42
|
+
padding,
|
|
81
43
|
borderPosition,
|
|
82
44
|
}: {
|
|
83
45
|
style: ViewStyle;
|
|
46
|
+
padding: ViewStyle;
|
|
84
47
|
borderPosition: BorderPosition;
|
|
85
48
|
}) => {
|
|
86
|
-
if (borderPosition
|
|
49
|
+
if (!borderPosition) {
|
|
87
50
|
return null;
|
|
88
51
|
}
|
|
89
52
|
|
|
90
|
-
const
|
|
91
|
-
|
|
53
|
+
const borderWidth = toNumberWithDefaultZero(style.borderWidth);
|
|
54
|
+
const containerPadding = getBorderPadding(borderPosition, borderWidth);
|
|
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
|
+
};
|
|
92
87
|
|
|
93
88
|
return (
|
|
94
89
|
<View
|
|
95
90
|
style={{
|
|
96
91
|
...StyleSheet.absoluteFillObject,
|
|
97
|
-
|
|
92
|
+
right: -containerPadding - paddingRight,
|
|
93
|
+
bottom: -containerPadding - paddingBottom,
|
|
94
|
+
left: -containerPadding - paddingLeft,
|
|
95
|
+
top: -containerPadding - paddingTop,
|
|
96
|
+
borderWidth,
|
|
98
97
|
borderColor: style.borderColor,
|
|
99
|
-
|
|
98
|
+
...borderRadiusStyle,
|
|
100
99
|
}}
|
|
101
100
|
/>
|
|
102
101
|
);
|
|
103
102
|
};
|
|
104
103
|
|
|
105
104
|
export const BorderContainerView = (props: Props) => {
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
const {
|
|
106
|
+
borderPosition,
|
|
107
|
+
borderPaddingTop,
|
|
108
|
+
borderPaddingRight,
|
|
109
|
+
borderPaddingBottom,
|
|
110
|
+
borderPaddingLeft,
|
|
111
|
+
style,
|
|
112
|
+
children,
|
|
113
|
+
} = props;
|
|
112
114
|
|
|
113
115
|
const borderStyleForMissingBorder =
|
|
114
116
|
style?.borderWidth === 0 || !style?.borderColor ? { borderRadius: 0 } : {};
|
|
115
117
|
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
-
};
|
|
118
|
+
const padding =
|
|
119
|
+
borderPosition === "outside"
|
|
120
|
+
? {
|
|
121
|
+
paddingTop: borderPaddingTop,
|
|
122
|
+
paddingRight: borderPaddingRight,
|
|
123
|
+
paddingBottom: borderPaddingBottom,
|
|
124
|
+
paddingLeft: borderPaddingLeft,
|
|
125
|
+
}
|
|
126
|
+
: {};
|
|
156
127
|
|
|
157
128
|
return (
|
|
158
|
-
<View
|
|
129
|
+
<View
|
|
130
|
+
{...props}
|
|
131
|
+
style={[style, styles.container, borderStyleForMissingBorder]}
|
|
132
|
+
>
|
|
159
133
|
{children}
|
|
160
|
-
<
|
|
161
|
-
style={{ ...style, ...borderStyleForMissingBorder }}
|
|
162
|
-
borderPosition={borderPosition}
|
|
163
|
-
/>
|
|
134
|
+
<Border style={style} padding={padding} borderPosition={borderPosition} />
|
|
164
135
|
</View>
|
|
165
136
|
);
|
|
166
137
|
};
|
|
@@ -42,12 +42,12 @@ export const PlayerDetails = ({
|
|
|
42
42
|
: {};
|
|
43
43
|
|
|
44
44
|
// Animation setup
|
|
45
|
-
const translateY = useRef(new Animated.Value(
|
|
45
|
+
const translateY = useRef(new Animated.Value(50)).current;
|
|
46
46
|
const opacity = useRef(new Animated.Value(0)).current;
|
|
47
47
|
|
|
48
48
|
const runAnimation = () => {
|
|
49
49
|
Animated.timing(translateY, {
|
|
50
|
-
toValue:
|
|
50
|
+
toValue: -30,
|
|
51
51
|
duration: 500,
|
|
52
52
|
easing: Easing.inOut(Easing.ease),
|
|
53
53
|
useNativeDriver: true,
|
|
@@ -63,7 +63,7 @@ export const PlayerDetails = ({
|
|
|
63
63
|
|
|
64
64
|
useEffect(() => {
|
|
65
65
|
if (isAudioPlayer) {
|
|
66
|
-
setTimeout(() => runAnimation(),
|
|
66
|
+
setTimeout(() => runAnimation(), 1500);
|
|
67
67
|
}
|
|
68
68
|
}, [isAudioPlayer]);
|
|
69
69
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-ui-components",
|
|
3
|
-
"version": "12.0.0-rc.
|
|
3
|
+
"version": "12.0.0-rc.69",
|
|
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-rc.
|
|
38
|
-
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.
|
|
39
|
-
"@applicaster/zapp-react-native-redux": "12.0.0-rc.
|
|
40
|
-
"@applicaster/zapp-react-native-utils": "12.0.0-rc.
|
|
37
|
+
"@applicaster/applicaster-types": "12.0.0-rc.69",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-rc.69",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-rc.69",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-rc.69",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|