-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Fix CarouselView Regression #28955
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?
Fix CarouselView Regression #28955
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.
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
Files not reviewed (1)
- src/Controls/tests/TestCases.HostApp/Issues/Issue28930.xaml: Language not supported
@@ -104,6 +106,13 @@ public override UICollectionViewLayoutAttributes PreferredLayoutAttributesFittin | |||
var size = ConstrainedSize == default ? Measure() : ConstrainedSize; | |||
_size = size.ToSize(); | |||
_needsArrange = true; | |||
|
|||
if (IsCarouselViewCell && PlatformHandler?.VirtualView is { } virtualView) |
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.
Consider adding an inline comment explaining the rationale for applying a custom measurement override for carousel view cells to aid future maintainers.
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
Fix carousel cell measurement
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Hi! I tried this, it seems ItemsLayout="HorizontalList" is not respected. All CarouselViews in my project become vertical (at least child Grid elements are arranged vertically) |
@albyrock87 @kubaflo I tested it again. CV1 seems to work as expected. But CV2 doesn't - all child elements are arranged vertically. This is also easily reproduced in the original sample:
Direct ItemsLayout="HorizontalList" does not affect the behavior. scr_rec.movYou can also replace the MainPage.xml code in the original example with this simpler one, and then scroll the CarouselView in different directions:
|
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.
@jsuarezruiz the fix is ready here kubaflo#4 I really don't understand why, but passing the scroll direction makes the Carousel2 handler crash the app without any message :/ We can wait for the merge or you can cherry pick and run AZP immediately |
Fix regression due to passing scroll direction into the layout
I have a proposal. It doesn't seem to be directly related to this PR, but since it's called "Improve iOS CarouselView performance", maybe we should fix this right away? If I set the scroll index for a CarouselView with CV2 on iOS "too early" I get a random exception "cannot access disposed object NSPathIndex". Perhaps we should move the projectedPosition calculation a little lower in CarouselViewController2.cs by changing this part:
to something like this?
Thanks |
@Bamich I think that's reasonable. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
@albyrock87 Yes, I checked and confirm that the last commit fixes the scroll orientation issue |
Fix carousel initial position bug
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Description
A proposed fix for a minor regression introduced in this pr #28225
Issues Fixed
Fixes #28930
@albyrock87