Animations with ReactTransitionGroup
Chang Wang
797

You made it clear we had to call callback` after the animation ends to make sure react’s componentWillLeave` hook be called and it works fine with methods like TweenMax.From` and the likes. But it does not work when using TimelineLite.staggerFrom`, which takes an array as first argument.

If you declareonComplete: callbackwithin the vars object`, it will call the callback for every item in the array, meaning that the callback will be called right after the animation on the first element of the array and so it will short circuit the whole staggering effect.

If you declare callback` as onCompleteAll` function, which would be the very last argument of the .staggerFrom` method, weirdly enough, react’s componentWillLeave` hook is never run. Why is that?

Am I doing something wrong?