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

Allow setting UITabBarItem.title to default value #5280

Merged
merged 2 commits into from
Jul 17, 2019

Conversation

danilobuerger
Copy link
Collaborator

The default value for UITabBarItem.title is nil as specified by the docs:

You should set this property before adding the item to a bar. The default value is nil.
https://developer.apple.com/documentation/uikit/uibaritem/1616412-title

This changes allows for this to be nil.

The default value for `UITabBarItem.title` is `nil` as specified by the docs:
> You should set this property before adding the item to a bar. The default value is nil.
https://developer.apple.com/documentation/uikit/uibaritem/1616412-title

This changes allows for this to be `nil`.
@guyca
Copy link
Collaborator

guyca commented Jul 17, 2019

Hey @danilobuerger, Thanks for the PR.
Out of curiosity, Has the current logic of setting empty string cause any bugs?

@danilobuerger
Copy link
Collaborator Author

@guyca I came across this while trying to vertically center tab items on iOS when there is no title and taking the horizontal size class into account (on iPad >= iOS 11, the title is rendered to the side of the icon, not beneath, so they are already vertically centered and don't need a inset). This can't be achieved via js-land as it requires handling inside the traitCollectionDidChange callback. Anyway, while doing that, I came across this and just made the PR to get the correct setting. It doesn't actually fix a bug (that I know of).

As a side note: If centering tab items while taking horizontal size classes into account is something desired by rnn, I can submit a separate PR for that too.

@guyca
Copy link
Collaborator

guyca commented Jul 17, 2019

I wasn't aware there's an issue with tab items not being centered. If you can resolve the issue in your own project, I suggest we refrain from making a PR regarding this until there are issues reported about it.

@guyca guyca merged commit 76d832b into wix:master Jul 17, 2019
vshkl pushed a commit to vshkl/react-native-navigation that referenced this pull request Feb 5, 2020
The default value for `UITabBarItem.title` is `nil` as specified by the docs:
> You should set this property before adding the item to a bar. The default value is nil.
https://developer.apple.com/documentation/uikit/uibaritem/1616412-title

This changes allows for this to be `nil`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants