-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Fix wrong scrolling options using the ScrollView Orientation property #30131
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the iOS ScrollView by updating its bounce behavior, scrollbar visibility, and content sizing based on the Orientation
property, and adds device/UI tests to prevent regressions.
- Introduces
UpdateOrientation
extension to set bounce and indicator visibility. - Modifies
MauiScrollView
to constrain content size per orientation. - Adds device tests and a UI test page for issue #30070.
Reviewed Changes
Copilot reviewed 10 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Core/tests/DeviceTests/Handlers/ScrollView/ScrollViewHandlerTests.iOS.cs | Adds orientation-based bounce tests |
src/Core/src/Platform/iOS/ScrollViewExtensions.cs | Implements UpdateOrientation extension |
src/Core/src/Platform/iOS/MauiScrollView.cs | Adjusts contentSize in LayoutSubviews via ApplyOrientationConstraints |
src/Core/src/Handlers/ScrollView/ScrollViewHandler.iOS.cs | Sets up VirtualView and calls UpdateOrientation in mapper |
src/Core/src/Handlers/ScrollView/ScrollViewHandler.cs | Adds MapOrientation to property mapper |
src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt | Registers new UpdateOrientation API |
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt | Registers new UpdateOrientation API |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30070.cs | Adds a UI test for horizontal scrolling behavior |
src/Controls/tests/TestCases.HostApp/Issues/Issue30070.xaml | Creates test page with a horizontal ScrollView and content toggles |
src/Controls/tests/TestCases.HostApp/Issues/Issue30070.xaml.cs | Implements test page view-model and button handlers |
Comments suppressed due to low confidence (1)
src/Core/tests/DeviceTests/Handlers/ScrollView/ScrollViewHandlerTests.iOS.cs:47
- The tests verify bounce behavior and scroll enabling, but do not assert the visibility of the horizontal/vertical scroll indicators; consider adding
Assert.Equal(expectedShowHorizontal, scrollViewHandler.PlatformView.ShowsHorizontalScrollIndicator)
and its vertical counterpart to fully cover the new behavior.
Assert.Equal(expectedHorizontalBounce, scrollViewHandler.PlatformView.AlwaysBounceHorizontal);
<Button Text="Editor" | ||
Clicked="OnContentTypeButtonClicked" | ||
WidthRequest="100" | ||
AutomationId="GridContentBtn"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Editor button reuses the "GridContentBtn" AutomationId, causing a duplicate; assign a unique AutomationId (e.g. "EditorContentBtn") to ensure UI tests can target each control correctly.
Copilot uses AI. Check for mistakes.
@@ -61,5 +61,36 @@ public static void UpdateIsEnabled(this UIScrollView nativeScrollView, IScrollVi | |||
nativeScrollView.ScrollEnabled = scrollView.IsEnabled; | |||
} | |||
} | |||
|
|||
public static void UpdateOrientation(this UIScrollView nativeScrollView, IScrollView scrollView) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A new public extension method UpdateOrientation
was added; please update the corresponding XML documentation in /docs/
to describe this method and its behavior so public API docs stay in sync.
Copilot uses AI. Check for mistakes.
Description of Change
The PR include the following changes:
UpdateOrientation
extension method to update bounce and scrollbar visibility based on ScrollOrientation.MauiScrollView
control to adjust contentSize based on the scroll orientation.These changes fix inconsistencies between layout sizing and scroll behavior on iOS. Additionally, this PR includes device tests and UI tests to validate the expected behavior and guard against regressions.
Issues Fixed
Fixes #30070