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 ok406lhq / RTCoin / src / page / Login / loginPage.js View on Github external
import React, {Component} from 'react';
import {View, Text, StyleSheet, TextInput,StatusBar} from 'react-native';
import {connect} from 'react-redux'; // 引入connect函数
import * as loginAction from './loginAction';// 导入action方法
import {NavigationActions, StackActions} from 'react-navigation';
import {THEME_BACKGROUND, THEME_LABEL, THEME_TEXT} from '../../assets/css/color';
import CButton from '../../common/button';

// 清空导航记录,跳转到首页
const resetAction = StackActions.reset({
    index: 0,
    actions: [
        NavigationActions.navigate({routeName: 'Main'})
    ]
});

class LoginPage extends Component {
    static navigationOptions = {
        header: null
    };


    mobile = '13510005217';
    password = '123456';

    constructor(props) {
        super(props);
        this.state = {message: ''};
    }
github GGwujun / two-week / App.js View on Github external
index: 0,
                      actions: [NavigationActions.init({
                        routeName: 'Tab',
                        params: {
                          user: this.state.user,
                          partner: this.state.partner,
                          timestamp: this.state.user.timestamp
                        }
                      })]
                    })
                    this.props.navigation.dispatch(resetAction)
                  } else {
                    const resetAction = NavigationActions.reset({
                      index: 0,
                      actions: [
                        NavigationActions.navigate({ routeName: 'LoginPage' })
                      ]
                    })
                    this.props.navigation.dispatch(resetAction)
                  }
                }).catch(error => { })
              }
github textileio / photos / App / Containers / AddThreadScreen.js View on Github external
{
            if (params.backTo) {
              navigation.dispatch(NavigationActions.navigate({ routeName: params.backTo }))
            } else {
              navigation.dispatch(NavigationActions.back())
            }
          }} />
github SocialXNetwork / socialx_react_native / packages / RNSocialX / src / enhancers / helpers / resetNavigationToRoute.ts View on Github external
export const resetNavigationToRoute = (
	routeName: string,
	navigation: NavigationScreenProp,
) => {
	const navigate = NavigationActions.navigate({ routeName });
	const reset = StackActions.reset({
		index: 0,
		actions: [navigate],
		key: null,
	});

	navigation.dispatch(reset);
};
github ifgyong / demo / React-native / Helloword / js / Page_04.js View on Github external
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View,TouchableHighlight,Alert,Button,Animated} from 'react-native';
import { createStackNavigator, createAppContainer,NavigationActions } from 'react-navigation';
import FadeInView from '../js/FadeInView.js'
const navigateAction = NavigationActions.navigate({
  routeName: 'Page_05_p',

  params: {},

  action: NavigationActions.navigate({ routeName: 'Page_04_p' }),
});

export default class Page_04 extends React.Component {

    render() {
      return (
github iran-react-community / elegant-react-native / app / view / components / Splash.js View on Github external
async componentDidMount () {
    const { auth } = this.props

    await auth.isAuthenticated()
    
    const resetAction = NavigationActions.reset({
      index: 0,
      actions: [NavigationActions.navigate({ routeName: 'home' })],
    });
    this.props.navigation.dispatch(resetAction)
  }
github JetBrains / youtrack-mobile / src / components / router / router.js View on Github external
if (!this.routes[routeName]) {
      throw `no such route ${routeName}`;
    }

    if (this.rootRoutes.includes(routeName)) {
      flushStoragePart({lastRoute: routeName});
    }

    const newRoute = Object.assign({}, this.routes[routeName]);
    newRoute.props = Object.assign({}, newRoute.props, props);

    if (newRoute.type === 'reset' || forceReset) {
      return this._navigator.dispatch(StackActions.reset({
        index: 0,
        actions: [NavigationActions.navigate({routeName, params: newRoute.props, key: Math.random().toString()})]
      }));
    }

    this._navigator.dispatch(NavigationActions.navigate({
      routeName,
      params: newRoute.props,
      key: Math.random().toString()
    }));
  }
github iZaL / real-estate-app-ui / src / property / common / sagas.js View on Github external
function* deleteProperty(action) {
  try {
    const state = yield select();
    const apiToken = AUTH_SELECTORS.getAuthToken(state);

    if (isEmpty(apiToken)) {
      yield put(APP_ACTIONS.setNotification('Please Login', 'error'));
      return yield put(
        NavigationActions.navigate({
          routeName: 'Login',
        }),
      );
    }
    const urlParams = `?api_token=${apiToken}`;
    const response = yield call(API.deleteProperty, urlParams, action.params);

    yield put({
      type: ACTION_TYPES.PROPERTY_DELETE_SUCCESS,
      payload: response,
    });
    yield put(APP_ACTIONS.setNotification('Property Deleted', 'success'));
  } catch (error) {
    yield put({type: ACTION_TYPES.PROPERTY_DELETE_FAILURE, error});
  }
}
github kegesch / passman-ios / src / components / screens / settings / ConnectionSettingsScreen.tsx View on Github external
async resetApp() {
		await this.props.connectionStore.resetConnection();
		await this.props.masterPasswordStore.reset();
		await this.props.vaultStore.reset();

		const resetAction = StackActions.reset({
			index: 0,
			key: null,
			actions: [
				NavigationActions.navigate({ routeName: 'LoginScreen', params: { resetOrder: 1 }})
			]
		});
		this.props.navigation.dispatch(resetAction);
	}
github ovr / ghubber / actions / navigation.js View on Github external
export function showAccountIssues() {
    return NavigationActions.navigate({
        routeName: 'AccountIssues',
    });
}