-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NavigatorIOS] few improvements [custom titleView, navigationItem and padding] #1024
Comments
+1 I've been working on porting an existing app as well and this is one of the biggest holes that React Native didn't handle very well by default. Some other people have tried to solve similar problems and their (quite different) implementations may provide some inspiration: https://github.com/t4t5/react-native-router https://github.com/Kureev/react-native-navbar I'm currently trying to tweak the "react-native-router" implementation to do something similar. Here's a gif of the "react-native-router" in action: (Edit: To be clear, the gif below is NOT my own work, it's the work of @t4t5) The main things that I want to be able to do:
I believe this is all possible by creating a custom wrapper around the component, but it would be nice if we could reduce the friction a little bit. |
^-- Holy hell that looks awesome. |
LoroTashi, I'm not sure if this is the issue or not.... but how do you know the return If this is the case, one thing you might want to check is to make sure that for instance, try adding a Apologies if you've already tried this.
On Tue, Apr 28, 2015 at 7:53 PM, LoroTashi notifications@github.com wrote:
|
@lelandrichardson on thanks. Yes, the overlapping issue might where the problem lies. But I did add a |
I definitely have a need for this. And not just title - also the ability to dynamically update the left/right buttons from the current route component |
Currently I've just put all the stuff into a separate routing factory that has all the possible components defined upfront so displaying a new route is as easy as calling |
Hey,
I am trying to scaffold a proof of concept of the current native iOS application we've done recently. Although everything is going flawlessly I think that NavigatorIOS can be slightly improved when it comes down to pushing new view controllers and setting custom title views. Otherwise - it's just easier to stick to native UINavigationController and expose pure ViewControllers with React with no navigation (in that particular case).
For now, AFAIK, we can only set a title on a component being pushed to a navigator when calling
It would be handy to make that component more iOS-like so it allows including custom view (e.g. an image) as a titleView inside UINavigationBar and gets navigationItem properties directly from a component so it's way cleaner and easier to maintain those properties in the future, when number of components grows.
NavigatorIOS could then look for
navigationItem
method inside a newly created component and if it's present, get those properties and update its navigationBar. Initially I was thinking about creating static methods but then, it would be harder to set e.g. title based on props passed to a component.Replace whole navigationItem with a different component:
or just overwrite a title
Same thing goes for back/forward buttons (similar to TabBar.item)
This will obviously require a new component -
NavigatorIOSBar.Item
to be created and optionally aNavigatorIOSBar
(although it can be left empty and added in the future). Also, this could've been done without touching the current behaviour so no breaking changes in the next releases (they can be marked as deprecated with a special warning printed as when using similar methods with react.js)Another thing is, when I've built my first View with a
NavigatorIOS
the View inside it (initialRoute) was hidden beneath the navigation bar. Shouldn't that padding be applied automatically on a NavigatorIOS as being done by the native implementation?What do you think? Looks like a big PR to be done but I am quite happy to take it.
The text was updated successfully, but these errors were encountered: