mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 05:55:10 +00:00
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import React, {PropTypes} from 'react';
|
|
import createReactNativeComponentClass from 'react/lib/createReactNativeComponentClass';
|
|
import mergeContext from '../lib/mergeContext';
|
|
import Shape from './Shape';
|
|
import {ellipseProps, pathProps, fillProps, strokeProps, numberProp} from '../lib/props';
|
|
import {EllipseAttributes} from '../lib/attributes';
|
|
|
|
class Ellipse extends Shape{
|
|
static displayName = 'Ellipse';
|
|
|
|
static propTypes = {
|
|
...pathProps,
|
|
...ellipseProps
|
|
};
|
|
|
|
static defaultProps = {
|
|
cx: 0,
|
|
cy: 0,
|
|
rx: 0,
|
|
ry: 0
|
|
};
|
|
|
|
setNativeProps = (...args) => {
|
|
this.root.setNativeProps(...args);
|
|
};
|
|
|
|
render() {
|
|
let props = mergeContext(this.props, this.context);
|
|
return <RNSVGEllipse
|
|
ref={ele => this.root = ele}
|
|
{...this.extractProps(props)}
|
|
cx={props.cx.toString()}
|
|
cy={props.cy.toString()}
|
|
rx={props.rx.toString()}
|
|
ry={props.ry.toString()}
|
|
/>;
|
|
}
|
|
}
|
|
|
|
const RNSVGEllipse = createReactNativeComponentClass({
|
|
validAttributes: EllipseAttributes,
|
|
uiViewClassName: 'RNSVGEllipse'
|
|
});
|
|
|
|
export default Ellipse;
|