Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[iOS] Xamarin forms list view unnecessarily scrolling to top when load more command is executed[Bug] #8306

Open
SatyaRamprasad opened this issue Oct 30, 2019 · 14 comments
Labels
a/listview Problems with the ListView/TableView e/5 🕔 5 p/iOS 🍎 t/bug 🐛

Comments

@SatyaRamprasad
Copy link

Description

[iOS] Xamarin forms list view unnecessarily scrolling to top when load more command is executed

Steps to Reproduce

  1. Create a custom list view with LoadMoreCommand
    public class CustomListView : ListView
    {

     public static readonly BindableProperty LoadMoreCommandProperty =
         BindableProperty.Create("LoadMoreCommand", typeof(ICommand), typeof(CustomListView), default(ICommand));
    
     public ICommand LoadMoreCommand
     {
         get { return (ICommand)GetValue(LoadMoreCommandProperty); }
         set { SetValue(LoadMoreCommandProperty, value); }
     }
    
     public CustomListView()
     {
         ItemAppearing += InfiniteListView_ItemAppearing;
     }
    
     void InfiniteListView_ItemAppearing(object sender, ItemVisibilityEventArgs e)
     {
         var items = ItemsSource as IList;
    
         if (items != null && e.Item == items[items.Count - 1])
         {
             if (LoadMoreCommand != null && LoadMoreCommand.CanExecute(null))
                 LoadMoreCommand.Execute(null);
         }
     }
    

    }

  2. Add items to customlistview

  3. Run and scroll to last item

Expected Behavior

Should not scroll to top after load more command

Actual Behavior

Scrolling to top when load more command executed

Basic Information

  • Version with issue: 4.3.0.908675
  • Last known good version:
  • IDE: Visual Studio 2019 Community 16.3.5
  • Platform Target Frameworks:
    • iOS: 13.1
  • Nuget Packages: Xamarin Forms 4.3.0.908675
  • Affected Devices:

Screenshots

Reproduction Link

@SatyaRamprasad SatyaRamprasad added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 30, 2019
@pauldipietro pauldipietro added this to New in Triage Oct 30, 2019
@adrianknight89
Copy link
Contributor

@SatyaRamprasad I'm not sure what kind of priority ListView has now, but my suggestion would be that you switch to CollectionView if at all possible. You're likely to face other types of issues with ListView in the future that won't get addressed soon.

@jsuarezruiz jsuarezruiz added a/listview Problems with the ListView/TableView p/iOS 🍎 labels Oct 31, 2019
@hartez
Copy link
Contributor

hartez commented Nov 4, 2019

@SatyaRamprasad Can you post the code for the command you are executing? What exactly does "load more" do?

@hartez hartez added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Nov 4, 2019
@hartez hartez moved this from New to Needs Info in Triage Nov 4, 2019
@SatyaRamprasad
Copy link
Author

@hartez i have added a sample project which reproduces the issue while scrolling.
Load more command calls load data function which adds new items to list
ListViewScrolling.zip

@LeoJHarris
Copy link

LeoJHarris commented Nov 6, 2019

@hartez I had the same issue as described in the title, I had a function to load more messages to a chat listview that was bound to an ObservableRangeCollection, on load more it would simply bulk insert new messages which was causing scrolling to automatically scrolll to top of listview on iOS. Android it worked fine and did not auto scroll but on iOS it wants to auto scroll to top of listview. I have not yet tried with Collection view.

@lucas-zimerman
Copy link

is there any workaround for this issue? it's impacting alot my app

@samhouts samhouts removed the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Nov 11, 2019
@samhouts samhouts moved this from Needs Info to New in Triage Nov 11, 2019
@hartez hartez removed the s/unverified New report that has yet to be verified label Nov 12, 2019
@hartez hartez added this to To do in iOS Ready For Work via automation Nov 12, 2019
@hartez hartez removed this from New in Triage Nov 12, 2019
@hartez hartez added the e/5 🕔 5 label Nov 12, 2019
@BalsamIbrahim
Copy link

BalsamIbrahim commented Dec 6, 2019

I'm have the same problem :( :(

@SatyaRamprasad
Copy link
Author

SatyaRamprasad commented Mar 5, 2020

@BalsamIbrahim As this list view issue didn't fixed yet, i switched my list to collection view. No issues now

@SatyaRamprasad
Copy link
Author

is there any workaround for this issue? it's impacting alot my app

Try using Collection View

@MereDoku
Copy link

if we use CollectionView in a RefreshView then there is exactly the same problem:
#10640
So actually use CollectionView is not the solution.
it's unacceptable that this bug is not fixed after so much time.
It makes us look bad to our customers.

@pboisso
Copy link

pboisso commented May 26, 2020

Have this problem also.

@rozek1szymon
Copy link

same here

@samhouts samhouts added this to the 5.0.0 milestone Aug 13, 2020
@samhouts samhouts added this to To do in vNext+1 (5.0.0) Aug 14, 2020
@marthinch
Copy link

I have tricky solution to prevent this issue by removing IsRefreshing flag in your list view.

@samhouts samhouts removed this from the 5.0.0 milestone Nov 2, 2020
@Elashi
Copy link
Contributor

Elashi commented Dec 6, 2020

I have tricky solution to prevent this issue by removing IsRefreshing flag in your list view.

Can you share it please

@jrlawhorne
Copy link

jrlawhorne commented Mar 24, 2021

Same issue. What I've done that seems to prevent the jump is to disable IsRefreshing and pull to refresh. Of course, there may be other yet to be discovered consequences to making those changes...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/listview Problems with the ListView/TableView e/5 🕔 5 p/iOS 🍎 t/bug 🐛
Projects
Development

No branches or pull requests