How to use the @react-navigation/native.CommonActions.reset function in @react-navigation/native

To help you get started, we’ve selected a few @react-navigation/native 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 berty / berty / js / packages / navigation / stacks.tsx View on Github external
useEffect(() => {
		switch (context.appState) {
			case MessengerAppState.GetStarted:
				dispatch(
					CommonActions.reset({
						routes: [{ name: Routes.Onboarding.GetStarted }],
					}),
				)
				return

			case MessengerAppState.OnBoarding:
				navigate(Routes.Onboarding.CreateAccount, {})
				return

			case MessengerAppState.Ready:
				dispatch(
					CommonActions.reset({
						routes: [{ name: Routes.Main.Home }],
					}),
				)
				return
github berty / berty / js / packages / navigation / hook.ts View on Github external
reset: (type: string) => {
			if (type === 'Onboarding') {
				dispatch(
					CommonActions.reset({
						routes: [{ name: Routes.Onboarding.GetStarted }],
					}),
				)
				dispatch(CommonActions.navigate(Routes.Main.Home))
			} else {
				dispatch(
					CommonActions.reset({
						routes: [{ name: Routes.Main.Home }],
					}),
				)
				dispatch(CommonActions.navigate(Routes.Onboarding.GetStarted))
			}
		},
		navigate: {
github berty / berty / js / packages / components / modals / AddThisContact.tsx View on Github external
React.useEffect(() => {
		if (done && !error) {
			dispatch(
				CommonActions.reset({
					routes: [{ name: Routes.Main.Home }],
				}),
			)
		}
	}, [done, error, navigation])
github berty / berty / js / packages / components / Onboarding.tsx View on Github external
onPress: () => {
										Vibration.vibrate([500])
										navigation.dispatch(
											CommonActions.reset({
												routes: [{ name: Routes.Root.Tabs, params: { screen: Routes.Main.Home } }],
											}),
										)
									},
								}}