@applicaster/zapp-react-native-ui-components 12.0.0-alpha.3788876021 → 12.0.0-alpha.3804385444
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,72 +7,33 @@ 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;
|
|
57
31
|
case "center":
|
|
58
|
-
return borderWidth / 2;
|
|
32
|
+
return -borderWidth / 2;
|
|
59
33
|
case "outside":
|
|
60
|
-
return borderWidth;
|
|
34
|
+
return -borderWidth;
|
|
61
35
|
default:
|
|
62
|
-
return borderWidth;
|
|
63
|
-
}
|
|
64
|
-
};
|
|
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;
|
|
36
|
+
return -borderWidth;
|
|
76
37
|
}
|
|
77
38
|
};
|
|
78
39
|
|
|
@@ -83,84 +44,64 @@ const InsideBorder = ({
|
|
|
83
44
|
style: ViewStyle;
|
|
84
45
|
borderPosition: BorderPosition;
|
|
85
46
|
}) => {
|
|
86
|
-
if (borderPosition
|
|
47
|
+
if (!borderPosition) {
|
|
87
48
|
return null;
|
|
88
49
|
}
|
|
89
50
|
|
|
90
|
-
const
|
|
91
|
-
|
|
51
|
+
const borderWidth = toNumberWithDefaultZero(style.borderWidth);
|
|
52
|
+
const containerPadding = getBorderPadding(borderPosition, borderWidth);
|
|
53
|
+
|
|
54
|
+
const borderRadius =
|
|
55
|
+
toNumberWithDefaultZero(style.borderRadius) -
|
|
56
|
+
getBorderPadding(borderPosition, borderWidth);
|
|
92
57
|
|
|
93
58
|
return (
|
|
94
59
|
<View
|
|
95
60
|
style={{
|
|
96
61
|
...StyleSheet.absoluteFillObject,
|
|
97
|
-
|
|
62
|
+
right: containerPadding,
|
|
63
|
+
bottom: containerPadding,
|
|
64
|
+
left: containerPadding,
|
|
65
|
+
top: containerPadding,
|
|
66
|
+
borderWidth: borderWidth,
|
|
98
67
|
borderColor: style.borderColor,
|
|
99
|
-
borderRadius
|
|
68
|
+
borderRadius,
|
|
100
69
|
}}
|
|
101
70
|
/>
|
|
102
71
|
);
|
|
103
72
|
};
|
|
104
73
|
|
|
105
74
|
export const BorderContainerView = (props: Props) => {
|
|
106
|
-
const {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
75
|
+
const {
|
|
76
|
+
borderPosition,
|
|
77
|
+
borderPaddingTop,
|
|
78
|
+
borderPaddingRight,
|
|
79
|
+
borderPaddingBottom,
|
|
80
|
+
borderPaddingLeft,
|
|
81
|
+
style,
|
|
82
|
+
children,
|
|
83
|
+
} = props;
|
|
112
84
|
|
|
113
85
|
const borderStyleForMissingBorder =
|
|
114
86
|
style?.borderWidth === 0 || !style?.borderColor ? { borderRadius: 0 } : {};
|
|
115
87
|
|
|
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
|
-
};
|
|
88
|
+
const padding =
|
|
89
|
+
borderPosition === "outside"
|
|
90
|
+
? {
|
|
91
|
+
paddingTop: borderPaddingTop,
|
|
92
|
+
paddingRight: borderPaddingRight,
|
|
93
|
+
paddingBottom: borderPaddingBottom,
|
|
94
|
+
paddingLeft: borderPaddingLeft,
|
|
95
|
+
}
|
|
96
|
+
: {};
|
|
156
97
|
|
|
157
98
|
return (
|
|
158
|
-
<View
|
|
99
|
+
<View
|
|
100
|
+
{...props}
|
|
101
|
+
style={[style, styles.container, borderStyleForMissingBorder, padding]}
|
|
102
|
+
>
|
|
159
103
|
{children}
|
|
160
|
-
<InsideBorder
|
|
161
|
-
style={{ ...style, ...borderStyleForMissingBorder }}
|
|
162
|
-
borderPosition={borderPosition}
|
|
163
|
-
/>
|
|
104
|
+
<InsideBorder style={style} borderPosition={borderPosition} />
|
|
164
105
|
</View>
|
|
165
106
|
);
|
|
166
107
|
};
|
|
@@ -177,10 +177,23 @@ const getPlayerConfig = (player_screen_id, actionIdentifier) => {
|
|
|
177
177
|
const positionAbsolute: ViewStyle = { position: "absolute" };
|
|
178
178
|
|
|
179
179
|
const LiveImageComponent = (props: LiveImageProps) => {
|
|
180
|
-
const {
|
|
180
|
+
const {
|
|
181
|
+
item,
|
|
182
|
+
style: componentStyle,
|
|
183
|
+
cellUUID,
|
|
184
|
+
imageKey,
|
|
185
|
+
actionIdentifier,
|
|
186
|
+
state,
|
|
187
|
+
} = props;
|
|
181
188
|
|
|
182
189
|
const component = useUIComponentContext();
|
|
183
190
|
|
|
191
|
+
// Fix for blinking on state change
|
|
192
|
+
const style = React.useMemo(
|
|
193
|
+
() => ({ ...componentStyle, backgroundColor: "transparent" }),
|
|
194
|
+
[componentStyle]
|
|
195
|
+
);
|
|
196
|
+
|
|
184
197
|
const componentType = React.useMemo(
|
|
185
198
|
() => getPropComponentType(component),
|
|
186
199
|
[component?.id]
|
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.3804385444",
|
|
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.3804385444",
|
|
38
|
+
"@applicaster/zapp-react-native-bridge": "12.0.0-alpha.3804385444",
|
|
39
|
+
"@applicaster/zapp-react-native-redux": "12.0.0-alpha.3804385444",
|
|
40
|
+
"@applicaster/zapp-react-native-utils": "12.0.0-alpha.3804385444",
|
|
41
41
|
"promise": "^8.3.0",
|
|
42
42
|
"react-router-native": "^5.1.2",
|
|
43
43
|
"url": "^0.11.0",
|