UNPKG

656 BTypeScriptView Raw
1import React from 'react';
2import { extract } from '../lib/extract/extractProps';
3import { NumberProp } from '../lib/extract/types';
4import Shape from './Shape';
5import { RNSVGLine } from './NativeComponents';
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 const lineProps = { ...extract(this, props), x1, y1, x2, y2 };
26 return <RNSVGLine ref={this.refMethod} {...lineProps} />;
27 }
28}