-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Support for IsSwipeEnabled on CarouselView2 #29996
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 introduces support for disabling swipe gestures on CarouselView2 on iOS by adding a new test case and updating the iOS layout logic. It includes new automated tests, updates to the host app UI, and modifications to the iOS layout factory to conditionally adjust scrolling based on the IsSwipeEnabled flag.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29391.cs | Added automated test verifying swipe behavior changes on CarouselView |
src/Controls/tests/TestCases.HostApp/Issues/Issue29391.xaml.cs | New host app partial class for Issue29391 |
src/Controls/tests/TestCases.HostApp/Issues/Issue29391.xaml | Updated XAML to bind IsSwipeEnabled to a Switch control |
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs | Updated layout logic on iOS to respect the IsSwipeEnabled property |
Comments suppressed due to low confidence (2)
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs:287
- [nitpick] Consider adding a comment to explain the logic behind computing 'lastPosition' here, particularly clarifying why 'Position + 1' is used when looping.
int lastPosition = itemsView.Loop ? itemsView.Position + 1 : itemsView.Position;
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs:341
- [nitpick] Please add a comment explaining the early return when swipe is disabled, and how it affects subsequent logic in the layout update.
if (!itemsView.IsSwipeEnabled)
/azp run MAUI-UITests-public |
Azure Pipelines successfully started running 1 pipeline(s). |
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.
How does this fix the issue of IsSwipeEnabled, can we give a better description? maybe some comment on the code too.
Seems tests are also failing.
Thanks
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.
@rmarinho @jsuarezruiz can we please try to rerun tests? |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description
This PR adds proper support for the IsSwipeEnabled property on CarouselView2 for iOS. Currently, setting IsSwipeEnabled to false does not disable user swipe gestures as expected. This behavior is inconsistent and may lead to confusion or unintended navigation in applications.
Issues Fixed
Fixes #29391
Screen.Recording.2025-06-15.at.11.57.54.mov
Screen.Recording.2025-06-15.at.11.56.39.mov