-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Fixed EmptyView doesn’t display when CollectionView is placed inside a VerticalStackLayout #33134
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
|
#33134 the same problem |
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 fixes an Android-specific issue where the EmptyView in CollectionView fails to display when the CollectionView is placed inside a VerticalStackLayout. The root cause was an integer overflow during pixel conversion when the RecyclerView received infinite height constraints (represented as int.MaxValue).
Key Changes:
- Added dimension normalization to convert
int.MaxValuetodouble.PositiveInfinitybefore pixel conversion - Added comprehensive UI test coverage with screenshot verification for Android and iOS platforms
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Controls/src/Core/Handlers/Items/Android/SizedItemContentView.cs | Implements the core fix by adding NormalizeDimension method that converts int.MaxValue to double.PositiveInfinity, preventing pixel conversion issues when measuring EmptyView with infinite constraints |
| src/Controls/tests/TestCases.HostApp/Issues/Issue32932.cs | Provides the test page reproducing the issue with CollectionView containing EmptyView inside VerticalStackLayout, using CollectionView2 for testing |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32932.cs | Implements the UI test that verifies EmptyView displays correctly using screenshot verification |
| src/Controls/tests/TestCases.Android.Tests/snapshots/android/EmptyViewShouldDisplayWhenCollectionViewIsInsideVerticalStackLayout.png | Baseline screenshot for Android test verification |
| src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EmptyViewShouldDisplayWhenCollectionViewIsInsideVerticalStackLayout.png | Baseline screenshot for iOS test verification |
The implementation is solid and follows established patterns. The fix correctly addresses the root cause by normalizing dimension values before pixel conversion, ensuring infinite constraints are properly represented as double.PositiveInfinity rather than int.MaxValue. The test coverage is appropriate with both the reproduction case and automated verification through screenshots.
Root Cause
Description of Change
Validated the behaviour in the following platforms
Issues Fixed
Fixes #32932
Output
Android
Issue32932_before.mov
Issue_32932_after.mov