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