mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-09 01:25:01 +00:00
Add examples and refactor code
Add examples and refactor code
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import React, {
|
||||
Component,
|
||||
PropTypes,
|
||||
ART
|
||||
} from 'react-native';
|
||||
import fillFilter from '../lib/fillFilter';
|
||||
import strokeFilter from '../lib/strokeFilter';
|
||||
import Path from './Path';
|
||||
|
||||
class Polygon extends Component{
|
||||
static displayName = 'Polygon';
|
||||
static propTypes = {
|
||||
points: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired
|
||||
};
|
||||
render() {
|
||||
let props = this.props;
|
||||
let d = 'M' + props.points.trim().replace(/\s+/g, 'L') + 'z';
|
||||
return <Path
|
||||
{...props}
|
||||
points={null}
|
||||
d={d}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
export default Polygon;
|
||||
Reference in New Issue
Block a user