From 669173960c768943bf58012e3a2f16edf04a2149 Mon Sep 17 00:00:00 2001 From: Alberto Palumbo Date: Sun, 3 Sep 2017 16:30:38 -0300 Subject: [PATCH 1/3] Added onAnimationEnd callback to props --- dist/react-progressbar.js | 2 +- src/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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) { From fff42d16a31ca0813bb4f75e7abc74c435dbb78d Mon Sep 17 00:00:00 2001 From: Alberto Palumbo Date: Sun, 3 Sep 2017 17:01:58 -0300 Subject: [PATCH 2/3] onAnimationEnd cb on props --- README.md | 1 + 1 file changed, 1 insertion(+) 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 From 9d48e9676117214b1e4fccbc5de75f225a375d84 Mon Sep 17 00:00:00 2001 From: Alberto Palumbo Date: Sun, 3 Sep 2017 17:02:28 -0300 Subject: [PATCH 3/3] onAnimationEnd tested on browser --- local-dev/main.js | 6 +++++- package.json | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) 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 +}