Skip to content

Commit

Permalink
chore: temp
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Nov 29, 2024
1 parent e756f0c commit f54239e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public override void SetNeedsLayout()
Superview?.SetNeedsLayout();
}

public override void SubviewAdded(UIView uiview)
{
base.SubviewAdded(uiview);
SetNeedsLayout();
}

public override CGSize SizeThatFits(CGSize size)
{
var desiredSize = base.SizeThatFits(size);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public ContentControl Content
//value.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

ContentView.AddSubview(value);
value.InvalidateMeasure();
value.SetNeedsLayout();
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Uno.UI/UI/Xaml/MobileLayoutingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ public static void ArrangeElement(View view, Rect finalRect)
view.Frame = finalRect;
}

view.LayoutIfNeeded();

foreach (var child in view.Subviews)
{
if (child is UIElement childAsUIElement)
Expand Down
28 changes: 28 additions & 0 deletions src/Uno.UI/UI/Xaml/UIElement.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,21 @@ public override void SetNeedsLayout()
{
base.SetNeedsLayout();

if (Superview is not UIElement)
{
var firstManaged = this.FindFirstParent<UIElement>();
if (firstManaged != null)
{
firstManaged.InvalidateMeasure();
firstManaged.InvalidateArrange();
}
}

InvalidateMeasure();
InvalidateMeasureOnNativeOnlyChildrenRecursive(this);

InvalidateArrange();
InvalidateArrangeOnNativeOnlyChildrenRecursive(this);
}

private static void InvalidateMeasureOnNativeOnlyChildrenRecursive(UIView view)
Expand All @@ -165,6 +178,21 @@ private static void InvalidateMeasureOnNativeOnlyChildrenRecursive(UIView view)
}
}

private static void InvalidateArrangeOnNativeOnlyChildrenRecursive(UIView view)
{
foreach (var child in view.GetChildren())
{
if (child is not UIElement)
{
LayoutInformation.SetArrangeDirtyPath(child, true);
if (child is UIView childAsUIView)
{
InvalidateArrangeOnNativeOnlyChildrenRecursive(childAsUIView);
}
}
}
}

public void SetSubviewsNeedLayout()
{
base.SetNeedsLayout();
Expand Down

0 comments on commit f54239e

Please sign in to comment.