Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ public abstract class ItemsViewController2<TItemsView> : UICollectionViewControl
bool _emptyViewDisplayed;
bool _disposed;

bool _scrollEnabled;
bool _bounceVertical;
bool _bounceHorizontal;

[UnconditionalSuppressMessage("Memory", "MEM0002", Justification = "Proven safe in test: MemoryTests.HandlerDoesNotLeak")]
UIView _emptyUIView;
VisualElement _emptyViewFormsElement;
Expand Down Expand Up @@ -552,6 +556,19 @@ void ShowEmptyView()
return;
}

if (CollectionView is not null)
{
_scrollEnabled = CollectionView.ScrollEnabled;
_bounceVertical = CollectionView.AlwaysBounceVertical;
_bounceHorizontal = CollectionView.AlwaysBounceHorizontal;

// Disable all forms of user-driven movement
// When no items are visible, scroll/bounce serve no purpose and cause visual glitches
CollectionView.ScrollEnabled = false;
CollectionView.AlwaysBounceVertical = false;
CollectionView.AlwaysBounceHorizontal = false;
}

_emptyUIView.Tag = EmptyTag;
CollectionView.AddSubview(_emptyUIView);

Expand All @@ -575,6 +592,13 @@ void HideEmptyView()

_emptyUIView.RemoveFromSuperview();

if (CollectionView is not null)
{
CollectionView.ScrollEnabled = _scrollEnabled;
CollectionView.AlwaysBounceVertical = _bounceVertical;
CollectionView.AlwaysBounceHorizontal = _bounceHorizontal;
}

_emptyViewDisplayed = false;
}

Expand Down
Loading