How to use the @react-navigation/routers.StackActions.popToTop function in @react-navigation/routers

To help you get started, we’ve selected a few @react-navigation/routers 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 / navigation-ex / packages / stack / src / navigators / createStackNavigator.tsx View on Github external
requestAnimationFrame(() => {
          if (state.index > 0 && isFocused && !e.defaultPrevented) {
            // When user taps on already focused tab and we're inside the tab,
            // reset the stack to replicate native behaviour
            navigation.dispatch({
              ...StackActions.popToTop(),
              target: state.key,
            });
          }
        });
      }),
github react-navigation / navigation-ex / packages / native-stack / src / navigators / createNativeStackNavigator.tsx View on Github external
requestAnimationFrame(() => {
          if (state.index > 0 && isFocused && !e.defaultPrevented) {
            // When user taps on already focused tab and we're inside the tab,
            // reset the stack to replicate native behaviour
            navigation.dispatch({
              ...StackActions.popToTop(),
              target: state.key,
            });
          }
        });
      }),
github react-navigation / navigation-ex / packages / compat / src / StackActions.tsx View on Github external
export function popToTop(): StackActionType {
  return StackActions.popToTop();
}