-
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
Fix for Try scrolling down and when new items are added the first item does not kept in the displayed list. #27153
base: main
Are you sure you want to change the base?
Conversation
Hey there @SuthiYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
_itemsUpdateScrollObserver.Start(ItemsViewAdapter); | ||
} | ||
// We need to observe the adapter for changes for the ItemsUpdatingScrollMode. | ||
_itemsUpdateScrollObserver.Start(ItemsViewAdapter); |
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.
These CollectionView tests are failing:
The App is crashing. Could you check if are related with the changes?
Hi @jsuarezruiz Yes, the crash is due to the DataObserver
included for KeepItemsInView
. I have modified ElementAt()
and DetermineTargetPosition
. Please review the changes and let us know if you have any concerns.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
5ddcf7b
to
b8d8a6e
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Issue Details
When the
ItemsUpdatingScrollMode
is set toKeepItemsInView,
scrolling down in the list and adding a new item does not move the newly added item to the first position.Root Cause
Android: In the
MauiRecyclerView
, the data change observer is paused forKeepItemsInView
inItemsUpdatingScrollMode
to maintain the first position of the item.iOS and Mac: In the
ItemsViewLayout
, the collection update does not account for theItemsUpdatingScrollMode
set toKeepItemsInView
, causing the current position to remain unchanged despite the scroll mode settings.Description of Change
Android: We need to observe the data changes for the
KeepItemsInView
option, as there may be cases where the item might not remain in view.The issue is fixed by restarting the data change observer inMauiRecyclerView
.iOS and Mac: The issue is addressed by updating the scroll behavior in the
ItemsLayout
for iOS, including theForceScrollToFirstItem
method to correctly adjust the scroll position.Issues Fixed
Fixes #26810
Tested the behaviour in the following platforms
Known Issue
ItemsUpdatingScrollMode
is not implemented in CollectionView2Output Screenshot
BeforeFix.mov
AfterFix.mov