import * as React from 'react'; import Path from './Path'; import Shape from './Shape'; import type { CommonPathProps, NumberProp } from '../lib/extract/types'; import extractPolyPoints from '../lib/extract/extractPolyPoints'; export interface PolygonProps extends CommonPathProps { opacity?: NumberProp; points?: string | ReadonlyArray; } export default class Polygon extends Shape { static displayName = 'Polygon'; static defaultProps = { points: '', }; setNativeProps = ( props: PolygonProps & { d?: string; } ) => { const { points } = props; if (points) { props.d = `M${extractPolyPoints(points)}z`; } this.root && this.root.setNativeProps(props); }; render() { const { props } = this; const { points } = props; return ( void} d={points && `M${extractPolyPoints(points)}z`} {...props} /> ); } }