mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-28 21:03:51 +00:00
clear up propTypes
This commit is contained in:
@@ -16,7 +16,6 @@ class Path extends Component{
|
||||
static displayName = 'Path';
|
||||
|
||||
static propTypes = {
|
||||
visible: PropTypes.bool,
|
||||
d: PropTypes.string,
|
||||
...pathProps
|
||||
};
|
||||
|
||||
+4
-3
@@ -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`}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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')}`}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user