react-navigation / redux-helpers

Redux middleware and utils for React Navigation
Other
296 stars 43 forks source link

React Nav 5 support - undefined is not object _core.NavigationActions.init #106

Closed JherysVargas closed 4 years ago

JherysVargas commented 4 years ago

Could someone help me solve this error? errorNavigation

manuel90 commented 4 years ago

The same error here!

Ashoat commented 4 years ago

Not sure what's going on. Are you guys using the new React Navigation 5? I haven't checked on compatibility for that version yet.

JherysVargas commented 4 years ago

I have already managed to solve it, react navigation v5 advises not to save navigation in redux, if you are using redux and this library https://github.com/react-navigation/redux-helpers you have to uninstall it and configure your store to not save navigation in redux, with that configuration you can implement without problem react navigation v5.

Ashoat commented 4 years ago

That makes sense! Most people shouldn’t be using this library anyways. When I upgrade to React Navigation 5 I’ll look into how hard it would be to keep this library working with it. Will leave this issue open to track React Navigation 5 compatibility for now

Ashoat commented 4 years ago

For a whole lot of reasons, including that React Navigation 5 no longer adheres to the "Flux" model of constraining state changes to actions, it's not going to be possible to keep this library going.

sraka1 commented 4 years ago

@Ashoat how did you tackle the issue of maintaining the same navigational state when migrating to React-Navigation v5 and consequently away from this library. I.e. user is on a specific screen HomeStack -> PersonStack -> PersonScreen and then updates the app which has an underlying upgrade to React Navigation v5. Do we need to roll a custom solution to make sure the new internal state matches the one in redux or is there something available?

Ashoat commented 4 years ago

My app doesn't persist navigation state in production, so I'm not sure. I'm not aware of any utilities to convert the v4 navigation state format into the new one, but if an official one exists it would be in @react-navigation/compat. If this is absolutely necessary in your case, my guess is that you'll need to write your own solution.