Last active
June 20, 2018 02:38
-
-
Save leandrojo/a36422672cd77f7c43339aca4676215c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* @flow */ | |
| import React, { Component } from 'react'; | |
| import { ART, View } from 'react-native'; | |
| type Props = { | |
| strokeWidth: number, | |
| strokeColor: string, | |
| width: number, | |
| }; | |
| class Circle extends Component<void, Props, void> { | |
| status = {}; | |
| render() { | |
| const { strokeColor, strokeWidth, width } = this.props; | |
| const radius = width * 0.49; | |
| const circle = ART.Path() | |
| .move(radius, 0) | |
| .arc(0, radius * 2, radius) | |
| .arc(0, radius * -2, radius); | |
| return ( | |
| <View style={{ position: 'absolute' }}> | |
| <ART.Surface width={width + 1} height={width + 1}> | |
| <ART.Group x={1} y={1}> | |
| <ART.Shape d={circle} stroke={strokeColor} strokeWidth={strokeWidth} /> | |
| </ART.Group> | |
| </ART.Surface> | |
| </View> | |
| ); | |
| } | |
| } | |
| Circle.defaultProps = { | |
| width: 20, | |
| strokeWidth: 1, | |
| strokeColor: '#FFF', | |
| }; | |
| export default Circle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment