CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 78
Add a Navigation Library #501
Description
For consignments I need to show a modal, with navigation between VCs inside it. I could push this to Eigen, but realistically this is something that over time we'll want to do more of inside Emission. Especially as a bunch of messaging work will probably need it #495
This is a good nuanced issue on the discussion on the state of the Art for Navigation libs.
Constraints:
- We don't have any cross-platform code, but are interested in keeping that option open.
- We're doing this app as an iOS 1st party citizen, not interested in abstractions that don't use real OS components.
Current choices:
NavigatorIOS Official
This is the current de-facto navigation option shipped with RN for iOS people. It's not cross platform, either with web or android. Looks pretty solid for our use cases.
Navigation Docs Official
The docs recommend NavigatoriOS
and React Navigation
React Navigation
Cross-platform and could work with web stuff. Looks like the nicest overall, but it doesn't use the native view controllers. This means you get fake UIViewControllers et al.
This is an acceptable trade-off for web people coming to native, but not an acceptable trade-off for native devs using JS. Note the "Ello" behind the current screen - that's the last screen, still in memory.
note: This issue has been (experimentally) solved in react-navigation with https://github.com/kmagiera/react-native-screens.
React Router Native
Same trade-offs as React Navigation, but would work even better with web as it's got API parity with react-router a popular web library.
React-Native Navigation
Cross-platform, third party, mature and maintained but in the midst of a big rewrite which is never great when you're deciding on a dependency. Rewrite aims for:
Complete API redesign, react-native-controllers deprecation and merge, android and iOS redesign, (almost) complete feature parity, screen lifecycle, static Navigation commands, commands per screenId, complete test coverage
So any code added today will definitely need to change tomorrow. Not optimal.
Native Navigation
A big minus for being built in Swift. Forces any app we use Emission in to use the same toolchain as Airbnb. This lib is also not used in any of their production apps either. Too soon ™️.
Shame, they have the same kind of design constraints as we do, would have been nice to work with.
Why no Swift?
TLDR: RN is bleeding edge, Swift is bleeding edge, keeps our focus on only one place to get burned.
We do have Swift in Eigen, which uses our React Native - that is something that we probably won't be undoing. But other iOS apps that we have (including the host app for these components) are Obj-C only. I don't want to force every app into the Swift rat-race for the needs of a transitive dependency on the app. Longer summary here.
Sumary
And so, it looks like today, I think NavigatorIOS
from core is probably the best option. This should be looked at again once React-Native Navigation v2 is at like 2.1, or 2.2. There definitely is a movement towards deprecating the class, but it's been there for a very long time so we'll have some warning.
If we're forced into a corner where we need something better, then React-Native Navigation is probably the next best option for our constraints.