Skip to content
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: handle tabview background color in iOS 15 #9617

Conversation

janoshrubos
Copy link
Contributor

@janoshrubos janoshrubos commented Oct 18, 2021

PR Checklist

What is the current behavior?

In iOS15 the defined tabBackgroundColor for the TabView only get's initialized correctly for a tab with scrolling content, but to get it initialized correctly you must have switched to another tab at least once before.

What is the new behavior?

If there's a defined tabBackgroundColor it applies the color to a tab with and without ScrollView

TODO: fix Nathan's change request ui-material-bottom-navigation

Fixes #9614

@cla-bot cla-bot bot added the cla: yes label Oct 18, 2021
Copy link
Contributor

@NathanWalker NathanWalker left a comment

I'll flag as needing additional changes to ensure it doesn't accidentally merge here. I think I'll turn to draft as well.

this._ios.tabBar.barTintColor = value instanceof Color ? value.ios : value;
if (majorVersion >= 15) {
let appearance = UITabBarAppearance.new();
appearance.backgroundColor = value instanceof Color ? value.ios : value;
Copy link
Contributor

@NathanWalker NathanWalker Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @janoshrubos this is looking pretty good - there's couple other things to consider - I will be posting a PR to ui-material-bottom-navigation to fix the same issue - we also want to ensure the appearance defaults are setup properly outside of only when background is set using the configure api's, for example:
https://developer.apple.com/documentation/uikit/uibarappearance/3197997-configurewithdefaultbackground
This ensures the same expected translucency effect is maintained as it was prior to ios 15.

That api will be used when no background is set and done via initNativeView for TabView here. Then if a background is set here it would then flip it's configuration to opaque:
https://developer.apple.com/documentation/uikit/uibarappearance/3197998-configurewithopaquebackground

Copy link
Contributor Author

@janoshrubos janoshrubos Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! thanks for the info @NathanWalker, it's much clearer now.

@NathanWalker NathanWalker marked this pull request as draft Oct 18, 2021
@NathanWalker NathanWalker added this to the 8.2 milestone Oct 21, 2021
@NathanWalker NathanWalker changed the base branch from master to release/8.2.0 Feb 17, 2022
@NathanWalker NathanWalker marked this pull request as ready for review Feb 17, 2022
@NathanWalker NathanWalker merged commit cfa65d6 into NativeScript:release/8.2.0 Feb 17, 2022
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants