1 | import React from 'react';
|
2 | import { withoutXY } from '../lib/extract/extractProps';
|
3 | import { NumberProp } from '../lib/extract/types';
|
4 | import Shape from './Shape';
|
5 | import { RNSVGRect } from './NativeComponents';
|
6 |
|
7 | export 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 | const rectProps = { x, y, width, height, rx, ry };
|
28 | return (
|
29 | <RNSVGRect
|
30 | ref={this.refMethod}
|
31 | {...withoutXY(this, props)}
|
32 | {...rectProps}
|
33 | />
|
34 | );
|
35 | }
|
36 | }
|