From 277f4682cb64ff6e1ed06c45ca5019c4ec9df254 Mon Sep 17 00:00:00 2001 From: Vladimir Savrov Date: Sat, 16 Nov 2019 17:45:49 +0300 Subject: [PATCH] add clockwise progress --- README.md | 1 + src/index.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/README.md b/README.md index b214a69..4ffafa4 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ render() { | percent | The percentage used for displaying the progress | Number | ✓ | | | radius | The radius in `px` of the component (including border) | Number | ✓ | | | borderWidth | The border width in `px` | Number | ✓ | | +| upendProgress | Clockwise progress | Boolean | | false | | color | The border color | String | | ![#f00](https://placehold.it/15/f00/000000?text=+) `'#f00'` | | shadowColor | The background color of the border | String | | ![#999](https://placehold.it/15/999/000000?text=+) `'#999'` | | bgColor | The inner background color of the component | String | | ![#e9e9ef](https://placehold.it/15/e9e9ef/000000?text=+) `'#e9e9ef'` | diff --git a/src/index.js b/src/index.js index 50cb271..d4b05aa 100644 --- a/src/index.js +++ b/src/index.js @@ -43,6 +43,7 @@ export default class PercentageCircle extends Component { radius: PropTypes.number.isRequired, borderWidth: PropTypes.number, percent: PropTypes.number.isRequired, // eslint-disable-line react/no-unused-prop-types + upendProgress: PropTypes.bool, children: PropTypes.node, containerStyle: ViewPropTypesStyle, outerCircleStyle: ViewPropTypesStyle @@ -55,6 +56,7 @@ export default class PercentageCircle extends Component { borderWidth: 2, children: null, containerStyle: null, + upendProgress: false }; computeDerivedState() { @@ -86,6 +88,10 @@ export default class PercentageCircle extends Component { } renderHalfCircle(rotateDegrees, halfCircleStyles) { + if (this.props.upendProgress) { + rotateDegrees = -rotateDegrees + 180; + } + const { radius, color } = this.props const key = I18nManager.isRTL ? 'right' : 'left'; return (