mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 22:05:14 +00:00
complete ClipPath refactor
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import React, {Component, PropTypes} from 'react';
|
||||
import {set, remove} from '../lib/extract/extractClipping';
|
||||
import createReactNativeComponentClass from 'react/lib/createReactNativeComponentClass';
|
||||
import {ClipPathAttributes} from '../lib/attributes';
|
||||
|
||||
@@ -9,26 +8,9 @@ class ClipPath extends Component{
|
||||
id: PropTypes.string.isRequired
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.id = this.props.id + ':' + this.props.svgId;
|
||||
}
|
||||
|
||||
componentWillReceiveProps = nextProps => {
|
||||
let id = nextProps.id + ':' + nextProps.svgId;
|
||||
if (id !== this.id) {
|
||||
remove(this.id);
|
||||
}
|
||||
};
|
||||
|
||||
componentWillUnmount = () => {
|
||||
remove(this.id);
|
||||
};
|
||||
|
||||
render() {
|
||||
set(this.id, this.id);
|
||||
return <RNSVGClipPath
|
||||
name={this.id}
|
||||
name={this.props.id}
|
||||
>{this.props.children}</RNSVGClipPath>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user