-
Notifications
You must be signed in to change notification settings - Fork 139
✨Upgrade React Navigation to V5 ✨ #311
✨Upgrade React Navigation to V5 ✨ #311
Conversation
|
Just curious, if I have an ignite based app with react-navigation 4.x and upgrade the app to use react-navigation v5 will this be seamless for production apps or will they crash or "loose" the route state? |
I don't think it will be "seamless" because we are now storing navigation state separately and not part of the MobX store. You would probably want to reset the user's storage or version your stores so that you can easily migrate them just to be sure. |
|
@harrisrobin that's a well-crafted PR, any reason why mobx is not used to store navigation state, is it because react-navigation already provides a way to do that? |
It's not possible to do it anymore in v5 and is not recommended by the react-navigation team. |
|
This woulod be great to be integrated. Has anyone been able to get this to work? I've struggled, though left an 'issue' on the repo. |
@fortydegrees you can always generate a project using this branch to test it.
|
|
Can confirm that this update works seamlessly! |
|
@harrisrobin Can you run |
robinheinze
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harrisrobin This is really great, thorough PR. Really nice work 🎉 I just mentioned one super tiny change, since I think it might break model generators, but otherwise it looks awesome.
|
@harrisrobin Actually, you might also want to double check the screen and navigator generators. The screen one inserts the new screen into the root navigator so I think this would introduce some changes there, and the generated navigator will look different as well. |
|
any updates when this PR is going to be merged |
|
@osamaaamer95 @robinheinze done in c58583a |
|
@harrisrobin what about I am using this in a project (couldn't wait for this PR to be merged) and it works as expected. |
I personally don't handle paddingBottom in
I prefer to use the hook instead. The ternary with View/SafeAreaView causes typescript to complain when passing certain props. |
|
The use-case is on Android where content goes under the transparent/translucent navigation bar if no padding is applied. |
|
i saw this pr not enough to ready merge |
# [5.0.0](v4.14.3...v5.0.0) (2020-03-29) * ✨Upgrade React Navigation to V5 ✨ (#311 by @harrisrobin) ([f68ec23](f68ec23)), closes [#311](#311) ### BREAKING CHANGES * * React Navigation upgraded to version 5, a backwards incompatible change * Navigation state is no longer handled in MobX-State-Tree * Removed `NavigationStore` * Navigation state is now handled in React hooks (also persisted to async storage) * Back button handler is a hook now rather than a component * Added `react-native-safe-area-context` wrapping the primary navigator * Removed `ignite g navigator` generator * Screen generator no longer tries to add the new screen to a navigator
|
🎉 This PR is included in version 5.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
@harrisrobin @robinheinze I've noticed that in this ticket you've removed NavigationStore. I would love if you can help me by providing an example for navigating with params between screens. I was following this tutorial https://reactnavigation.org/docs/MST-integration/#overview |
|
@anasjaghoub Thanks for your comment -- we're working on some additional examples and documentation as well as a blog post! |
|
that's great @jamonholmgren can't wait for it! Best wishes. |
This PR upgrade react-navigation to v5 while maintaining all the functionality such as navigation state persistence & back button handler.
✅ upgrade to react-navigation v5
✅ migrate existing back button handler and navigation persistence to the recommended way of doing it in V5.
✅ use react-native-safearea-context instead of SafeAreaView
Demo
This project was generated using Bowser with my changes to include React Navigation V5:
https://github.com/harrisrobin/ignite-bowser-react-navigation-v5