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 content inset issues with scroll indicators and keyboard insets #103

Merged
merged 2 commits into from
Mar 6, 2020

Conversation

kylebshr
Copy link
Collaborator

@kylebshr kylebshr commented Mar 6, 2020

This PR fixes an issue with the scroll indicator insets not being set to match the content insets, which is almost always the correct behavior. In the first GIF you can see the scroll indicator disappears behind the keyboard, while the in the second gif it matches the content size.

This PR also fixes an issue when calculating the inset to add to adjust for a visible keyboard. I chose to subtract the bottom content inset from the calculation, as the collection view keeps the safe area inset in addition to insets you set. Another option might be to disable safe area inset adjustments entirely, but then we would lose the automatic adjustment when in most cases we want it. In the first GIF you can see the gap between the collection view content and the keyboard. In the second, there's no gap. Both have the correct safe area when the keyboard is not visible.

Before After
Kapture 2020-03-06 at 10 07 32 Kapture 2020-03-06 at 10 05 11

@kyleve
Copy link
Collaborator

kyleve commented Mar 6, 2020

Any idea if this also resolves #85 ?

@kylebshr
Copy link
Collaborator Author

kylebshr commented Mar 6, 2020

It's not super clear to me what the issue was for #85, what's the incorrect behavior on <= iOS 10?

@kyleve
Copy link
Collaborator

kyleve commented Mar 6, 2020

It's not super clear to me what the issue was for #85, what's the incorrect behavior on <= iOS 10?

On iOS 10, the scroll view sets the contentInset for tab bar or nav bar insets – because iOS 7+ underflowed those controls, but safe area wasnt a thing until iOS 11. Reading this, I dont think this makes it any better or worse, so, yay

@kyleve
Copy link
Collaborator

kyleve commented Mar 6, 2020

Also, I never even knew scrollIndicatorInsets was a thing. TIL!

@kylebshr
Copy link
Collaborator Author

kylebshr commented Mar 6, 2020 via email

@kylebshr kylebshr merged commit 9824b4b into master Mar 6, 2020
@kylebshr kylebshr deleted the kyle/inset-fixes branch March 6, 2020 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants