[iOS] Fix CarouselView proper bounce-back behavior when Loop=false#29318
Merged
PureWeen merged 3 commits intodotnet:inflight/currentfrom May 8, 2025
Merged
[iOS] Fix CarouselView proper bounce-back behavior when Loop=false#29318PureWeen merged 3 commits intodotnet:inflight/currentfrom
PureWeen merged 3 commits intodotnet:inflight/currentfrom
Conversation
Contributor
|
Hey there @@Shalini-Ashokan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the CarouselView bounce-back behavior on iOS when Loop is false by correcting the item count calculation. The changes ensure that extra positions are not added and include additional tests to validate the behavior across multiple platforms.
- Updated LoopObservableItemsSource2.cs to only add extra items when Loop is true.
- Added a corresponding UITest in TestCases.Shared.Tests.
- Added a HostApp UI test to support manual verification.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29261.cs | Added a UITest case that verifies the bounce-back behavior. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue29261.cs | Provided a HostApp page for manual UI testing of the behavior. |
| src/Controls/src/Core/Handlers/Items2/iOS/LoopObservableItemsSource2.cs | Fixed the item count calculation to only add extra positions when Loop is true. |
Contributor
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jsuarezruiz
previously approved these changes
May 8, 2025
PureWeen
approved these changes
May 8, 2025
PureWeen
pushed a commit
that referenced
this pull request
May 9, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
PureWeen
pushed a commit
that referenced
this pull request
May 13, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
github-actions bot
pushed a commit
that referenced
this pull request
May 13, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
PureWeen
pushed a commit
that referenced
this pull request
May 14, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
PureWeen
pushed a commit
that referenced
this pull request
May 14, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
github-actions bot
pushed a commit
that referenced
this pull request
May 15, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
PureWeen
added a commit
that referenced
this pull request
May 21, 2025
For more information about inflight process check https://github.com/dotnet/maui/wiki/Inflight-Branch-Process # .NET MAUI Release Notes ## New Release: May 21, 2025 We're excited to announce a new release of .NET MAUI with several bug fixes and improvements across various platforms. ### Bug Fixes #### iOS - **Map Control**: Fixed crash when navigating to a page containing a map more than once (#29369) - **CarouselView**: Fixed bounce-back behavior when Loop=false, ensuring proper scrolling experience (#29318) - **UIView**: Fixed NullReferenceException for UIView not being in UIWindow (#29460) #### Windows - **CarouselView**: Fixed HorizontalScrollBarVisibility="Never" not working properly (#29343) - **UI Controls**: Fixed the color not being applied to the Expand/Collapse Chevron icon (#29140) #### Windows & macOS - **Modal Navigation**: Fixed issue where Disappearing event was not triggered when closing a window with a modal page (#29129) #### Android - **Modal Pages**: Improved inheritance of StatusBar and NavigationBar background colors (#28568) - **Footer Scrolling**: Fixed footer scrolling issues in list controls (#29381) - **Modal Pages**: Improved inheritance of StatusBar and NavigationBar background colors on modal pages (#28568) #### Cross-Platform - **CarouselView**: Fixed ItemsLayout runtime updates to ensure proper layout behavior (#29447) - **CollectionView**: Fixed various issues in CollectionView implementation (#29423) ### Testing Improvements - Added feature matrix UITest cases for CollectionView dynamic changes (#29424) ### Code Quality - Fixed code formatting issues across the codebase - Minor typo corrections (#29379) ### Contributors This release was made possible by the hard work of our dedicated team and community contributors. We'd like to extend our gratitude to everyone who has contributed to this release. ### Installation This update is available through NuGet and the .NET SDK. Update your projects to get access to these fixes. ### Known Issues Please refer to our issue tracker for any known issues and their workarounds. --- For more information about .NET MAUI, visit [the official documentation](https://docs.microsoft.com/dotnet/maui/).
PureWeen
pushed a commit
that referenced
this pull request
May 21, 2025
…29318) * Fixed the bounce back issue on carousal view 2 * Added test case * Removed unwanted lines
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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!
Issue Details
In carousel view, when Loop is set to false, scrolling past the last item incorrectly allows scrolling beyond the edge without proper bounce-back behavior.
Root Cause
The carousel view was incorrectly calculating its total item count by adding extra positions even when Loop was set to false.
Description of Change
When Loop is false, the carousel returns the exact Item Count without additional items, preventing over-scrolling.
Reference
I resolved the issue by referring to the following code.
maui/src/Controls/src/Core/Handlers/Items2/iOS/LoopListSource2.cs
Line 27 in b498783
Validated the behavior in the following platforms
Issues Fixed
Fixes #29261
Fixes #27668
Output ScreenShot
Issue29261BeforeFix.mov
Issue29261After.mov