-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] CurrentItem does not work when PeekAreaInsets is set - fix #29995
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR addresses an issue in CarouselViewHandler2 where the CurrentItem calculation malfunctions when PeekAreaInsets is set. The updated logic adjusts the content width used for computing the page index by subtracting the section margins.
- Adjusted calculation for determining the carousel page index
- Fixed CurrentItem positioning when PeekAreaInsets is applied
@@ -337,7 +337,7 @@ public static UICollectionViewLayout CreateCarouselLayout( | |||
return; | |||
} | |||
|
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.
Consider adding a brief inline comment to clarify why sectionMargin is subtracted twice from the container width, which will help future maintainers understand the intention behind this calculation.
// Calculate the current page index based on the offset and container width. | |
// Subtract sectionMargin * 2 to account for the margins on both sides of the container. |
Copilot uses AI. Check for mistakes.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
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.
Could include a related test?
Done |
…is set
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issues Fixed
Fixes #28524
Screen.Recording.2025-06-14.at.12.16.00.mov
Screen.Recording.2025-06-14.at.12.15.02.mov