clear up propTypes

This commit is contained in:
Horcrux
2016-04-27 23:22:12 +08:00
parent fa751e31b0
commit 90887a29ee
3 changed files with 8 additions and 11 deletions
-1
View File
@@ -16,7 +16,6 @@ class Path extends Component{
static displayName = 'Path';
static propTypes = {
visible: PropTypes.bool,
d: PropTypes.string,
...pathProps
};
+4 -3
View File
@@ -3,18 +3,19 @@ import React, {
PropTypes
} from 'react-native';
import Path from './Path';
import {pathProps} from '../lib/props';
class Polygon extends Component{
static displayName = 'Polygon';
static propTypes = {
points: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
...pathProps,
points: PropTypes.string
};
static getPath = props => (`M${props.points.trim().replace(/\s+/g, 'L')}z`);
render() {
return <Path
{...this.props}
d={Polygon.getPath(this.props)}
d={`M${this.props.points.trim().replace(/\s+/g, 'L')}z`}
/>;
}
}
+4 -7
View File
@@ -3,22 +3,19 @@ import React, {
PropTypes
} from 'react-native';
import Path from './Path';
import {pathProps} from '../lib/props';
class Polyline extends Component{
static displayName = 'Polyline';
static propTypes = {
points: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']),
strokeCap: PropTypes.oneOf(['butt', 'square', 'round']),
strokeLinejoin: PropTypes.oneOf(['miter', 'bevel', 'round']),
strokeJoin: PropTypes.oneOf(['miter', 'bevel', 'round'])
...pathProps,
points: PropTypes.string
};
static getPath = props => (`M${props.points.trim().replace(/\s+/g, 'L')}`);
render() {
return <Path
{...this.props}
d={Polyline.getPath(this.props)}
d={`M${this.props.points.trim().replace(/\s+/g, 'L')}`}
/>;
}
}