freshOS / KeyboardLayoutGuide

⌨️ KeyboardLayoutGuide, back from when it didn't exist.
MIT License
1.19k stars 60 forks source link

Make the height difference in the keyboard guide reflect the key window’s safeAreaInsets instead of the owning view’s #12

Closed ethanjdiamond closed 1 year ago

ethanjdiamond commented 6 years ago

Views that are placed inside of of the safe area and aren't touching the edges don't have a safe area. Since the keyboard takes into account safe area anyway, pulling safe area off of the owning view doesn't work sometimes. This fixes that issue.

maxkonovalov commented 6 years ago

Hello @ethanjdiamond, thanks for your contribution!

As for the edit, I guess that keyWindow may not be the right thing to use here, because it actually can be a different window and not the one where the app's content is - that's especially the case when keyboard is presented. Can you please check if something like this works:

height -= owningView?.window?.safeAreaInsets.bottom ?? 0
ethanjdiamond commented 6 years ago

Good call. I'll test that out.

It also looks like this doesn't handle views who's bottoms aren't touching the bottom of the screen. I'll see if I can figure that out too.

s4cha commented 6 years ago

Hey @ethanjdiamond, I tried the PR on our project and got some odd results in some views (see screenshot attached) simulator screen shot - iphone x - 2018-08-17 at 09 56 52

I'm going to try to pinpoint the issue 🤓

Please excuse the super late reply! better late than never I guess xD

s4cha commented 6 years ago

Mmm actually I had edgesForExtendedLayout = [] for some reason that was screwing with the layout.