mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-01 14:15:03 +00:00
Fix translate shorthand and add array support
https://github.com/react-native-community/react-native-svg/issues/998
This commit is contained in:
@@ -30,6 +30,13 @@ function universal2axis(universal, axisX, axisY, defaultValue) {
|
||||
} else if (coords.length === 1) {
|
||||
x = y = +coords[0];
|
||||
}
|
||||
} else if (Array.isArray(universal)) {
|
||||
if (universal.length === 2) {
|
||||
x = +universal[0];
|
||||
y = +universal[1];
|
||||
} else if (universal.length === 1) {
|
||||
x = y = +universal[0];
|
||||
}
|
||||
}
|
||||
|
||||
axisX = +axisX;
|
||||
@@ -51,8 +58,8 @@ export function props2transform(props) {
|
||||
const skew = universal2axis(props.skew, props.skewX, props.skewY);
|
||||
const translate = universal2axis(
|
||||
props.translate,
|
||||
props.translateX == null ? props.x || 0 : props.translateX,
|
||||
props.translateY == null ? props.y || 0 : props.translateY,
|
||||
props.translateX || props.x,
|
||||
props.translateY || props.y,
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user