From b3c2ebb9a9aaf4fbe7a6e4d28bec1baf2b43a185 Mon Sep 17 00:00:00 2001 From: Eric Vicenti Date: Sun, 23 Sep 2018 12:08:18 -0700 Subject: [PATCH] Stack nav completion on mount StackView is responsible for calling the navigation completion action when `state.isTransitioning` is set. This fix handles that case when the stack is first mounting. This had caused the following issue when observing the events.. because isTransitioning was never switched to false, didFocus never gets called: https://github.com/react-navigation/react-navigation/issues/4867 --- src/views/StackView/StackView.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/views/StackView/StackView.js b/src/views/StackView/StackView.js index 1fe93b9..57e28f2 100644 --- a/src/views/StackView/StackView.js +++ b/src/views/StackView/StackView.js @@ -45,6 +45,17 @@ class StackView extends React.Component { ); } + componentDidMount() { + const { navigation } = this.props; + if (navigation.state.isTransitioning) { + navigation.dispatch( + StackActions.completeTransition({ + key: navigation.state.key, + }) + ); + } + } + _configureTransition = (transitionProps, prevTransitionProps) => { return { ...TransitionConfigs.getTransitionConfig(