complete basic shapes(ios)

This commit is contained in:
Horcrux
2016-04-26 19:10:57 +08:00
parent d7a9e418ae
commit 24dcc83a80
25 changed files with 540 additions and 256 deletions
+20 -18
View File
@@ -2,30 +2,32 @@ import React, {
Component,
PropTypes
} from 'react-native';
import Path from './Path';
import Shape, {LINE} from './Shape';
import {lineProps, pathProps} from '../lib/props';
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Line extends Component{
class Line extends Shape{
static displayName = 'Line';
static propTypes = {
x1: propType,
x2: propType,
y1: propType,
y2: propType,
strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round'])
...pathProps,
...lineProps
};
static getPath = (props) => (
`M${props.x1},${props.y1} L${props.x2},${props.y2}`
);
static defaultProps = {
x1: 0,
x2: 0,
y1: 0,
y2: 0
};
render() {
return <Path
{...this.props}
d={Line.getPath(this.props)}
/>;
}
static contextTypes = {
...lineProps,
isInGroup: PropTypes.bool
};
constructor() {
super(...arguments);
this.type = LINE;
};
}
export default Line;