Skip to content
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

Run page's content measurement through handler/native control #1700

Merged
merged 1 commit into from
Jul 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controls/src/Core/HandlerImpl/ContentPage.Impl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override Size MeasureOverride(double widthConstraint, double heightCon
{
if (Content is IFrameworkElement frameworkElement)
{
frameworkElement.Measure(widthConstraint, heightConstraint);
_ = frameworkElement.Handler?.GetDesiredSize(widthConstraint, heightConstraint);
}

return new Size(widthConstraint, heightConstraint);
Expand Down
5 changes: 4 additions & 1 deletion src/Core/src/Handlers/View/ViewHandlerOfT.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ public override void NativeArrange(Rectangle rect)
// We set Center and Bounds rather than Frame because Frame is undefined if the CALayer's transform is
// anything other than the identity (https://developer.apple.com/documentation/uikit/uiview/1622459-transform)
nativeView.Center = new CoreGraphics.CGPoint(rect.Center.X, rect.Center.Y);
nativeView.Bounds = new CoreGraphics.CGRect(0, 0, rect.Width, rect.Height);

// The position of Bounds is usually (0,0), but in some cases (e.g., UIScrollView) it's the content offset.
// So just leave it a whatever value iOS thinks it should be.
nativeView.Bounds = new CoreGraphics.CGRect(nativeView.Bounds.X, nativeView.Bounds.Y, rect.Width, rect.Height);

nativeView.UpdateBackgroundLayerFrame();
}
Expand Down