From de9d22ee7e9cd7b2c94e70f233ba270a2a61c953 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Fri, 12 Aug 2016 17:05:06 -0700 Subject: [PATCH] Ensure NavigationTransitioner props.onTransitionEnd happens after scene 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 --- .../NavigationExperimental/NavigationTransitioner.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Libraries/NavigationExperimental/NavigationTransitioner.js b/Libraries/NavigationExperimental/NavigationTransitioner.js index e0eb6cdc8348ec..2715fcf15f2c88 100644 --- a/Libraries/NavigationExperimental/NavigationTransitioner.js +++ b/Libraries/NavigationExperimental/NavigationTransitioner.js @@ -217,12 +217,13 @@ class NavigationTransitioner extends React.Component { }; 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, + ); + }); } }