Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ internal class AccessibilityNeutralTableView : UITableView, IUIAccessibilityCont
public AccessibilityNeutralTableView()
{
this.SetAccessibilityContainerType(UIAccessibilityContainerType.None);
ScrollsToTop = false;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public override void ViewDidLoad()
CollectionView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
}

CollectionView.ScrollsToTop = true;

RegisterViewTypes();

EnsureLayoutInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,29 @@ public object LoadDataTemplate()
}
}

[Fact]
public async Task CollectionViewScrollsToTopIsEnabled()
{
SetupBuilder();

var collectionView = new CollectionView
{
ItemsSource = Enumerable.Range(0, 20).Select(i => $"Item {i}").ToList(),
ItemTemplate = new DataTemplate(() =>
{
var label = new Label();
label.SetBinding(Label.TextProperty, ".");
return label;
})
};

await CreateHandlerAndAddToWindow<CollectionViewHandler2>(collectionView, handler =>
{
var uiCollectionView = handler.Controller.CollectionView;
Assert.True(uiCollectionView.ScrollsToTop, "CollectionView's UICollectionView should have ScrollsToTop enabled");
});
}

Rect GetCollectionViewCellBounds(IView cellContent)
{
if (!cellContent.ToPlatform().IsLoaded())
Expand Down
28 changes: 28 additions & 0 deletions src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,34 @@
await OnNavigatedToAsync(page);
}

[Fact(DisplayName = "Shell Flyout Table View Has ScrollsToTop Disabled")]
public async Task ShellFlyoutTableViewScrollsToTopIsDisabled()
{
SetupBuilder();
var shell = await CreateShellAsync((shell) =>
{
shell.Items.Add(new ContentPage() { Content = new Label() { Text = "Test Page" } });
});

await CreateHandlerAndAddToWindow<ShellRenderer>(shell, async (handler) =>
{
await OpenFlyout(handler);

Check failure on line 633 in src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs

View check run for this annotation

Azure Pipelines / maui-pr (Build .NET MAUI Build macOS (Debug))

src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs#L633

src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs(633,11): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'OpenFlyout' does not exist in the current context

Check failure on line 633 in src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs

View check run for this annotation

Azure Pipelines / maui-pr (Build .NET MAUI Build macOS (Release))

src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs#L633

src/Controls/tests/DeviceTests/Elements/Shell/ShellTests.iOS.cs(633,11): error CS0103: (NETCORE_ENGINEERING_TELEMETRY=Build) The name 'OpenFlyout' does not exist in the current context

var flyoutContent = handler.ViewController
.ChildViewControllers
.OfType<ShellFlyoutContentRenderer>()
.First();

var tableViewController = flyoutContent.ChildViewControllers
.OfType<ShellTableViewController>()
.FirstOrDefault();

Assert.NotNull(tableViewController);
Assert.False(tableViewController.TableView.ScrollsToTop,
"Shell flyout's table view should have ScrollsToTop disabled to avoid conflicting with content scroll views");
});
}

class ModalShellPage : ContentPage
{
public ModalShellPage()
Expand Down
Loading