How to use the react-navigation.NavigationActions.NAVIGATE 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 mengwangk / myInvestor / myInvestor-app / myInvestor / App / Redux / ScreenTrackingMiddleware.js View on Github external
const screenTracking = ({ getState }) => next => action => {
  if (
    action.type !== NavigationActions.NAVIGATE &&
    action.type !== NavigationActions.BACK
  ) {
    return next(action);
  }

  const currentScreen = getCurrentRouteName(getState().nav);
  const result = next(action);
  const nextScreen = getCurrentRouteName(getState().nav);
  if (nextScreen !== currentScreen) {
    try {
      if (__DEV__ && console.tron) {
        console.tron.log(`NAVIGATING ${currentScreen} to ${nextScreen}`);
      }
      // Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
    } catch (e) {
      console.tron.log(e);
github textileio / photos / App / Redux / ScreenTrackingMiddleware.js View on Github external
const screenTracking = ({ getState }) => next => (action) => {
  if (
    action.type !== NavigationActions.NAVIGATE &&
    action.type !== NavigationActions.BACK
  ) {
    return next(action)
  }

  const currentScreen = getCurrentRouteName(getState().nav)
  const result = next(action)
  const nextScreen = getCurrentRouteName(getState().nav)
  if (nextScreen !== currentScreen) {
    try {
      console.tron.log(`NAVIGATING ${currentScreen} to ${nextScreen}`)
      // Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
    } catch (e) {
      console.tron.log(e)
    }
  }
github aerian-studios / ignite-typescript-boilerplate / boilerplate / App / Reducers / ScreenTrackingMiddleware.tsx View on Github external
const screenTracking = ({ getState }) => (next) => (action) => {
  if (
    action.type !== NavigationActions.NAVIGATE &&
    action.type !== NavigationActions.BACK
  ) {
    return next(action);
  }

  const currentScreen = getCurrentRouteName(getState().nav);
  const result = next(action);
  const nextScreen = getCurrentRouteName(getState().nav);
  if (nextScreen !== currentScreen) {
    try {
      Reactotron.log(`NAVIGATING ${currentScreen} to ${nextScreen}`);
      // Example: Analytics.trackEvent('user_navigation', {currentScreen, nextScreen})
    } catch (e) {
      Reactotron.log(e);
    }
  }
github UCSD / campus-mobile / app / navigation / withNavigationPreventDuplicate.js View on Github external
const getStateForActionWithoutDuplicates = (action, state) => {
		if (action.type === NavigationActions.NAVIGATE) {
			const previousRoute = getActiveRouteForState(StateUtils.back(state))
			const currentRoute = getActiveRouteForState(state)
			const nextRoute = action

			if (
				isDrawerRoute(currentRoute) &&
				(
					isEqualRoute(previousRoute, nextRoute) ||
					areDuplicateRoots(state.routes, nextRoute.routeName)
				)
			) {
				return StateUtils.back(state) // Close drawer
			}

			if (
				isEqualRoute(currentRoute, nextRoute) ||
github mobius-network / wallet / src / state / navigator / index.js View on Github external
function navigate(navigatorType, routeName, params = {}, key) {
  const navigator = navigators[navigatorType];

  if (!navigator) {
    return;
  }

  const payload = {
    key,
    params,
    routeName,
    type: NavigationActions.NAVIGATE,
  };

  navigator.dispatch(NavigationActions.navigate(payload));
}
github Skjutsgruppen / skjutsgruppen-reactnative / app / redux / screenTracker.js View on Github external
const screenTracker = ({ getState }) => next => (action) => {
  if (
    action.type !== NavigationActions.NAVIGATE
    && action.type !== NavigationActions.BACK
  ) {
    return next(action);
  }

  const currentScreen = getCurrentRouteName(getState().nav);
  const result = next(action);
  const nextScreen = getCurrentRouteName(getState().nav);
  if (nextScreen !== currentScreen) {
    tracker.trackScreenView(nextScreen);
  }
  return result;
};
github RocketChat / Rocket.Chat.ReactNative / app / tablet.js View on Github external
RoomContainer.router.getStateForAction = (action, state) => {
		if (action.type === NavigationActions.NAVIGATE && isSplited()) {
			const { routeName, params } = action;
			if (routeName === 'RoomActionsView') {
				modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
				setState({ showModal: true });
				return null;
			}
			if (routeName === 'AttachmentView') {
				modalRef.dispatch(NavigationActions.navigate({ routeName, params }));
				setState({ showModal: true });
				return null;
			}
		}
		if (action.type === 'Navigation/RESET' && isSplited()) {
			const { params } = action.actions[action.index];
			const routes = state.routes[state.index] && state.routes[state.index].params;
			if (params && params.rid && routes && routes.rid && params.rid === routes.rid) {
github voximplant / react-native-demo / src / routes / NavigationService.js View on Github external
function navigate(routeName, params) {
    _navigator.dispatch(
        NavigationActions.navigate({
            type: NavigationActions.NAVIGATE,
            routeName,
            params,
        })
    );
}
github mikelambert / dancedeets-monorepo / mobile / js / containers / screens / Navigator.js View on Github external
) => (action: NavigationAction, state: NavigationState) => {
  const { type } = action;
  if (state && type === NavigationActions.NAVIGATE) {
    const { routeName } = action;
    if (routeName === state.routes[state.routes.length - 1].routeName) {
      return state;
    }
  }
  return getStateForAction(action, state);
};
github syun0216 / goforeat / app / permission.js View on Github external
const authRoutes = [
        "MyOrderDrawer",
        "Order",
        "PayTypeDrawer",
        "CouponDrawer",
        "Credit",
        "Manage_Card",
        "UserInfoDrawer",
        "Coupon",
        "MyOrder",
        "PayType",
        "UserInfo",
        "MonthTicket",
        "MonthTicketDrawer"
    ];
    if (state && action.type == NavigationActions.NAVIGATE) {
        return (
            authRoutes.indexOf(action.routeName) > -1 &&
            store.getState().auth.username == null
        );
    } else {
        return false;
    }
}