add Use element and add example for it

add Use element and add example for it
This commit is contained in:
Horcrux
2016-01-23 19:25:12 +08:00
parent af0995022d
commit 11c211a9a9
12 changed files with 166 additions and 29 deletions

View File

@@ -1,12 +1,14 @@
import React, {
ART,
Component,
PropTypes
PropTypes,
cloneElement
} from 'react-native';
let {
Shape
} = ART;
import Defs from './Defs';
import fillFilter from '../lib/fillFilter';
import strokeFilter from '../lib/strokeFilter';
@@ -25,12 +27,16 @@ class Path extends Component{
};
render() {
let {props} = this;
return <Shape
let element = <Shape
{...props}
{...strokeFilter(props)}
fill={fillFilter(props)}
id={null}
/>;
if (this.props.id) {
Defs.set(this.props.id + ':' + this.props.svgId, <Path {...this.props} id={null} />);
}
return element;
}
}