Skip to content

Instantly share code, notes, and snippets.

@valer-cara
Created March 23, 2015 13:44
Show Gist options
  • Save valer-cara/a1136cc066a2118e38c5 to your computer and use it in GitHub Desktop.
Save valer-cara/a1136cc066a2118e38c5 to your computer and use it in GitHub Desktop.
componentDidUpdate: function(prevProps, prevState) {
var _this = this, shouldTransition, shouldStartAnimation;
shouldStartAnimation = this.state.transitionStarted && !this.state.isTransitioning;
if (shouldStartAnimation) {
this.setState({ isTransitioning: true });
}
shouldTransition = !this.state.transitionStarted &&
!this._equalScreens(this.state.activeScreen, this.state.screensStackTop);
if (shouldTransition) {
this.setState({
transitionStarted: true,
transitionDirection: this.state.activeScreen.get('stackIndex') > this.state.screensStackTop.get('stackIndex') ? "back" : "fwd"
});
setTimeout(function() {
_this._resetTransition();
}, 1000);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment