How to use the @react-navigation/core.StackActions.push 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 keybase / client / shared / router-v2 / router.shared.tsx View on Github external
}

      if (action.payload.fromKey) {
        const {fromKey} = action.payload
        const activeKey = getActiveKey(navigation.state)
        if (fromKey !== activeKey) {
          logger.warn('Skipping append on wrong screen')
          return
        }
      }

      if (action.payload.replace) {
        return [StackActions.replace({params, routeName})]
      }

      return [StackActions.push({params, routeName})]
    }
    case RouteTreeGen.switchTab: {
      return [NavigationActions.navigate({routeName: action.payload.tab})]
    }
    case RouteTreeGen.switchLoggedIn: {
      return [NavigationActions.navigate({routeName: action.payload.loggedIn ? 'loggedIn' : 'loggedOut'})]
    }
    case RouteTreeGen.clearModals: {
      const numModals = getNumModals(navigation)
      return numModals ? [StackActions.pop({n: numModals})] : []
    }
    case RouteTreeGen.navigateUp:
      return [NavigationActions.back({key: action.payload.fromKey})]
    case RouteTreeGen.navUpToScreen: {
      const fullPath = Constants._getFullRouteForNavigator(navigation.state)
      const popActions: Array = []