Permalink
Browse files

Ensure NavigationTransitioner props.onTransitionEnd happens after sce…

…ne cleanup

Summary:
We only want to call onTransitionEnd after the transition has fully completed, including scene cleanup.

This will help avoid race conditions when we start new navigation after a transition completes.

Reviewed By: fkgozali

Differential Revision: D3712235

fbshipit-source-id: 146f30a0caf3d2fe164285fbef12293b7b161c6e
  • Loading branch information...
1 parent 5b040a5 commit de9d22ee7e9cd7b2c94e70f233ba270a2a61c953 @ericvicenti ericvicenti committed with Facebook Github Bot 9 Aug 13, 2016
Showing with 6 additions and 5 deletions.
  1. +6 −5 Libraries/NavigationExperimental/NavigationTransitioner.js
@@ -217,12 +217,13 @@ class NavigationTransitioner extends React.Component<any, Props, State> {
};
this._transitionProps = buildTransitionProps(this.props, nextState);
- this.setState(nextState);
- this.props.onTransitionEnd && this.props.onTransitionEnd(
- this._transitionProps,
- prevTransitionProps,
- );
+ this.setState(nextState, () => {
+ this.props.onTransitionEnd && this.props.onTransitionEnd(
+ this._transitionProps,
+ prevTransitionProps,
+ );
+ });
}
}

0 comments on commit de9d22e

Please sign in to comment.