mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-28 13:03:12 +00:00
Optimize stroke width extraction.
This commit is contained in:
@@ -32,7 +32,7 @@ export default function(props, styleProperties) {
|
||||
}
|
||||
}
|
||||
|
||||
const { stroke, strokeWidth, strokeDasharray } = props;
|
||||
const { stroke, strokeWidth = 1, strokeDasharray } = props;
|
||||
const strokeDash =
|
||||
!strokeDasharray || strokeDasharray === "none"
|
||||
? null
|
||||
@@ -47,10 +47,7 @@ export default function(props, styleProperties) {
|
||||
strokeDash && strokeDash.length % 2 === 1
|
||||
? strokeDash.concat(strokeDash)
|
||||
: strokeDash,
|
||||
strokeWidth:
|
||||
!strokeWidth || typeof strokeWidth !== "string"
|
||||
? String(strokeWidth || 1)
|
||||
: strokeWidth,
|
||||
strokeWidth,
|
||||
strokeDashoffset: strokeDasharray ? +props.strokeDashoffset || 0 : null,
|
||||
strokeMiterlimit: parseFloat(props.strokeMiterlimit) || 4,
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ export function setTSpan(TSpanImplementation) {
|
||||
|
||||
function getChild(child) {
|
||||
if (typeof child === "string" || typeof child === "number") {
|
||||
return <TSpan>{child.toString()}</TSpan>;
|
||||
return <TSpan>{String(child)}</TSpan>;
|
||||
} else {
|
||||
return child;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user