@jobber/components-native 0.105.1-MIKEfix-c-fe51c3e.2 → 0.105.1
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/dist/package.json +2 -2
- package/dist/src/ActivityIndicator/ActivityIndicator.js +10 -20
- package/dist/src/Icon/Icon.js +2 -1
- package/dist/src/Icon/Icon.test.js +4 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/ActivityIndicator/ActivityIndicator.tsx +51 -64
- package/src/Icon/Icon.test.tsx +6 -1
- package/src/Icon/Icon.tsx +2 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.105.1
|
|
3
|
+
"version": "0.105.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"react-native-screens": ">=4.18.0",
|
|
123
123
|
"react-native-svg": ">=12.0.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "fff8aa8019d89e4a0d517f1eb963c8442935a16d"
|
|
126
126
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { AccessibilityInfo
|
|
2
|
+
import { AccessibilityInfo } from "react-native";
|
|
3
3
|
import Animated, { Easing, ReduceMotion, useAnimatedProps, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withSequence, withTiming, } from "react-native-reanimated";
|
|
4
4
|
import Svg, { Circle } from "react-native-svg";
|
|
5
5
|
import { tokens } from "../utils/design";
|
|
@@ -19,9 +19,6 @@ const RADIUS = 20;
|
|
|
19
19
|
// "200" used as the gap value exceeds the circumference, ensuring only
|
|
20
20
|
// one stroke segment is visible at a time.
|
|
21
21
|
const GAP = 200;
|
|
22
|
-
const ContainerStyle = StyleSheet.create({
|
|
23
|
-
container: { justifyContent: "center", alignItems: "center" },
|
|
24
|
-
});
|
|
25
22
|
function resolveLegacySize(size) {
|
|
26
23
|
if (size === "large") {
|
|
27
24
|
if (__DEV__) {
|
|
@@ -126,18 +123,12 @@ function FullMotionRing({ pixelSize, strokeWidth, arcColor, trackColor, style, t
|
|
|
126
123
|
strokeDashoffset: offset,
|
|
127
124
|
};
|
|
128
125
|
});
|
|
129
|
-
return (React.createElement(View, { style: [
|
|
130
|
-
React.createElement(Animated.View,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
], testID: testID }, a11yProps),
|
|
136
|
-
React.createElement(Animated.View, { style: [{ width: pixelSize, height: pixelSize }, outerStyle] },
|
|
137
|
-
React.createElement(Animated.View, { style: [{ width: pixelSize, height: pixelSize }, innerStyle] },
|
|
138
|
-
React.createElement(Svg, { width: pixelSize, height: pixelSize, viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}` },
|
|
139
|
-
React.createElement(Circle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: trackColor, strokeWidth: strokeWidth }),
|
|
140
|
-
React.createElement(AnimatedCircle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: arcColor, strokeWidth: strokeWidth, strokeLinecap: "round", animatedProps: arcAnimatedProps })))))));
|
|
126
|
+
return (React.createElement(Animated.View, Object.assign({ style: [{ width: pixelSize, height: pixelSize }, style], testID: testID }, a11yProps),
|
|
127
|
+
React.createElement(Animated.View, { style: [{ width: pixelSize, height: pixelSize }, outerStyle] },
|
|
128
|
+
React.createElement(Animated.View, { style: [{ width: pixelSize, height: pixelSize }, innerStyle] },
|
|
129
|
+
React.createElement(Svg, { width: pixelSize, height: pixelSize, viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}` },
|
|
130
|
+
React.createElement(Circle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: trackColor, strokeWidth: strokeWidth }),
|
|
131
|
+
React.createElement(AnimatedCircle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: arcColor, strokeWidth: strokeWidth, strokeLinecap: "round", animatedProps: arcAnimatedProps }))))));
|
|
141
132
|
}
|
|
142
133
|
function ReducedMotionRing({ pixelSize, strokeWidth, ringColor, style, testID, a11yProps, }) {
|
|
143
134
|
// Reduced motion: hide rotation entirely, render one static ring in the
|
|
@@ -173,8 +164,7 @@ function ReducedMotionRing({ pixelSize, strokeWidth, ringColor, style, testID, a
|
|
|
173
164
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
174
165
|
opacity: pulse.value,
|
|
175
166
|
}));
|
|
176
|
-
return (React.createElement(View, { style: [
|
|
177
|
-
React.createElement(
|
|
178
|
-
React.createElement(
|
|
179
|
-
React.createElement(Circle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: ringColor, strokeWidth: strokeWidth })))));
|
|
167
|
+
return (React.createElement(Animated.View, Object.assign({ style: [{ width: pixelSize, height: pixelSize }, animatedStyle, style], testID: testID }, a11yProps),
|
|
168
|
+
React.createElement(Svg, { width: pixelSize, height: pixelSize, viewBox: `0 0 ${VIEWBOX} ${VIEWBOX}` },
|
|
169
|
+
React.createElement(Circle, { cx: CENTER, cy: CENTER, r: RADIUS, fill: "none", stroke: ringColor, strokeWidth: strokeWidth }))));
|
|
180
170
|
}
|
package/dist/src/Icon/Icon.js
CHANGED
|
@@ -12,7 +12,8 @@ export function Icon({ name, color, size = "base", customColor, testID, }) {
|
|
|
12
12
|
format: "js",
|
|
13
13
|
tokens,
|
|
14
14
|
});
|
|
15
|
-
|
|
15
|
+
// getIcon returns undefined paths for an unknown icon name; render nothing rather than crash.
|
|
16
|
+
const icon = (paths !== null && paths !== void 0 ? paths : []).map((path) => {
|
|
16
17
|
return React.createElement(Path, { key: path, d: path, fill: customColor || svgStyle.fill });
|
|
17
18
|
});
|
|
18
19
|
return (React.createElement(Svg, { style: Object.assign(Object.assign({}, svgStyle), { display: "flex" }), testID: testID || name, viewBox: viewBox }, icon));
|
|
@@ -41,6 +41,10 @@ it("applies name prop as testID when testID prop is not provided", () => {
|
|
|
41
41
|
const { getByTestId } = render(React.createElement(Icon, { name: "home" }));
|
|
42
42
|
expect(getByTestId("home")).toBeDefined();
|
|
43
43
|
});
|
|
44
|
+
it("renders an empty svg without throwing for an unknown icon name", () => {
|
|
45
|
+
const svg = render(React.createElement(Icon, { name: "someNonexistentIcon" }));
|
|
46
|
+
expect(svg.UNSAFE_root.findAllByType(Path)).toHaveLength(0);
|
|
47
|
+
});
|
|
44
48
|
describe("theme-aware fill", () => {
|
|
45
49
|
function getPathFills(svg) {
|
|
46
50
|
return svg.UNSAFE_root.findAllByType(Path).map(p => p.props.fill);
|