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

Support tab bar height #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MikeDonahue
Copy link

We had an issue when using this when a keyboard was being used in a VC that was presented modally by a tab controller, when the tab bar isn't visible.

The following comment presented a solution that worked:
#19 (comment)

But it only checked if the root view controller was a tab bar. My solution will look at the current visible view controller, and check if it has a tab bar controller where it is not hidden, and account for the tab bar height.

This works in our app with a pretty complicated navigation setup with Navigation Controllers and Tab Controllers, pushing and presenting, but it would be nice to get some other testing on this in other cases. Worst case, it will not change anything if the current view controller doesn't have a tabBarController.

@s4cha
Copy link
Member

s4cha commented Jan 17, 2022

Hey @MikeDonahue, thanks a ton for taking the time to solve this issue for everyone else.
Sadly, I have tried to reproduce this issue to no avail. Could you provide a sample code/project that would trigger this issue?
I'd love to see (and understand) the fix before merging.
Cheers,

@MikeDonahue
Copy link
Author

Sorry for just now seeing this @s4cha, I'd have to spend some time putting together a sample project, but I can quickly describe the setup that triggered this.

  1. Set up a UITabBarController with a UINavigationController as a tab's view controller.
  2. Push a view controller (inside the tab view, so the tabs are still visible after the push) with a text view/field that is constraint to the keyboard layout guide.

To show you before the textview becomes the first responder....

Screen Shot 2022-03-15 at 3 20 43 PM

As it becomes the first responder, you should see that there is an extra space from the keyboard layout guide because the tab bar height isn't factored into the constraint constant when the keyboard is shown.

Screen Shot 2022-03-15 at 3 20 49 PM

And after this PR's adjustments...

Screen Shot 2022-03-15 at 3 23 20 PM

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