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
fix(ios): set navigation controller’s background color #11184
Conversation
Tests:
|
@@ -220,6 +220,7 @@ - (void)navigationController:(UINavigationController *)navigationController will | |||
[theWindow windowWillOpen]; | |||
[theWindow windowDidOpen]; | |||
} | |||
navController.view.backgroundColor = theWindow.view.backgroundColor; |
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.
It feels like a workaround, since thats not necessary natively. Can you please go through the view tree and check the differences between native views / VC's?
FR Passed for this part of the fix. Studio Ver: 5.1.3.201907112159 |
controller.navigationController.navigationBar.backgroundColor = UIColor.clearColor; | ||
} | ||
} | ||
#endif |
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.
This looks very very hacky and I feel like it's not fixing the actual issue but only workarounding the visual glitches. I hope there can be found a proper fix for this issue.
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.
In addition, the navigation bar now shows a different color than the background color of the window.
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.
@hansemannn Yeah. It's kind of hack. In native apps as well people suggest same. See here. And this will work without any visual issue.
In context of property 'largeTitleEnabled' is 'true' in iOS 13-
A). As for as navigation bar color and transition similar to native behaviour is concerned. For that above SDK changes are not required. To make it work by default we have to make changes as per point C. If you want this to work in your app now, you have to modify your code-
- You have to set window's property 'extendEdges' to [Ti.UI.EXTEND_EDGE_TOP]. By default it is Ti.UI.EXTEND_EDGE_NONE.
- Set 'translucent' property to 'true'. By default it is 'true'
- If you are using tableview, listview or scrollview (basically view’s having scroll view) on window, it will work perfect.
- If you are using any other view other than views in point 3, you have to set ‘top’ property of view to height of navigation bar. Otherwise it will move up and overlap with navigation bar.
B). As you have mentioned navigation bar color is different than the bar color. I guess you are using "barColor" property to set. In SDK code barColor has preference over backgroundColor of window. See the attached examples in ticket, it is working fine. You always have option to set 'barColor'.
C). In native development, property 'edgesForExtendedLayout' is by default UIRectEdgeAll and default value of 'translucent' is 'true'. So it takes the background color of controller's view. If you use tableview or scrollview it will work perfect. If you want to create any other view with position (0, 0, width, height). It'll overlap with navigation bar. To avoid this problem there is option to use autolayout constraints.
In titanium auto layout is in beta. So we can not use that.
I'll create a new ticket to change default behaviour of window's property extendEdges to Ti.UI.EXTEND_EDGE_ALL, which apple recommends. And probably need to handle window's layout if there is navigation bar(which will need more work).
https://jira.appcelerator.org/browse/TIMOB-27263