Skip to content

Commit

Permalink
chore: Adjust Android's layouting workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored and jeromelaban committed Oct 3, 2024
1 parent 152944b commit 2e4a1c4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,23 @@ public void InvalidateMeasure()
SetLayoutFlags(LayoutFlag.MeasureDirty);

// HACK: Android's implementation of measure/arrange is not accurate. See comments in LayouterElementExtensions.DoMeasure
(VisualTreeHelper.GetParent(this) as UIElement)?.InvalidateMeasure();
global::Android.Views.IViewParent parent = this;
parent = parent.Parent;
while (parent is not null)
{
if (parent is UIElement parentAsUIElement)
{
parentAsUIElement.InvalidateMeasure();
break;
}
else
{
parent.RequestLayout();
}

parent = parent.Parent;
}

#elif __IOS__
SetNeedsLayout();
SetLayoutFlags(LayoutFlag.MeasureDirty);
Expand Down

0 comments on commit 2e4a1c4

Please sign in to comment.