How to use the @react-navigation/core.CommonActions.navigate 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 / navigation-ex / packages / drawer / src / views / DrawerSidebar.tsx View on Github external
private handleItemPress = ({
    route,
    focused,
  }: {
    route: Route;
    focused: boolean;
  }) => {
    const { state, navigation } = this.props;

    navigation.dispatch({
      ...(focused
        ? DrawerActions.closeDrawer()
        : CommonActions.navigate(route.name)),
      target: state.key,
    });
  };