UNPKG

904 BTypeScriptView Raw
1import React from 'react';
2import { requireNativeComponent } from 'react-native';
3import { withoutXY } from '../lib/extract/extractProps';
4import { NumberProp } from '../lib/extract/types';
5import G from './G';
6
7export 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 return (
26 <RNSVGForeignObject
27 ref={this.refMethod}
28 {...withoutXY(this, props)}
29 x={x}
30 y={y}
31 width={width}
32 height={height}
33 >
34 {children}
35 </RNSVGForeignObject>
36 );
37 }
38}
39
40export const RNSVGForeignObject = requireNativeComponent('RNSVGForeignObject');