diff --git a/README.md b/README.md index 265e828..e905454 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,7 @@ options | Options for path drawing. See [progressbar.js documentation initialAnimate | If `true`, progress bar is animated to given progress when mounted. Default `false`. containerStyle | Styles for progress bar container. Default `{}`. containerClassName | Class name for progress bar container. Default `.progressbar-container`. +onAnimationEnd | Callback when animation ends. ## Contributing diff --git a/dist/react-progressbar.js b/dist/react-progressbar.js index 262572c..8e9693f 100644 --- a/dist/react-progressbar.js +++ b/dist/react-progressbar.js @@ -105,7 +105,7 @@ }, _animateProgress: function _animateProgress(progress) { - this.state.shape.animate(progress); + this.state.shape.animate(progress, this.props.onAnimationEnd); }, _setProgress: function _setProgress(progress) { diff --git a/local-dev/main.js b/local-dev/main.js index 2e80c15..280228a 100644 --- a/local-dev/main.js +++ b/local-dev/main.js @@ -12,7 +12,7 @@ var App = React.createClass({ }, render: function() { - return ; + return ; }, componentDidMount: function() { @@ -32,6 +32,10 @@ var App = React.createClass({ }); }, 500); + }, + + onAnimationEnd() { + console.log('animation end'); } }); diff --git a/package.json b/package.json index c8d30a0..f7ea12a 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ ] }, "scripts": { - "start": "concurrent 'npm run serve' 'npm run watch-js' 'open http://localhost:8080'", + "start": "concurrently \"npm run serve\" \"npm run watch-js\" \"open http://localhost:8080\"", "watch-js": "watchify local-dev/main.js -t reactify -o local-dev/bundle.js --debug --verbose", "build": "babel src/main.js -o ./dist/react-progressbar.js", "serve": "http-server ./local-dev -c 0", @@ -72,4 +72,4 @@ "jscs": "jscs ./src ./test", "eslint": "eslint --ext .js ./src ./test" } -} \ No newline at end of file +} diff --git a/src/main.js b/src/main.js index 250404e..3eeb398 100644 --- a/src/main.js +++ b/src/main.js @@ -82,7 +82,7 @@ var Shape = React.createClass({ }, _animateProgress: function _animateProgress(progress) { - this.state.shape.animate(progress); + this.state.shape.animate(progress, this.props.onAnimationEnd); }, _setProgress: function _setProgress(progress) {