mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-07 00:42:31 +00:00
refactor all components and isolated from ART dependency
This commit is contained in:
+3
-28
@@ -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()}
|
||||
/>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user