Skip to content

Commit

Permalink
Try fixing souporserious/react-motion-ui-pack#41 by checking if unmou…
Browse files Browse the repository at this point in the history
…nting is in progress.
  • Loading branch information
Öz authored and chenglou committed May 11, 2016
1 parent 0d708c1 commit 49ea396
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/TransitionMotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ const TransitionMotion = React.createClass({
},

startAnimationIfNecessary(): void {
if (this.unmounting) {
return;
}
// TODO: when config is {a: 10} and dest is {a: 10} do we raf once and
// call cb? No, otherwise accidental parent rerender causes cb trigger
this.animationID = defaultRaf(() => {
Expand Down Expand Up @@ -502,6 +505,7 @@ const TransitionMotion = React.createClass({
},

componentWillUnmount() {
this.unmounting = true;
if (this.animationID != null) {
defaultRaf.cancel(this.animationID);
this.animationID = null;
Expand Down

0 comments on commit 49ea396

Please sign in to comment.