Skip to content
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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

SuthiYuvaraj
Copy link
Contributor

@SuthiYuvaraj SuthiYuvaraj commented Jan 15, 2025

Issue Details

When the ItemsUpdatingScrollMode is set to KeepItemsInView, 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 for KeepItemsInView in ItemsUpdatingScrollMode to maintain the first position of the item.
iOS and Mac: In the ItemsViewLayout, the collection update does not account for the ItemsUpdatingScrollMode set to KeepItemsInView, 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 in MauiRecyclerView.
iOS and Mac: The issue is addressed by updating the scroll behavior in the ItemsLayout for iOS, including the ForceScrollToFirstItem method to correctly adjust the scroll position.

Issues Fixed

Fixes #26810

Tested the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Known Issue

ItemsUpdatingScrollMode is not implemented in CollectionView2

Output Screenshot

Before Issue Fix After Issue Fix
BeforeFix.mov
AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jan 15, 2025
Copy link
Contributor

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.

@sheiksyedm sheiksyedm added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jan 15, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SuthiYuvaraj SuthiYuvaraj marked this pull request as ready for review January 20, 2025 09:44
@SuthiYuvaraj SuthiYuvaraj requested a review from a team as a code owner January 20, 2025 09:44
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

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);
Copy link
Contributor

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:
image
The App is crashing. Could you check if are related with the changes?

Copy link
Contributor Author

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: image 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.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android 🤖 platform/iOS 🍎
Projects
None yet
3 participants