Skip to content
Merged
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
17 changes: 17 additions & 0 deletions src/Core/src/Platform/iOS/MauiView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ static UIEdgeInsets ComputeCellSafeAreaInsets(UIView cell, ISafeAreaView2 safeVi
// Null means not yet determined. Invalidated when view hierarchy changes.
bool? _parentHandlesSafeArea;

// Indicates whether the measure invalidation has already been propagated
// to ancestors during this main loop.
bool _measureInvalidatedPropagated;

// Keyboard tracking
CGRect _keyboardFrame = CGRect.Empty;
bool _isKeyboardShowing;
Expand Down Expand Up @@ -621,6 +625,10 @@ void CrossPlatformArrange(CGRect bounds)
/// <returns>The size that fits within the constraints</returns>
public override CGSize SizeThatFits(CGSize size)
{
// Invalidations shouldn't happen during measure pass,
// but we need to support that in case it happens.
_measureInvalidatedPropagated = false;

if (_crossPlatformLayoutReference == null)
{
return base.SizeThatFits(size);
Expand Down Expand Up @@ -653,6 +661,9 @@ public override void LayoutSubviews()
{
base.LayoutSubviews();

// Allow measure invalidations during layout pass
_measureInvalidatedPropagated = false;

if (_crossPlatformLayoutReference == null)
{
return;
Expand Down Expand Up @@ -799,6 +810,12 @@ bool IPlatformMeasureInvalidationController.InvalidateMeasure(bool isPropagating

// If we're not propagating, then this view is the one triggering the invalidation
// and one possible cause is that constraints have changed, so we have to propagate the invalidation.
if (_measureInvalidatedPropagated)
{
return false;
}

_measureInvalidatedPropagated = true;
return true;
}

Expand Down
Loading