question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ionic 4 beta.7] Virtual Scroller doesn't always render correctly when it's items change

See original GitHub issue

Bug Report

Ionic Info Run ionic info from a terminal/cmd prompt and paste the output below.

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (C:\Users\gordo\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.3
   @angular-devkit/schematics : 0.7.3
   @angular/cli               : 6.1.3
   @ionic/ng-toolkit          : 1.0.6
   @ionic/schematics-angular  : 1.0.5

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : none
   Cordova Plugins       : no whitelisted plugins (0 plugins total)

System:

   NodeJS : v10.9.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

The virtualscroller does not always render correctly when changes are made to it’s input data (list of items). It would appear that the class virtual-loading sometimes ends up staying on elements that should be visible, even though they appear to be positioned correctly.

I can remedy this by forcing the elements to be visible:

.virtual-loading {
    opacity: 1 !important;
}

But this is not ideal as it means that if any items are slightly different from the value in approxItemHeight then the jumps in position are visible as the list recalculates.

On a further note, even when this gets remedied, it would be extremely useful to have a public method so that we can force complete recalculations of the virtualscroller’s items on demand.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
yekeskincommented, Nov 27, 2018

I had a similar problem. Giving virtual scroll an itemHeight function instead of using approxItemHeight solved it.

1reaction
kaelcommented, Sep 19, 2018

Well, if you’re using Ionic/Angular Virtual Scroll, not sure it’ll scale ; been there, done that. A list of with 600 ion-item-sliding with an image, a title, a description, and sliding options, didn’t scale.

You’d rather write your own Virtual Scroll component with Stencil based on the existing one, but with some custom method so that you can be better in control of virtual elements lifecycle. Observable are great for data binding, but when adding some traces it becomes scary to see so many checks and created/destroyed elements.

Also, you could make use of ngZone I believe, but I’m not up-to-date with Angular, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ionic 4 beta.7] Virtual Scroller doesn't always render correctly ...
The virtualscroller does not always render correctly when changes are made to it's input data (list of items). It would appear that the...
Read more >
ion-virtual-scroll - Ionic Framework
Virtual Scroll displays a virtual, "infinite" list. An array of records is passed to the virtual scroll containing the data to create templates...
Read more >
Ionic Virtual Scroll Long Label is not cutting off correctly
I have tried adding formatting to the ion-label in the element through the fixed parameter but that didn't change anything. I've also tried ......
Read more >
Angular ng-select - npm
Start using @ng-select/ng-select in your project by running `npm i ... [x] Virtual Scroll support with large data sets (>5000 items).
Read more >
Issues with position fixed & scrolling on iOS - Remy Sharp
I have a workaround for the fixed position button issue. Basically if you program a scrollto or scrolltop/scrollleft in javascript, fixed ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found