Skip to content

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

Merged
PureWeen merged 1 commit into
dotnet:mainfrom
albyrock87:properly-notify-ios-collection-view-measure-changed
Sep 9, 2024
Merged

Trigger InvalidateMeasure event on CollectionView when content size changes (iOS)#24647
PureWeen merged 1 commit into
dotnet:mainfrom
albyrock87:properly-notify-ios-collection-view-measure-changed

Conversation

@albyrock87

Copy link
Copy Markdown
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

PureWeen commented Sep 7, 2024

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

? containerHeight
: Math.Min(itemsCount * templateHeight, containerHeight);

#if IOS

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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