-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Implement pinned (sticky) header and footer #80
base: master
Are you sure you want to change the base?
Conversation
@@ -619,7 +627,7 @@ open class CollectionViewChatLayout: UICollectionViewLayout { | |||
|| (isUserInitiatedScrolling && state == .beforeUpdate) | |||
|
|||
invalidationActions.remove(.shouldInvalidateOnBoundsChange) | |||
return shouldInvalidateLayout | |||
return shouldInvalidateLayout || hasPinnedHeaderOrFooter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the footer and header are properly updated when the bounds change, in the same way as in MagazineLayout.
( The default behavior of UICollectionViewCompositionalLayout also always returns true when section pinToVisibleBounds is set. )
5791b05
to
9fdab05
Compare
@heoblitz Amazing job. Ill have a proper look and merge. Thank you. |
@heoblitz Sorry, I was on my vacation. Got back. Will have a proper look and merge. |
@ekazaev Hope you had a great vacation! Please feel free to review it at your convenience. Thank you. |
What is this PR for?
This PR introduces support for pinned (sticky) headers and footers. The implementation allows headers and footers to stay visible within the collection view's bounds.
The changes will not impact existing ChatLayout users who do not utilize the pinned feature.
Related PR: airbnb/MagazineLayout#52
Tests
test project: ChatLayoutPinTest.zip
1. Scroll
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-10-25.at.22.24.45.mp4
2. Scroll with contentInsets
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-10-25.at.22.30.31.mp4
3. Dynamic cell height
Simulator.Screen.Recording.-.iPhone.16.Pro.-.2024-10-25.at.22.26.14.mp4