-
Notifications
You must be signed in to change notification settings - Fork 2k
[iOS] Fix CollectionView horizontal scroll when empty inside RefreshView #34382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kubaflo
merged 5 commits into
dotnet:inflight/current
from
praveenkumarkarunanithi:fix-34165
Mar 14, 2026
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0f44d30
test updated
praveenkumarkarunanithi efd0d02
Update LayoutFactory2.cs
praveenkumarkarunanithi c44aa47
updated test
praveenkumarkarunanithi 508a9d7
Update Issue34165.cs
praveenkumarkarunanithi 0aaa62c
updated test as per AI concerns.
praveenkumarkarunanithi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 34165, "CollectionView is scrolling left/right when the collection is empty and inside a RefreshView", PlatformAffected.iOS)] | ||
| public class Issue34165 : ContentPage | ||
| { | ||
| public const string CollectionViewId = "CollectionView"; | ||
| public const string EmptyViewLabelId = "EmptyViewLabel"; | ||
| public const string RefreshViewId = "RefreshView"; | ||
|
|
||
| public Issue34165() | ||
| { | ||
| var emptyViewLabel = new Label | ||
| { | ||
| Text = "No items — swipe left/right here to test", | ||
| AutomationId = EmptyViewLabelId, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| var collectionView = new CollectionView | ||
| { | ||
| AutomationId = CollectionViewId, | ||
| EmptyView = emptyViewLabel, | ||
| }; | ||
|
|
||
| var refreshView = new RefreshView | ||
| { | ||
| AutomationId = RefreshViewId, | ||
| Content = collectionView, | ||
| }; | ||
|
|
||
| refreshView.Refreshing += (s, e) => | ||
| { | ||
| ((RefreshView)s!).IsRefreshing = false; | ||
| }; | ||
|
|
||
| Content = refreshView; | ||
| } | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34165.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| [Category(UITestCategories.RefreshView)] | ||
| public class Issue34165 : _IssuesUITest | ||
|
praveenkumarkarunanithi marked this conversation as resolved.
|
||
| { | ||
| public Issue34165(TestDevice testDevice) : base(testDevice) { } | ||
|
|
||
| public override string Issue => "CollectionView is scrolling left/right when the collection is empty and inside a RefreshView"; | ||
|
|
||
| [Test] | ||
| public void EmptyCollectionViewInsideRefreshViewShouldNotScrollHorizontally() | ||
| { | ||
| App.WaitForElement("CollectionView"); | ||
|
|
||
| var rectBefore = App.WaitForElement("EmptyViewLabel").GetRect(); | ||
|
|
||
| App.ScrollRight("CollectionView", ScrollStrategy.Gesture, swipePercentage: 0.8, swipeSpeed: 300); | ||
|
|
||
| var rectAfter = App.WaitForElement("EmptyViewLabel").GetRect(); | ||
|
|
||
| Assert.That(rectAfter.X, Is.EqualTo(rectBefore.X), | ||
|
praveenkumarkarunanithi marked this conversation as resolved.
Outdated
|
||
| $"EmptyViewLabel X position changed from {rectBefore.X} to {rectAfter.X}. " + | ||
| "CollectionView must NOT scroll horizontally when empty inside a RefreshView."); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.