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

Trigger InvalidateMeasure event on CollectionView when content size changes (iOS) #24647

Conversation

albyrock87
Copy link
Contributor

Description of Change

Problem reported in #21141 has been fixed by #23052 , except for one use case: nested collection view.
The nested CollectionView should trigger MeasureInvalidated but it's not: it is just triggering SetNeedsLayout on the native view.

This PR adds the event triggering so that the parent TemplatedCell can react to it.

Issues Fixed

Fixes #21141

@albyrock87 albyrock87 requested a review from a team as a code owner September 7, 2024 14:31
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Sep 7, 2024
@PureWeen
Copy link
Member

PureWeen commented Sep 7, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@@ -403,6 +409,13 @@ await CreateHandlerAndAddToWindow<LayoutHandler>(layout, async handler =>
? containerHeight
: Math.Min(itemsCount * templateHeight, containerHeight);

#if IOS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this work on Windows and Android?

If it currently doesn't and should, would it make sense to open an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd say: it should work on all platforms.
But apparently it only makes an actual difference on iOS (issue author is only talking about such platform).
I can try to make it work on Android, but I'll need some help for the Windows platform.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More just curious if we should log an issue

If this test currently fails for Android/Windows we can just log an issue saying so and link to it. No need to hold this PR up for Android/Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll file a new issue then.
(Test is failing there)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #24672

@albyrock87 albyrock87 changed the title Trigger InvalidateMeasure event on CollectionView when content size changes Trigger InvalidateMeasure event on CollectionView when content size changes (iOS) Sep 9, 2024
@PureWeen PureWeen merged commit 45a1666 into dotnet:main Sep 9, 2024
97 checks passed
@samhouts samhouts added this to the .NET 8 SR9 milestone Sep 20, 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] CollectionView item cells do not resize when the content size is changed
3 participants