Files
react-native-svg/elements/Ellipse.js
Horcrux af0995022d apply common stroke processor to elements
apply common stroke processor to elements
2016-01-23 16:50:11 +08:00

47 lines
1.0 KiB
JavaScript

import React, {
Component,
PropTypes,
ART
} from 'react-native';
import fillFilter from '../lib/fillFilter';
import strokeFilter from '../lib/strokeFilter';
let {
Shape
} = ART;
let propType = PropTypes.oneOfType([PropTypes.string, PropTypes.number]);
class Ellipse extends Component{
static displayName = 'Ellipse';
static propTypes = {
cx: propType,
cy: propType,
rx: propType,
ry: propType
};
render() {
let {props} = this;
let {cx, cy, rx, ry} = this.props;
let d = `
M ${cx - rx} ${cy}
a ${rx}, ${ry} 0 1, 0 ${rx * 2}, 0
a ${rx}, ${ry} 0 1, 0 ${-rx * 2}, 0
Z
`;
return <Shape
{...props}
fill={fillFilter(props)}
{...strokeFilter(props)}
strokeCap={null}
strokeJoin={null}
cx={null}
cy={null}
rx={null}
ry={null}
d={d}
/>;
}
}
export default Ellipse;