How to use the react-navigation.StackActions.reset 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 buttercup / buttercup-mobile / source / shared / nav.js View on Github external
export const navigateToRoot = () => {
    // navigate(ROOT_SCREEN);
    _navigator.dispatch(
        StackActions.reset({
            index: 0,
            actions: [NavigationActions.navigate({ routeName: ROOT_SCREEN })]
        })
    );
};
github 15826954460 / BXStage / app / pages / loginAndRegister / settingLoginPassword.js View on Github external
_validationPassword = () => {
    let passwordLegal = Util.checkPassword(this.state.password)

    if (passwordLegal) {
      Keyboard.dismiss()
      // 不是 android 手机的情况下才调用 notice (各种不同厂家的状态栏不一样没法统一处理)
      !this.from ? bouncedUtils.notices.show({
        type: 'success', content: '注册成功'
      }) : bouncedUtils.notices.show({
        type: 'success', content: '修改成功'
      })


      /** 跳转到首页,是否需要清空用户上次的输入信息,根据实际自行补充 */
      Routers.stackRoots.dispatch(
        StackActions.reset({
          index: 0,
          actions: [
            NavigationActions.navigate({routeName: 'MainStack'})
            // NavigationActions.navigate({routeName: 'InstalmentPage'})
          ]
        })
      )


      /** 储存用户登陆密码,到达这里,用户已经注册成功 */
      if (!this.from) {
        StorageData.mergeData('registerInfo', {
          password: this.state.password,
          hasRegister: true,
          hasLogin: true,
          ...this.props.navigation.state.params,
github RocketChat / Rocket.Chat.ReactNative / app / containers / routes / NavigationService.js View on Github external
export function goRoom({ rid, name }, counter = 0) {
	// about counter: we can call this method before navigator be set. so we have to wait, if we tried a lot, we give up ...
	if (!rid || counter > 10) {
		return;
	}
	if (!config.navigator) {
		return setTimeout(() => goRoom({ rid, name }, counter + 1), 100);
	}

	const action = StackActions.reset({
		index: 1,
		actions: [
			NavigationActions.navigate({ key: 'RoomsList', routeName: 'RoomsList' }),
			NavigationActions.navigate({ key: `Room-${ rid }`, routeName: 'Room', params: { room: { rid, name }, rid, name } })
		]
	});
	config.navigator.dispatch(action);
}
github bamlab / generator-rn-toolbox / generators / advanced-base / templates / src / pages / Login.js View on Github external
_goToHomePage() {
    // @see https://github.com/react-community/react-navigation/issues/1127
    const resetAction = StackActions.reset({
      index: 0,
      key: null,
      actions: [NavigationActions.navigate({ routeName: 'dashboard' })],
    });
    this.props.navigation.dispatch(resetAction);
  }
github SCasarotto / casarotto-chat / src / actions / LoadingActions.js View on Github external
.database()
							.ref(`Users/${uid}`)
							.once('value')
						const userModel = snapshot.val()

						firebase
							.database()
							.ref(`Users/${uid}`)
							.update({
								lastSignIn: new Date().getTime(),
								version: settings.VERSION,
							})
						if (userModel && userModel.name && userModel.avatarURL) {
							dispatch({ type: HIDE_NETWORK_ACTIVITY })
							navigation.dispatch(
								StackActions.reset({
									index: 0,
									actions: [NavigationActions.navigate({ routeName: 'Main' })],
								}),
							)
							return
						}
						dispatch({ type: HIDE_NETWORK_ACTIVITY })
						navigation.dispatch(
							StackActions.reset({
								index: 0,
								actions: [NavigationActions.navigate({ routeName: 'Setup' })],
							}),
						)
						return
					} catch (e) {
						console.log(e)
github appideasDOTcom / APPideasLights / mobile-app / react-native / AppideasLights / app / screens / ConfigScreen.js View on Github external
for( let i = 0; i < removeControllers.length; i++ )
				{
					let currentController = removeControllers[i];
					realm.delete( currentController );
				}
				realm.commitTransaction();
				
			}
		).catch(
			function( e )
			{
				console.log( e );
			}
		);
		
		const resetNavStack = StackActions.reset({
		    index: 0,
		    actions: [
		      NavigationActions.navigate({ routeName: 'Home'})
		    ] })
		this.props.navigation.dispatch( resetNavStack );
	}
github mrarronz / react-native-blog-examples / Chapter16-ReduxIntegration / ReduxIntegration / src / screen / ProfileScreen.js View on Github external
logoutAction = () => {
    const resetAction = StackActions.reset({
      index: 0,
      actions: [
        NavigationActions.navigate({ routeName: 'Login'})
      ]
    });
    this.props.navigation.dispatch(resetAction);
  };
}
github natuanorg / react-native-starter-kit / src / navigation / Navigator.js View on Github external
function reset(routeName: string, params?: NavigationParams) {
    _container.dispatch(
        StackActions.reset({
            index: 0,
            actions: [
                NavigationActions.navigate({
                    type: 'Navigation/NAVIGATE',
                    routeName,
                    params,
                }),
            ],
        }),
    );
}
github SystangoTechnologies / Crashalert / RNCrashExamples / js / components / splashscreen / index.js View on Github external
setTimeout (() => {
        const resetAction = StackActions.reset({
            index: 0,
            actions: [
                NavigationActions.navigate({ routeName: 'Home'})
            ]
        });
        this.props.navigation.dispatch(resetAction);
      }, 3100);
  }