mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 14:05:09 +00:00
47 lines
1.0 KiB
JavaScript
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;
|