-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[Android] Fix CollectionView EmptyView #11763
Conversation
Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com>
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.
Questions about the empty view size changes.
if (!double.IsInfinity(height)) | ||
height = Context.ToPixels(height); | ||
|
||
UpdateEmptyViewSize(width, height); |
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.
This will set the empty view size to (widthConstraint, heightConstraint) - that's exactly what Jon's comment was worried about. Shouldn't it use the result of the measurement?
Also, is it even necessary to update the empty view size during measure? It's already being updated during Arrange.
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.
@jsuarezruiz the conversation was mark as resolved, but does not look like it was, can you please comment?
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.
You are right, with the current approach the height is infinity. However, with the return values from base.GetDesiredSize:
DesiredSize {Width=0 Height=4793480}
The EmptyView will not be visible using that values (zero Width).
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.
cc @hartez
|
if (!double.IsInfinity(height)) | ||
height = Context.ToPixels(height); | ||
|
||
UpdateEmptyViewSize(width, height); |
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.
If the ItemsView measurement is unconstrained in one direction, won't that set the height or width of the EmptyViewAdapter's RecyclerViewWidth or RecyclerViewHeight to infinity? It seems like it should use the height returned from GetDesiredSize, not the measurement constraints.
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.
Okay, looks like it's all working.
When is this fix released? |
At the moment, it's slated to be released as part of .NET 8. So it will likely be in the next .NET 8 preview. |
* Fix Android CollectionView EmptyView * Update src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Android.cs Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com> * Fixed build errors * Auto-format source code --------- Co-authored-by: E.Z. Hart <hartez@users.noreply.github.com> Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
Wow, I am surprised that it took 2 years to fix something that is one of the major functionalities of CollectionView, I remember facing this issue with .Net 6 and it's coming out with .Net 8, Damn... |
EmptyViewTemplate still does not render at all: #18551 |
Description of Change
Fix Android CollectionView EmptyView.
Issues Fixed
Fixes #10819