-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed [iOS] Fix CarouselViewRemoveAt so that it's passing on both CV1 and CV2 sets of handlers #25919
Conversation
… and CV2 sets of handlers
Hey there @NirmalKumarYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@@ -446,7 +446,7 @@ void ScrollToPosition(int goToPosition, int carouselPosition, bool animate, bool | |||
|
|||
void SetPosition(int position) |
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.
Could include an UITest?
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 test case for this scenario is already present. I have updated it to use the default CarouselView instead of CarouselView2.
… and CV2 sets of handlers
4fff4fe
to
3916ba3
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
|
||
carousel.ScrollTo(position, -1, Microsoft.Maui.Controls.ScrollToPosition.Center, false); | ||
await Task.Delay(100).ContinueWith((t) => |
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.
Is this the best approach ? Why 100? can we try the Collection.PerformBatchUpdates see if it helps?
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.
@rmarinho , I have used the similar approach used in CarouselViewController2.cs. Using Collection.PerformBatchUpdates causes the page with carousel view freeze. Please verify and let me know if you have any concerns.
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.
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 2 out of 2 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (2)
src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs:555
- [nitpick] The variable name 'positionCurrentItem' could be more descriptive. Consider renaming it to 'currentItemPosition'.
var positionCurrentItem = ItemsSource.GetIndexForItem(currentItem).Row;
src/Controls/src/Core/Handlers/Items/iOS/CarouselViewController.cs:226
- Ensure that setting 'InitialPositionSet' to false during detachment does not introduce any race conditions. Verify that it is correctly handled in all scenarios.
InitialPositionSet = false;
@PureWeen , I am not able to access the link provided. |
Issue Details
When using CV1 handlers, removing the first item from the CarouselView during navigation doesn't work as expected. The removed item remains visible in the view until we manually scroll it. This functionality works correctly with CV2 handlers.
Root Cause
When the CarouselView is detached and then reattached to the window, it doesn't undergo the proper initialization process again. This happens because the InitialPositionSet flag remains true from its previous attachment.
Description of Change
Setting the InitialPositionSet flag to false during the detachment process resolves the issue.
Validated the behaviour in the following platforms
Issues Fixed
Fixes #25776
Output
Before.mov
After.mov