Skip to content

Commit

Permalink
Only call arrange from shell parts
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen committed Jul 7, 2022
1 parent fc61e50 commit 03993fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Expand Up @@ -243,7 +243,8 @@ public void LayoutParallax()
ContentView.Frame =
new CGRect(parent.Bounds.X, HeaderTopMargin, parent.Bounds.Width, parent.Bounds.Height - HeaderTopMargin - footerHeight);

Content?.LayoutToSize(ContentView.Frame.Width, ContentView.Frame.Height - contentViewYOffset);
var platformFrame = new CGRect(0, 0, ContentView.Frame.Width, ContentView.Frame.Height - contentViewYOffset);
Content?.Arrange(platformFrame.ToRectangle());
}
}
else
Expand All @@ -261,8 +262,8 @@ public void LayoutParallax()
ContentView.Frame =
new CGRect(parent.Bounds.X, topMargin + contentViewYOffset, parent.Bounds.Width, parent.Bounds.Height - topMargin - footerHeight - contentViewYOffset);


Content?.LayoutToSize(ContentView.Frame.Width, ContentView.Frame.Height);
var platformFrame = new CGRect(0, 0, ContentView.Frame.Width, ContentView.Frame.Height);
Content?.Arrange(platformFrame.ToRectangle());
}

if (HeaderView != null && !double.IsNaN(HeaderSize))
Expand Down
Expand Up @@ -19,7 +19,7 @@ public UIContainerView(View view)

_renderer = (IPlatformViewHandler)view.ToHandler(view.FindMauiContext());

AddSubview(_renderer.PlatformView);
AddSubview(view.ToPlatform());
ClipsToBounds = true;
view.MeasureInvalidated += OnMeasureInvalidated;
MeasuredHeight = double.NaN;
Expand Down Expand Up @@ -92,7 +92,8 @@ public override void WillMoveToSuperview(UIView newSuper)

public override void LayoutSubviews()
{
_view.LayoutToSize(Width ?? Frame.Width, Height ?? MeasuredHeight);
var platformFrame = new CGRect(0, 0, Width ?? Frame.Width, Height ?? MeasuredHeight);
_view.Arrange(platformFrame.ToRectangle());
}

protected override void Dispose(bool disposing)
Expand Down
10 changes: 0 additions & 10 deletions src/Core/src/Platform/iOS/ViewExtensions.cs
Expand Up @@ -419,16 +419,6 @@ internal static Graphics.Rect GetBoundingBox(this UIView? platformView)
return view?.Superview;
}

internal static void LayoutToSize(this IView view, double width, double height)
{
var platformFrame = new CGRect(0, 0, width, height);

if (view.Handler is IPlatformViewHandler viewHandler && viewHandler.PlatformView != null)
viewHandler.PlatformView.Frame = platformFrame;

view.Arrange(platformFrame.ToRectangle());
}

internal static Size LayoutToMeasuredSize(this IView view, double width, double height)
{
var size = view.Measure(width, height);
Expand Down

0 comments on commit 03993fc

Please sign in to comment.