VirtualScroll scroll position not update when scroll to page bottom in iphone hardware


#1

Case:

  1. using VirtualScroll
  2. Iphone hardware (NOT simulator, ios 10.3.3)
  3. scroll down to page bottom
  4. remove last array item.
  5. page should auto scroll to page bottom, but it keep a empty space in bottom.
    When you touch the scrollable area, items go back to correct position.
  • already have approxItemHeight
  • already try to change to content size after array change
  • already try to force update by changeDetectorRef.detectChanges();
  • only happen in iphone hardware, android and mac desktop browser work correctly.

#2

Also, ion-refresher can’t use with virtual scroll in ios.
(only happen in iphone hardware again)
All scroll down action become pull to refresh.


#3

I’ve found a workaround on this (ionic 3.92):

  • firstly : declare both the elements
    @ViewChild(Content) content: Content;
    @ViewChild(VirtualScroll) vsrl: VirtualScroll;

-secondly: subscribe a content event related to the scroll where you can force the virtual scroll to recalculate his own size.

ngAfterViewInit() {
this.scrollEvnt = this.content.ionScrollEnd.subscribe((event) => {

  this.vsrl.resize();

});

}