1 | import React from 'react';
|
2 | import { withoutXY } from '../lib/extract/extractProps';
|
3 | import { NumberProp } from '../lib/extract/types';
|
4 | import G from './G';
|
5 | import { RNSVGForeignObject } from './NativeComponents';
|
6 |
|
7 | export default class ForeignObject extends G<{
|
8 | x?: NumberProp;
|
9 | y?: NumberProp;
|
10 | width?: NumberProp;
|
11 | height?: NumberProp;
|
12 | }> {
|
13 | static displayName = 'ForeignObject';
|
14 |
|
15 | static defaultProps = {
|
16 | x: '0%',
|
17 | y: '0%',
|
18 | width: '100%',
|
19 | height: '100%',
|
20 | };
|
21 |
|
22 | render() {
|
23 | const { props } = this;
|
24 | const { x, y, width, height, children } = props;
|
25 | const foreignObjectProps = { x, y, width, height };
|
26 | return (
|
27 | <RNSVGForeignObject
|
28 | ref={this.refMethod}
|
29 | {...withoutXY(this, props)}
|
30 | {...foreignObjectProps}
|
31 | >
|
32 | {children}
|
33 | </RNSVGForeignObject>
|
34 | );
|
35 | }
|
36 | }
|