From 3c1077b2719e5be1e74b3cfccc6c5feb0ec98273 Mon Sep 17 00:00:00 2001 From: Anthony Regeda Date: Mon, 21 Dec 2015 15:58:39 +0300 Subject: [PATCH] Added prefill property --- README.md | 1 + src/AnimatedCircularProgress.js | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1b2c07a..99195e3 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ You can configure the passing by following props: - **size** – width and height of the circle - **width** - thickness of the line - **fill** - current, percentage fill (from 0 to 100) +- **prefill** - percentage fill before the animation (from 0 to 100) - **tintColor** - color of a progress line - **backgroundColor** - color of a background for progress line - **rotation** - by default, progress starts from the angle = 90⦝, you can change it by setting value from -360 to 360 diff --git a/src/AnimatedCircularProgress.js b/src/AnimatedCircularProgress.js index f3b31fb..7bf7a88 100644 --- a/src/AnimatedCircularProgress.js +++ b/src/AnimatedCircularProgress.js @@ -5,10 +5,10 @@ const AnimatedProgress = Animated.createAnimatedComponent(CircularProgress); export default class AnimatedCircularProgress extends React.Component { - constructor() { - super(); + constructor(props) { + super(props); this.state = { - chartFillAnimation: new Animated.Value(0) + chartFillAnimation: new Animated.Value(props.prefill || 0) } } @@ -34,7 +34,7 @@ export default class AnimatedCircularProgress extends React.Component { } render() { - const { fill, ...other } = this.props; + const { fill, prefill, ...other } = this.props; return (