Add setNativeProps method for most of elements

This commit is contained in:
Horcrux
2016-07-18 18:34:54 +08:00
parent 2516a778ba
commit efa7363b6f
13 changed files with 74 additions and 3 deletions

View File

@@ -30,6 +30,14 @@ class Path extends Shape {
}
};
setNativeProps = (...args) => {
this.getNativeElement().setNativeProps(...args);
};
getNativeElement = () => {
return this.refs.root || this.root;
};
render() {
let props = mergeContext(this.props, this.context);
@@ -39,13 +47,18 @@ class Path extends Shape {
svgId={props.svgId}
visible={true}
>
<Path {...props} id={null} />
<Path
ref={ele => this.root = ele.refs.root}
{...props}
id={null}
/>
</Defs.Item>;
}
let d = new SerializablePath(props.d).toJSON();
return (
<RNSVGPath
ref="root"
{...this.extractProps(props)}
d={d}
/>