Skip to content

Commit

Permalink
Ensure NavigationTransitioner props.onTransitionEnd happens after sce…
Browse files Browse the repository at this point in the history
…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
Eric Vicenti authored and Facebook Github Bot 9 committed Aug 13, 2016
1 parent 5b040a5 commit de9d22e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Libraries/NavigationExperimental/NavigationTransitioner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
});
}
}

Expand Down

0 comments on commit de9d22e

Please sign in to comment.