I have an ion-list with an *ngFor. Previously, if I would scroll down the list and then reload the scope array bound to the *ngFor, it would populate with the new data, but the scroll position would not change.
Since upgrading to ionic 6 when the array is reloaded, the ion-list auto-scrolls to the top.
Any help would be appreciated.
Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.4
@angular-devkit/build-angular : 13.2.5
@angular-devkit/schematics : 13.0.4
@angular/cli : 13.0.4
@ionic/angular-toolkit : 5.0.3
Capacitor CLI : 3.4.0
@capacitor/android : not installed
@capacitor/core : 3.4.0
@capacitor/ios : 3.4.0
cordova-res : 0.15.4
native-run : 1.5.0
NodeJS : v16.13.2 (/usr/local/bin/node)
npm : 8.1.2
OS : macOS Monterey
Hi, I have the same problem on IOS only, did you find a solution ?
It is happening on both iOS and Android platforms. Have not found a solution yet. Most work around involve scrollToPoint which is ok but not ideal.
Things could be caused by the way you change the content of the array and then how the change detector handles it
I am fetching the content from an API call, and then reassign the scope variable:
$scope.list = responsefromAPI
this used to just repopulate the array and not change the scroll. now it auto-scrolls to the top
I think then you are reassigning an array which causes angular to think there is sonething really new. That causes an expensive rerender and possibly a scrolltotop
Consider keeping the old array and replacing the difference within that array?
Then the change detection may not struggle that much
Any update ? I have the same problem. when updating view asynchronously scroll snaps to the top.