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
This commit is contained in:
Eric Vicenti 2018-09-23 12:08:18 -07:00
parent 3f4d038b50
commit b3c2ebb9a9
1 changed files with 11 additions and 0 deletions

View File

@ -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) => { _configureTransition = (transitionProps, prevTransitionProps) => {
return { return {
...TransitionConfigs.getTransitionConfig( ...TransitionConfigs.getTransitionConfig(