From bf072f85a718f28940a9f859cb0ef1f7f96b1f9c Mon Sep 17 00:00:00 2001 From: Martin Zikmund Date: Tue, 15 Oct 2024 17:19:11 +0200 Subject: [PATCH] fix: Workaround non-UIElement UIViews in Grid layout (cherry picked from commit bc73f5884adcba188b55a95486f2e19b36dbb352) --- src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs b/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs index a170e018fd64..bb40c2c87e88 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Grid/Grid.cs @@ -1374,6 +1374,12 @@ private XSIZEF InnerArrangeOverride(XSIZEF finalSize) while (childrenEnumerator.MoveNext()) { var currentChild = childrenEnumerator.Current; +#if __IOS__ // Uno specific: On iOS an additional non-UIElement is added the the parent of a focused TextBox control, we need to skip it. + if (currentChild is null) + { + continue; + } +#endif ASSERT(currentChild is { }); currentChild.EnsureLayoutStorage(); @@ -1414,6 +1420,12 @@ private XSIZEF InnerArrangeOverride(XSIZEF finalSize) for (Xuint childIndex = 0; childIndex < count; childIndex++) { UIElement currentChild = children[childIndex]; +#if __IOS__ // Uno specific: On iOS an additional non-UIElement is added the the parent of a focused TextBox control, we need to skip it. + if (currentChild is null) + { + continue; + } +#endif ASSERT(currentChild is { }); DefinitionBase row = GetRowNoRef(currentChild);