Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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: {
React.useEffect(() => {
if (done && !error) {
dispatch(
CommonActions.reset({
routes: [{ name: Routes.Main.Home }],
}),
)
}
}, [done, error, navigation])
onPress: () => {
Vibration.vibrate([500])
navigation.dispatch(
CommonActions.reset({
routes: [{ name: Routes.Root.Tabs, params: { screen: Routes.Main.Home } }],
}),
)
},
}}