refactor all components and isolated from ART dependency

This commit is contained in:
Horcrux
2016-04-20 00:52:59 +08:00
parent c8a04c3d28
commit d700ca5493
81 changed files with 2993 additions and 1437 deletions
+3 -28
View File
@@ -1,16 +1,10 @@
import React, {
Component,
PropTypes,
ReactNativeBaseComponent,
ART
ReactNativeBaseComponent
} from 'react-native';
let {
Shape,
Path
} = ART;
import Path from './Path';
import strokeFilter from '../lib/strokeFilter';
import transformFilter from '../lib/transformFilter';
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Line extends Component{
@@ -29,29 +23,10 @@ class Line extends Component{
return `M${props.x1},${props.y1}L${props.x2},${props.y2}Z`;
};
setNativeProps = (props) => {
let nativeProps = {};
if (props.x1 || props.x2 || props.y1 || props.y2) {
let path = this._convertPath(Object.assign({}, this.props, props));
nativeProps.d = new Path(path).toJSON();
} else if (props.strokeLinecap || props.strokeCap) {
// TODO:
}
this.refs.shape.setNativeProps(nativeProps);
};
render() {
return <Shape
return <Path
{...this.props}
ref="shape"
{...strokeFilter(this.props)}
{...transformFilter(this.props)}
x1={null}
y1={null}
x2={null}
y2={null}
fill={null}
d={this._convertPath()}
/>;
}