mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-27 04:32:57 +00:00
complete ClipPath element on iOS
This commit is contained in:
+8
-2
@@ -80,11 +80,16 @@ class Defs extends Component{
|
||||
static Item = DefsItem;
|
||||
static Use = DefsUse;
|
||||
|
||||
shouldRender = false;
|
||||
getChildren = () => {
|
||||
return Children.map(this.props.children, child => {
|
||||
let {type} = child;
|
||||
|
||||
if (type === LinearGradient || type === RadialGradient || type === ClipPath) {
|
||||
if (type === ClipPath) {
|
||||
this.shouldRender = true;
|
||||
}
|
||||
|
||||
return cloneElement(child, {
|
||||
svgId: this.props.svgId
|
||||
});
|
||||
@@ -99,8 +104,9 @@ class Defs extends Component{
|
||||
};
|
||||
|
||||
render() {
|
||||
return <NativeGroup>
|
||||
{this.getChildren()}
|
||||
let children = this.getChildren();
|
||||
return <NativeGroup opacity={this.shouldRender ? 1 : 0}>
|
||||
{children}
|
||||
</NativeGroup>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user