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 scrollToItem appearing underneath sticky header #279

Merged
merged 2 commits into from
Mar 12, 2021

Conversation

lokae0
Copy link
Collaborator

@lokae0 lokae0 commented Mar 12, 2021

When a top scroll position is used, the item will appear underneath the sticky section header.
Now, we adjust the frame and use a manual content offset when sticky headers are enabled.

When sticky headers are disabled or scrolling to a different position, we call the existing scrollToItem function on UICollectionView.

Note this PR depends on the performScrollToTargetFrame function added in #277, so that one will need to be merged before this one builds.


Example scrolling to Row # 50, 2:

Before:

scroll_to_item_not_fixed


After:

scroll_to_item_fixed

@lokae0 lokae0 requested a review from kyleve March 12, 2021 19:52
lokae0 added 2 commits March 12, 2021 13:05
When a `top` scroll position is used, the item will appear underneath the sticky section header.
Now, we adjust the frame and use a manual content offset when sticky headers are enabled.
When sticky headers are disabled or scrolling to a different position, we call the existing `scrollToItem` function on UICollectionView.
@lokae0 lokae0 force-pushed the fix-item-under-header branch from 6ca2e07 to 3c5bb7a Compare March 12, 2021 21:06
@lokae0 lokae0 enabled auto-merge March 12, 2021 21:08
@lokae0 lokae0 disabled auto-merge March 12, 2021 21:09
@lokae0 lokae0 enabled auto-merge March 12, 2021 21:11
@lokae0 lokae0 merged commit cdb5ee2 into square:main Mar 12, 2021
@lokae0 lokae0 deleted the fix-item-under-header branch March 12, 2021 22:03
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