7

I want to perform two actions but it doesn't work.

const backAction = NavigationActions.back({
    key: null
})
const dispatchLogoutAction = NavigationActions.reset({
    index: 0,
    actions: [NavigationActions.navigate({routeName: "LoginView"})]
});
nextProps.navigation.dispatch(backAction);
nextProps.navigation.dispatch(dispatchLogoutAction);

What other ways to dispatch both actions in react-navigation rather than listing dispatch statements parallelly?

merry-go-round
  • 4,533
  • 10
  • 54
  • 102
  • This is continuous problem from https://stackoverflow.com/questions/47930049/how-to-reset-all-screens-when-user-logs-out-scroll-and-page-index – merry-go-round Jan 02 '18 at 10:02
  • Further question: https://stackoverflow.com/questions/48059045/how-do-we-call-the-specific-type-of-action-in-react-navigation – merry-go-round Jan 02 '18 at 10:15
  • Why do you want to dispatch two actions at once? Probably then what you want to do should go into one action that you then dispatch? – Fapi Jun 09 '22 at 06:35

0 Answers0