Skip to content

Commit 0c63c82

Browse files
jfversluisrotorgames
authored andcommitted
Comment out measure all strategy on iOS 15 for grouping (xamarin#15355)
* Update ItemsViewLayout.cs * Update ItemsViewLayout.cs * Make check for iOS 15.4 and higher # Conflicts: # Xamarin.Forms.Platform.iOS/Forms.cs
1 parent 694ddcf commit 0c63c82

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

Xamarin.Forms.Platform.iOS/CollectionView/ItemsViewLayout.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ public void PrepareCellForLayout(ItemsViewCell cell)
170170

171171
public override bool ShouldInvalidateLayout(UICollectionViewLayoutAttributes preferredAttributes, UICollectionViewLayoutAttributes originalAttributes)
172172
{
173+
// This is currently causing an infinite layout loop on iOS 15 https://github.com/xamarin/Xamarin.Forms/issues/15230
174+
if (preferredAttributes.RepresentedElementKind == "UICollectionElementKindSectionHeader" && Forms.IsiOS154OrNewer)
175+
return base.ShouldInvalidateLayout(preferredAttributes, originalAttributes);
176+
173177
if (ItemSizingStrategy == ItemSizingStrategy.MeasureAllItems)
174178
{
175179
if (preferredAttributes.Bounds != originalAttributes.Bounds)

Xamarin.Forms.Platform.iOS/Forms.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Diagnostics;
44
using System.IO;
@@ -40,6 +40,8 @@ public static class Forms
4040
static bool? s_isiOS12OrNewer;
4141
static bool? s_isiOS13OrNewer;
4242
static bool? s_isiOS14OrNewer;
43+
static bool? s_isiOS15OrNewer;
44+
static bool? s_isiOS154OrNewer;
4345
static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden;
4446

4547
internal static bool IsiOS9OrNewer
@@ -103,6 +105,26 @@ internal static bool IsiOS14OrNewer
103105
}
104106
}
105107

108+
internal static bool IsiOS15OrNewer
109+
{
110+
get
111+
{
112+
if (!s_isiOS15OrNewer.HasValue)
113+
s_isiOS15OrNewer = UIDevice.CurrentDevice.CheckSystemVersion(15, 0);
114+
return s_isiOS15OrNewer.Value;
115+
}
116+
}
117+
118+
internal static bool IsiOS154OrNewer
119+
{
120+
get
121+
{
122+
if (!s_isiOS154OrNewer.HasValue)
123+
s_isiOS154OrNewer = UIDevice.CurrentDevice.CheckSystemVersion(15, 4);
124+
return s_isiOS154OrNewer.Value;
125+
}
126+
}
127+
106128

107129
internal static bool RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden
108130
{

0 commit comments

Comments
 (0)