Skip to content

Commit da44634

Browse files
committed
feat: Add feature flag for the layout cycle fix
1 parent 3e8e84a commit da44634

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Uno.UI/FeatureConfiguration.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ public static class FrameworkElement
233233
/// will not, which is how WinUI behaves. Set to true if you have code written for earlier versions of Uno that relies upon the old behavior.
234234
/// </summary>
235235
public static bool UseLegacyHitTest { get; set; }
236+
237+
#if __IOS__
238+
/// <summary>
239+
/// When true, propagate the NeedsLayout on superview even if element is in its LayoutSubViews() (i.e. Arrange()).
240+
/// This is known to cause layout cycle when a child invalidates itself during arrange (e.g. ItemsRepeater).
241+
/// Default value is false, set it to true will restore behavior of uno v4.7 and earlier.
242+
/// </summary>
243+
public static bool IOsAllowSuperviewNeedsLayoutWhileInLayoutSubViews { get; set; }
244+
#endif
236245
}
237246

238247
public static class FrameworkTemplate

src/Uno.UI/UI/Xaml/FrameworkElement.iOS.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public override void SetNeedsLayout()
3636

3737
SetLayoutFlags(LayoutFlag.MeasureDirty | LayoutFlag.ArrangeDirty);
3838

39-
if (!_inLayoutSubviews)
39+
if (FeatureConfiguration.FrameworkElement.IOsAllowSuperviewNeedsLayoutWhileInLayoutSubViews || !_inLayoutSubviews)
4040
{
4141
SetSuperviewNeedsLayout();
4242
}

0 commit comments

Comments
 (0)