How to use the @react-navigation/core.StackActions.completeTransition function in @react-navigation/core

To help you get started, we’ve selected a few @react-navigation/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github react-navigation / stack / src / views / StackView / StackView.tsx View on Github external
private handleTransitionEnd = (
    transition: { scene: Scene; navigation: NavigationProp },
    lastTransition?: { scene: Scene; navigation: NavigationProp }
  ) => {
    const {
      navigationConfig,
      navigation,
      // @ts-ignore
      onTransitionEnd = navigationConfig.onTransitionEnd,
    } = this.props;
    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,
        })
      );
    }
    onTransitionEnd && onTransitionEnd(transition, lastTransition);
  };
}
github kmagiera / react-native-screens / createNativeStackNavigator.js View on Github external
_onSceneFocus = route => {
    this.props.navigation.dispatch(
      StackActions.completeTransition({ toChildKey: route.key })
    );
  };
github kmagiera / react-native-screens / Example / nativeNavigation / createStackNavigator.js View on Github external
_removeScene = scene => {
    const { navigation } = this.props;
    navigation.dispatch(
      NavigationActions.back({
        key: scene.route.key,
        immediate: true,
      })
    );
    navigation.dispatch(StackActions.completeTransition());
  };
github react-navigation / stack / src / views / StackView / StackViewLayout.tsx View on Github external
const onCompleteAnimation = () => {
      this.immediateIndex = null;
      const backFromScene = scenes.find(s => s.index === toValue + 1);
      if (backFromScene) {
        navigation.dispatch(
          NavigationActions.back({
            key: backFromScene.route.key,
            immediate: true,
          })
        );
        navigation.dispatch(StackActions.completeTransition());
      }
    };
github react-navigation / stack / src / views / StackView / StackView.tsx View on Github external
componentDidMount() {
    const { navigation } = this.props;
    if (navigation.state.isTransitioning) {
      navigation.dispatch(
        StackActions.completeTransition({
          key: navigation.state.key,
        })
      );
    }
  }