redux-react-navigation-demos icon indicating copy to clipboard operation
redux-react-navigation-demos copied to clipboard

Log out error

Open rammuk opened this issue 8 years ago • 3 comments

Hi,

I am running your example ( nestedNavigators ) and when I press Logout on the logout screen I get the following error

Unhandled JS Exception: Invariant Violation: Cannot get config because the route does not have a routeName.

I am just starting to use the react navigation with redux so I would appreciate the help, I am sure it's something small and stupid so thanks in advance

rammuk avatar Dec 04 '17 17:12 rammuk

I'm also looking into this issue. Seems like a similar issue to one presented here: https://github.com/react-navigation/react-navigation/issues/2282.

The issue described there is that the nav config is not available on the child components natively like it is on the main screens. In order to make it available to the child components you have to use withNavigation to pass the navigator to the child components. Admittedly I'm still trying to figure out how to make this work in this setup but if I make any progress I'll post back here.

JonnyBoy333 avatar Dec 31 '17 03:12 JonnyBoy333

Hi!

I've encountered the same issue, and replacing the "Logout" case in the navigationReducer solved me:

case Logout:
  return initialState;

pr0da avatar Jan 18 '18 15:01 pr0da

I replaced:

actions: [NavigationActions.init({ routeName: "login" })]

with:

actions: [NavigationActions.navigate({ routeName: "login" })]

In the navigation reducer, in the logout handler. Seems to work?

krewllobster avatar Jan 25 '18 19:01 krewllobster