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
This commit is contained in:
Eric Vicenti 2016-08-12 17:05:06 -07:00 committed by Facebook Github Bot 9
parent 5b040a52c4
commit de9d22ee7e
1 changed files with 6 additions and 5 deletions

View File

@ -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,
);
});
}
}