Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 6cc1cfd

Browse files
authored
Comment out measure all strategy on iOS 15 for grouping (#15355)
* Update ItemsViewLayout.cs * Update ItemsViewLayout.cs * Make check for iOS 15.4 and higher
1 parent 02dee20 commit 6cc1cfd

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-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: 12 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;
@@ -41,6 +41,7 @@ public static class Forms
4141
static bool? s_isiOS13OrNewer;
4242
static bool? s_isiOS14OrNewer;
4343
static bool? s_isiOS15OrNewer;
44+
static bool? s_isiOS154OrNewer;
4445
static bool? s_respondsTosetNeedsUpdateOfHomeIndicatorAutoHidden;
4546

4647
internal static bool IsiOS9OrNewer
@@ -114,6 +115,16 @@ internal static bool IsiOS15OrNewer
114115
}
115116
}
116117

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+
117128

118129
internal static bool RespondsToSetNeedsUpdateOfHomeIndicatorAutoHidden
119130
{

0 commit comments

Comments
 (0)