[js] Fix crash on missing width or height prop in Use element

This commit is contained in:
Mikael Sand
2018-07-02 05:23:14 +03:00
parent eafe5d4f7c
commit 7a43500b49

View File

@@ -28,6 +28,7 @@ export default class extends Shape {
render() {
const { props } = this;
const { children, width, height } = props;
// match "url(#pattern)"
const matched = props.href.match(idExpReg);
let href;
@@ -51,10 +52,10 @@ export default class extends Shape {
}}
{...extractProps(props, this)}
href={href}
width={props.width.toString()}
height={props.height.toString()}
width={width !== undefined ? width.toString() : ""}
height={height !== undefined ? height.toString() : ""}
>
{props.children}
{children}
</RNSVGUse>
);
}