From 6c9cad22dba1e973b9d63376dc3fe226d4815cfa Mon Sep 17 00:00:00 2001 From: scott Date: Mon, 28 Mar 2016 18:18:37 +0800 Subject: [PATCH] add animation when componentDidMount add animation when `componentDidMount`, in this way the `initialProgress` is no need. --- ProgressBar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ProgressBar.js b/ProgressBar.js index 53dd792..83c40b0 100644 --- a/ProgressBar.js +++ b/ProgressBar.js @@ -34,7 +34,9 @@ var ProgressBar = React.createClass({ progress: new Animated.Value(this.props.initialProgress || 0) }; }, - + componentDidMount(){ + this.update(); + }, componentDidUpdate(prevProps, prevState) { if (this.props.progress >= 0 && this.props.progress != prevProps.progress) { this.update();