diff --git a/src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs b/src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs index 3e618c05deb3..f1064d9abe34 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/GroupableItemsViewController.cs @@ -173,17 +173,9 @@ internal CGSize GetReferenceSizeForheaderOrFooter(UICollectionView collectionVie return CGSize.Empty; } - if (!(OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsTvOSVersionAtLeast(11))) - { - // iOS 10 crashes if we try to dequeue a cell for measurement - // so we'll use an alternate method - return MeasureSupplementaryView(elementKind, section); - } - - var cell = GetViewForSupplementaryElement(collectionView, elementKind, - NSIndexPath.FromItemSection(0, section)) as ItemsViewCell; - - return cell.Measure(); + // Dequeuing a supplementary view for measurement caused multiple instances of the header/footer to appear in the view. + // We now always use MeasureSupplementaryView, an alternate approach for calculating the size without dequeuing the view. + return MeasureSupplementaryView(elementKind, section); } internal void SetScrollAnimationEndedCallback(Action callback) diff --git a/src/Controls/src/Core/Handlers/Items/iOS/ObservableGroupedSource.cs b/src/Controls/src/Core/Handlers/Items/iOS/ObservableGroupedSource.cs index feba35a2451f..050133eb7569 100644 --- a/src/Controls/src/Core/Handlers/Items/iOS/ObservableGroupedSource.cs +++ b/src/Controls/src/Core/Handlers/Items/iOS/ObservableGroupedSource.cs @@ -204,7 +204,7 @@ bool NotLoadedYet() void Add(NotifyCollectionChangedEventArgs args) { - if (ReloadRequired()) + if (NotLoadedYet()) { Reload(); return; diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewAddGroupWhenViewIsEmpty.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewAddGroupWhenViewIsEmpty.png new file mode 100644 index 000000000000..5d661ee0c610 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewAddGroupWhenViewIsEmpty.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewDuplicateViewsWhenAddItemToGroup.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewDuplicateViewsWhenAddItemToGroup.png new file mode 100644 index 000000000000..cb1e0f385aa5 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/CollectionViewDuplicateViewsWhenAddItemToGroup.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml new file mode 100644 index 000000000000..aab6b5922577 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml @@ -0,0 +1,37 @@ + + + + + +