mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-27 12:41:49 +00:00
优化 Symbol
优化 Symbol
This commit is contained in:
+9
-21
@@ -43,26 +43,14 @@ class Svg extends Component{
|
||||
render() {
|
||||
let {props} = this;
|
||||
let opacity = +props.opacity;
|
||||
if (props.viewbox) {
|
||||
return <Surface
|
||||
{...props}
|
||||
style={[
|
||||
props.style,
|
||||
!isNaN(opacity) && {
|
||||
opacity: opacity
|
||||
}
|
||||
]}
|
||||
>
|
||||
<ViewBox
|
||||
viewbox={props.viewbox}
|
||||
preserveAspectRatio={props.preserveAspectRatio}
|
||||
width={props.width}
|
||||
height={props.height}
|
||||
>
|
||||
{this.getChildren()}
|
||||
</ViewBox>
|
||||
</Surface>;
|
||||
}
|
||||
let content = props.viewbox ? <ViewBox
|
||||
viewbox={props.viewbox}
|
||||
preserveAspectRatio={props.preserveAspectRatio}
|
||||
width={props.width}
|
||||
height={props.height}
|
||||
>
|
||||
{this.getChildren()}
|
||||
</ViewBox> : this.getChildren();
|
||||
|
||||
return <Surface
|
||||
{...props}
|
||||
@@ -73,7 +61,7 @@ class Svg extends Component{
|
||||
}
|
||||
]}
|
||||
>
|
||||
{this.getChildren()}
|
||||
{content}
|
||||
</Surface>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user