-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] Changing carousel view orientation with disabled loop - fix #28545
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
Conversation
|
Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
b481eea to
64a50ae
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| bool _isRotating; | ||
|
|
||
| public override void TraitCollectionDidChange(UITraitCollection previousTraitCollection) | ||
| { |
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.
let s say the initial view is horizontal, and then I rotate to vertical, don t I still need to reload the data?
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.
We want to reload the data. And it will reload because previousTraitCollection.VerticalSizeClass would be compact and TraitCollection.VerticalSizeClass regular
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…tnet#28545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
…8545) * [iOS] Changing carousel view orientation with disabled loop - fix * Added snapshots
Description of Change
When the device orientation changes, the ViewDidLayoutSubviews method is triggered. Inside this method, _carouselViewLoopManager.CenterIfNeeded(CollectionView, IsHorizontal) is called. This eventually leads to CollectionView.ReloadData(), which ensures proper sizing adjustments when the orientation changes.
However, if the carousel view is not looping, _carouselViewLoopManager.CenterIfNeeded is not invoked. To fix this, I call _carouselViewLoopManager.CenterIfNeeded inside TraitCollectionDidChange when the carousel view does not have looping enabled.
Issues Fixed
Fixes #28523
Screen.Recording.2025-03-21.at.00.57.25.mov
Screen.Recording.2025-03-21.at.01.27.41.mov