Skip to content

[iOS] Fixed Current Item change on Device Orientation#32672

Merged
jfversluis merged 4 commits intodotnet:inflight/currentfrom
SubhikshaSf4851:FIx-32394
Dec 1, 2025
Merged

[iOS] Fixed Current Item change on Device Orientation#32672
jfversluis merged 4 commits intodotnet:inflight/currentfrom
SubhikshaSf4851:FIx-32394

Conversation

@SubhikshaSf4851
Copy link
Contributor

@SubhikshaSf4851 SubhikshaSf4851 commented Nov 17, 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!

RootCause :

On device rotation, the CarouselView changed its current item (or scrolled unexpectedly) because offset.X became inconsistent during layout invalidation, resulting in an incorrect page index calculation.

Description of Change

  • Added flags and logic (initialLoad, _isRotating) in CarouselViewController2 to detect and handle device orientation changes, and prevent updating the current item during rotation.
  • Subscribed to orientation change notifications and implemented cleanup of observers in the teardown method to avoid memory leaks.
  • Updated the layout logic in LayoutFactory2.cs to skip position updates if a rotation is in progress, ensuring the carousel does not scroll or change items during orientation changes.

Issues Fixed

Fixes #32394
Fixes #28972

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
BeforeFix32394.mov
AfterFix32394.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Nov 17, 2025
@sheiksyedm sheiksyedm marked this pull request as ready for review November 18, 2025 10:40
Copilot AI review requested due to automatic review settings November 18, 2025 10:40
Copy link
Contributor

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@StephaneDelcroix
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis changed the base branch from main to inflight/current December 1, 2025 10:41
@jfversluis jfversluis added this to the .NET 10.0 SR2 milestone Dec 1, 2025
@jfversluis jfversluis merged commit 5688fdb into dotnet:inflight/current Dec 1, 2025
1 check passed
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
Updated test cases

Update Fix on carousel view controller

Added Snapshots for iOS and android
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
Updated test cases

Update Fix on carousel view controller

Added Snapshots for iOS and android
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
Updated test cases

Update Fix on carousel view controller

Added Snapshots for iOS and android
PureWeen pushed a commit that referenced this pull request Dec 3, 2025
Updated test cases

Update Fix on carousel view controller

Added Snapshots for iOS and android
github-actions bot pushed a commit that referenced this pull request Dec 5, 2025
Updated test cases

Update Fix on carousel view controller

Added Snapshots for iOS and android
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CarouselViewHandler2] Current item changes during orientation in CarouselViewHandler2

5 participants