UNPKG

877 BTypeScriptView Raw
1import React from 'react';
2import { requireNativeComponent } from 'react-native';
3import { withoutXY } from '../lib/extract/extractProps';
4import { NumberProp } from '../lib/extract/types';
5import Shape from './Shape';
6
7export default class Rect extends Shape<{
8 x?: NumberProp;
9 y?: NumberProp;
10 width?: NumberProp;
11 height?: NumberProp;
12 rx?: NumberProp;
13 ry?: NumberProp;
14}> {
15 static displayName = 'Rect';
16
17 static defaultProps = {
18 x: 0,
19 y: 0,
20 width: 0,
21 height: 0,
22 };
23
24 render() {
25 const { props } = this;
26 const { x, y, width, height, rx, ry } = props;
27 return (
28 <RNSVGRect
29 ref={this.refMethod}
30 {...withoutXY(this, props)}
31 x={x}
32 y={y}
33 width={width}
34 height={height}
35 rx={rx}
36 ry={ry}
37 />
38 );
39 }
40}
41
42export const RNSVGRect = requireNativeComponent('RNSVGRect');