Skip to content

[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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Jun 15, 2025

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

Before After
Screen.Recording.2025-06-15.at.11.57.54.mov
Screen.Recording.2025-06-15.at.11.56.39.mov

@Copilot Copilot AI review requested due to automatic review settings June 15, 2025 10:25
@kubaflo kubaflo requested a review from a team as a code owner June 15, 2025 10:25
Copy link
Contributor

@Copilot Copilot AI left a 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)

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@rmarinho rmarinho left a 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

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following tests are failing:
image

Are related with CarouselView and scrolling, could you check if are related with the changes?

@kubaflo
Copy link
Contributor Author

kubaflo commented Jun 17, 2025

@rmarinho @jsuarezruiz can we please try to rerun tests?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] IsSwipeEnabled Not Working on CarouselView (CV2)
3 participants