mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 14:05:09 +00:00
[js] Fix crash on missing width or height prop in Use element
This commit is contained in:
@@ -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>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user