bug: Ion-image inside virtual scroll shows wrong image until new one loaded
See original GitHub issueBug Report
Ionic version:
[x] 4.x
Current behavior:
When adding ion-image inside virtual scroll and scrolling it is showing old image for some time until the new image is loaded.
Expected behavior:
Should not show wrong image, instead should be empty image until the image is loaded
Steps to reproduce:
Add virtual scroll and add image inside each item, then scroll trough to see wrong image displayed for short time.
Related code:
https://github.com/jgermanis/virtual-scroll-test
Other information:
Ionic info:
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:15 (3 by maintainers)
Top Results From Across the Web
bug: Ion-image inside virtual scroll shows wrong ... - GitHub
Current behavior: When adding ion-image inside virtual scroll and scrolling it is showing old image for some time until the new image is...
Read more >Ionic - Scrollable list of big images - Memory Usage
This is useful for VirtualScroll by allowing image responses to be cached, and not rendered, until after scrolling has completed, which allows ...
Read more >Lazy loading images and managing lists with Ionic VirtualScroll
Only loads images which are visible in the viewport (avoiding unnecessary network requests for images which aren't visible); Uses web workers ...
Read more >ion-img Tag - Ionic Framework
Img tag lazy loads images whenever the tag is in the viewport. Utilize this component when generating large lists—as images are only loaded...
Read more >How to Lazy Load Images with Ionic - YouTube
Learn to lazy load images within your Ionic apps with a cool and powerful package that we can customise with hooks exactly for...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Wanted to +1 this issue. I quickly tried @michael-roewin’s suggestion to use
<img>
instead of<ion-img>
but it didn’t seem to stop the image from the last DOM scroll staying in place until the new image is loaded.In my mind there are two ways to address this
It’s not acceptable for me personally to have the images flash to the new image on load.
I’m pretty sure I will have to abandon virtual scroll and do some type of pagination.
To Fix this permanently:
Use this: https://github.com/rintoj/ngx-virtual-scroller
Do this in page where there is ion-content:
Now, you can use importantElement right away or store it in the service in case you need it in routes where there is no ion-content.
Bob IS your uncle.