Skip to content

Commit 0c17bc9

Browse files
Fix Issue #1256 (#1267)
Better fix Co-authored-by: Vladislav Antonyuk <33021114+VladislavAntonyuk@users.noreply.github.com>
1 parent 4ab1b51 commit 0c17bc9

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/CommunityToolkit.Maui.Core/Views/Popup/PopupExtensions.macios.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,10 @@ public static void SetSize(this MauiPopup mauiPopup, in IPopup popup)
2323
else if (popup.Content is not null)
2424
{
2525
var content = popup.Content;
26-
if (!content.Width.IsZeroOrNaN() || !content.Height.IsZeroOrNaN())
27-
{
28-
mauiPopup.PreferredContentSize = new CGSize(content.Width, content.Height);
29-
}
30-
else
31-
{
32-
var measure = popup.Content.Measure(double.PositiveInfinity, double.PositiveInfinity);
33-
mauiPopup.PreferredContentSize = new CGSize(measure.Width, measure.Height);
34-
}
26+
var measure = popup.Content.Measure(double.PositiveInfinity, double.PositiveInfinity);
27+
var width = content.Width.IsZeroOrNaN() ? measure.Width : content.Width;
28+
var height = content.Height.IsZeroOrNaN() ? measure.Height : content.Height;
29+
mauiPopup.PreferredContentSize = new CGSize(width, height);
3530
}
3631
}
3732

0 commit comments

Comments
 (0)