Avoid completion dispatch when nav state changed

This commit is contained in:
Eric Vicenti 2018-10-29 18:24:20 -07:00
parent 1aa8ca38d5
commit 3fc590353f
1 changed files with 6 additions and 1 deletions

View File

@ -33,10 +33,15 @@ class StackView extends React.Component {
const { navigationConfig, navigation } = this.props;
const onTransitionEnd =
this.props.onTransitionEnd || navigationConfig.onTransitionEnd;
if (transition.navigation.state.isTransitioning) {
const transitionDestKey = transition.scene.route.key;
const isCurrentKey =
navigation.state.routes[navigation.state.index].key ===
transitionDestKey;
if (transition.navigation.state.isTransitioning && isCurrentKey) {
navigation.dispatch(
StackActions.completeTransition({
key: navigation.state.key,
toChildKey: transitionDestKey,
})
);
}