How to use the react-navigation.NavigationActions.back function in react-navigation

To help you get started, we’ve selected a few react-navigation 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 TrustTheBoy / react-native-component-redux / App / reducers / index.js View on Github external
function nav(state = initialNavState, action) {
  let nextState;
  switch (action.type) {
    case 'Login':
      nextState = AppNavigator.router.getStateForAction(
        NavigationActions.back(),
        state
      );
      break;
    case 'Logout':
      nextState = AppNavigator.router.getStateForAction(
        NavigationActions.navigate({ routeName: 'Login' }),
        state
      );
      break;
    default:
      nextState = AppNavigator.router.getStateForAction(action, state);
      break;
  }

  // Simply return the original `state` if `nextState` is null or undefined.
  return nextState || state;
github nihgwu / react-native-dva-starter / app / router.js View on Github external
backHandle = () => {
    const currentScreen = getActiveRouteName(this.props.router)
    if (currentScreen === 'Login') {
      return true
    }
    if (currentScreen !== 'Home') {
      this.props.dispatch(NavigationActions.back())
      return true
    }
    return false
  }
github goldennetwork / golden-wallet-react-native / app / modules / WalletList / screen / NewUpdatedAvailableScreen.js View on Github external
goBack = () => {
    const { navigation } = this.props
    navigation.dispatch(NavigationActions.back())
    MainStore.appState.setShouldShowUpdatePopup(false)
    MainStore.appState.setLastestVersionRead(this.lastestVersion)
    MainStore.appState.save()
  }
github apiko-dev / Perfi / app / screens / TransferEditor / TransferEditorContainer.js View on Github external
onSubmit: ({ createTransfer, navigation, ...props }) => () => {
      createTransfer({
        ...R.pick(fields, props),
        from: R.prop('id', props.from),
        to: R.prop('id', props.to),
      });

      navigation.dispatch(NavigationActions.back());
    },
  }),
github textileio / photos / App / SB / views / Storage / index.tsx View on Github external
const goBack = () => {
      navigation.dispatch(NavigationActions.back())
    }
    return {
github rotembcohen / pokerBuddyApp / UtilFunctions.js View on Github external
export function backOneScreen(navigation){
	const backAction = NavigationActions.back();
	navigation.dispatch(backAction);
}
github textileio / photos / App / SB / views / UserOnBoarding / UpdateAvatar.js View on Github external
{
            params.cancelProfileUpdate()
            if (params.backTo) {
              navigation.dispatch(NavigationActions.navigate({ routeName: params.backTo }))
            } else {
              navigation.dispatch(NavigationActions.back())
            }
          }} />
github winoteam / react-router-navigation / packages / react-router-navigation / src / DefaultNavigationRenderer.js View on Github external
dispatch: action => {
            if (action.type === NavigationActions.back().type) {
              onNavigateBack()
            }
          },
        })}
github zxj963577494 / OverWatchTeams-React-Native-Expo / src / index.js View on Github external
onBackPress = () => {
    const { dispatch, nav } = this.props
    if (nav.routes[0].index === 0) {
      if (this.lastBackPressed && this.lastBackPressed + 2000 >= Date.now()) {
        BackHandler.exitApp()
        return true
      }
      this.lastBackPressed = Date.now()
      Toast.show('再按一次退出应用')
      return true
    } else {
      dispatch(NavigationActions.back())
      return true
    }
  }
github gyxing / react-native-book / app / router.js View on Github external
backHandle = () => {
    const currentScreen = getCurrentScreen(this.props.router)
    if (currentScreen === 'Login') {
      return true
    }
    if (currentScreen !== 'Home') {
      this.props.dispatch(NavigationActions.back())
      return true
    }
    return false
  }