Skip to content

Commit

Permalink
chore: Adjust ios native failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban authored Jun 12, 2024
1 parent 23906bd commit 9ab1fc0
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBaseSource.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -858,14 +858,27 @@ public override CGRect Bounds
get => base.Bounds;
set
{
if (_measuredContentSize.HasValue)
if (this is null)
{
// Don't fail on null instance from native call
return;
}

try
{
if (_measuredContentSize.HasValue)
{
// At some points, eg during a collection change, iOS seems to apply an outdated size even after we've updated the
// LayoutAttributes. Keep the good size.
SetExtent(ref value, _measuredContentSize.Value);
}
base.Bounds = value;
UpdateContentViewFrame();
}
catch (Exception ex)
{
// At some points, eg during a collection change, iOS seems to apply an outdated size even after we've updated the
// LayoutAttributes. Keep the good size.
SetExtent(ref value, _measuredContentSize.Value);
Console.WriteLine("ListViewBaseInternalContainer.Bounds set failed: " + ex);
}
base.Bounds = value;
UpdateContentViewFrame();
}
}

Expand Down

0 comments on commit 9ab1fc0

Please sign in to comment.