UNPKG

770 BTypeScriptView Raw
1import React from 'react';
2import { requireNativeComponent } from 'react-native';
3import { extract } from '../lib/extract/extractProps';
4import { NumberProp } from '../lib/extract/types';
5import Shape from './Shape';
6
7export default class Line extends Shape<{
8 x1?: NumberProp;
9 y1?: NumberProp;
10 x2?: NumberProp;
11 y2?: NumberProp;
12}> {
13 static displayName = 'Line';
14
15 static defaultProps = {
16 x1: 0,
17 y1: 0,
18 x2: 0,
19 y2: 0,
20 };
21
22 render() {
23 const { props } = this;
24 const { x1, y1, x2, y2 } = props;
25 return (
26 <RNSVGLine
27 ref={this.refMethod}
28 {...extract(this, props)}
29 x1={x1}
30 y1={y1}
31 x2={x2}
32 y2={y2}
33 />
34 );
35 }
36}
37
38export const RNSVGLine = requireNativeComponent('RNSVGLine');