Merge pull request #162 from nairinarinyan/master

reanimate and return animation to control
This commit is contained in:
Markus Lindqvist 2018-12-09 15:44:50 +02:00 committed by GitHub
commit 87073342e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,16 +28,25 @@ export default class AnimatedCircularProgress extends React.PureComponent {
}
}
reAnimate(prefill, toVal, dur, ease) {
this.setState({
fillAnimation: new Animated.Value(prefill)
}, () => this.animate(toVal, dur, ease));
}
animate(toVal, dur, ease) {
const toValue = toVal || this.props.fill;
const duration = dur || this.props.duration;
const easing = ease || this.props.easing;
return Animated.timing(this.state.fillAnimation, {
const anim = Animated.timing(this.state.fillAnimation, {
toValue,
easing,
duration,
}).start(this.props.onAnimationComplete);
});
anim.start(this.props.onAnimationComplete);
return anim;
}
render() {