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

[iOS] Fix for CollectionView single item horizontal alignment issue when using ItemsLayout with a Footer. #24564

Merged
merged 6 commits into from
Sep 10, 2024

Conversation

Tamilarasan-Paranthaman
Copy link
Contributor

Root Cause:

  • We had already reset the alignment in the NeedsSingleItemHorizontalAlignmentAdjustment method when a single element was in view. However, we also considered the CollectionView's bottom content inset in that condition, which led to the issue. When a footer was set, its height was added to the bottom content inset. This value did not match the layout attributes' Frame.Top value, and preventing the alignment from being reset.

Description of Change:

  • I fixed this issue by removing the CollectionView.ContentInset.Bottom value, as the footer affects the bottom content inset. The top of the first element should align with the top of the CollectionView unless grouping is enabled.
  • Additionally, the current implementation only handles the default case; we need to adjust it based on the grouping setting. Since this issue is not related to the customer-reported case, we can log it as a separate bug and address it individually.

Issues Fixed

Fixes #21728

Screenshots

Before Issue Fix After Issue Fix

Copy link
Contributor

Hey there @Tamilarasan-Paranthaman! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as draft September 2, 2024 06:42
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman added platform/iOS 🍎 area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Sep 2, 2024
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review September 5, 2024 07:16
@jfversluis
Copy link
Member

jfversluis commented Sep 5, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Sep 5, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Sep 6, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

Failing tests are unrelated. CI is timing out on templates tests unrelated to this PR

@PureWeen PureWeen merged commit 7d6c5a9 into dotnet:main Sep 10, 2024
93 of 97 checks passed
@samhouts samhouts added the fixed-in-net9.0-nightly This may be available in a nightly release! label Oct 1, 2024
@samhouts samhouts added fixed-in-9.0.0-rc.2.24503.2 and removed fixed-in-net9.0-nightly This may be available in a nightly release! labels Oct 14, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution fixed-in-9.0.0-rc.2.24503.2 platform/iOS 🍎
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Collectionview itemslayout styling changes with footer
4 participants