Ionic-framework: RC4 ion-img doesn't correctly work with virtualScroll

Created on 16 Dec 2016  ·  90Comments  ·  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
[ ] 1.x
[x ] 2.x

I'm submitting a ... (check one with "x")
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
When you use virtualScroll and ion-img, after scrolling down (when buffer ends) ion-img stops loading images

_034

Please look at code inspector:

2016-12-16 10-23-17

url http://base247.lin2/thumbs/c6/files_56_222bf7a3335ce7c20553f0f374eb0266b871af41.jpg_mobileListImage_1412346660_3.jpg

is correct (for my local machine) and image is available.

Expected behavior:
ion-img must load images

Steps to reproduce:

Related code:

<ion-content>
    <ion-refresher (ionRefresh)="dataService.refresh($event)">
    <ion-refresher-content
        pullingText="Потяните для обновления"
        refreshingText="Загрузка">
    </ion-refresher-content>
</ion-refresher>
    <ion-list [hidden]="(works|filterWorks:filter.price.mode:filter.price.from:filter.price.to:filter.price.currency_id:filter.location.mode:filter.added.mode:sort.orderBy:commonData).length==0" [virtualScroll]="works|filterWorks:filter.price.mode:filter.price.from:filter.price.to:filter.price.currency_id:filter.location.mode:filter.added.mode:sort.orderBy:commonData" approxItemHeight="80px" >
    <ion-item-sliding *virtualItem="let work">
        <button ion-item (click)="goWork(work)" [ngClass]="{'work-list-item-selected':selectedWorks.works[work.id]}">
            <ion-thumbnail item-left>
                                    <ion-img [src]="work.image|defaultImage"></ion-img>
                            </ion-thumbnail>
                        <h3>{{commonData.authors[work.author_id]?.title}}</h3>
            <h5>{{work.title}}</h5>
            <p class="work-list-price">{{work.price | price : work.price_currency_id : commonData.currencyExchangeRate : true}}</p>
            <p>{{work.year ? work.year+',':''}} {{work.techniques | techniques : commonData.techniques : commonData.mainLanguageId}}</p>
        </button>
        <ion-item-options side="left">
            <button ion-button icon-only color="primary" (click)="selectedWorks.toggle(work)">
                <ion-icon name="{{selectedWorks.works[work.id] ? 'checkmark-circle':'radio-button-off'}}"></ion-icon>
            </button>
        </ion-item-options>
        <ion-item-options side="right">
            <button ion-button icon-left color="primary" (click)="sendWorkByEmail(work)">
                <ion-icon name="mail"></ion-icon>
                Email
            </button>
        </ion-item-options>
    </ion-item-sliding>
</ion-list>
</ion-content>

Other information:

Bug appeared in RC4, in RC3 all was OK.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

Cordova CLI: 6.3.1 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.13
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v4.2.6
Xcode version: Not installed
v3

Most helpful comment

I also had this issue. The bug is the calculation of the img::top and img::bottom in ion-img. This will be used to set the flag canRequest and canRender in Content::updateImgs for ion-img while scrolling.
My first workaround was to extend ion-img for virtual lists.

import {Component, ElementRef, Renderer, Optional} from "@angular/core";
import {Img, Platform, DomController, Content} from "ionic-angular";

@Component({
  selector: 'virtual-ion-img',
  template: '<img>'
})
export class VirtualIonImg extends Img {
  constructor(private __elementRef: ElementRef,
              __renderer: Renderer,
              __plt: Platform,
              @Optional() private __content: Content,
              __dom: DomController) {
    super(__elementRef, __renderer, __plt, __content, __dom);
  }

  get top(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.top + this.__content.scrollTop - this.__content._cTop;
  }
  get bottom(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.bottom + this.__content.scrollTop - this.__content._cTop;
  }
}

Another option is to fix the calculation in Content::imgsUpdate by override this function in your page.

import {updateImgs} from "ionic-angular/components/content/content";
import {Component, ViewChild} from "@angular/core";
import {Content} from "ionic-angular";

@Component({
  templateUrl: 'virtual-list.html',
})
export class VirtualListPage {
  @ViewChild(Content) _content: Content;
  ngAfterViewInit(){
    if(this._content) {
      this._content.imgsUpdate = () => {
        if (this._content._scroll.initialized && this._content._imgs.length && this._content.isImgsUpdatable()) {
          // reset cached bounds
          this._content._imgs.forEach((img:Img)=>img._rect = null);
          // use global position to calculate if an img is in the viewable area
          updateImgs(this._content._imgs, this._content._cTop * -1, this._content.contentHeight, this._content.directionY, 1400, 400);
        }
      };
    }
  }
}

All 90 comments

I have the same issue with my app since updating to rc4.

I am facing the similar issue with RC 4, in RC 3 it was working fine.

Same issue on my end

try using just "img" instead of "ion-img". Worked for me.

"ion-img" stopped working for me in rc4, too (even without virtual scroll). Could replacing with "img" cause some performance issues in longer lists?

@sajTempler yes it works but we loose the performance benefits such lazy loading that comes with ion-img

You can still use ng2 lazy loader. There are two or more. I'm using this one https://github.com/tjoskar/ng2-lazyload-image

Ciao folks,
ion-img work fine only if the tag is in the visible content., every List, segment an so on ....doesn't work .
My temporary fix:

  1. open node_modules/ ionic-angular/component/img/img.js
  2. change the function ngAferContentInit with:

    Img.prototype.ngAfterContentInit = function () {
    var _this = this;
    this._img = this._elementRef.nativeElement.firstChild;

    if(!this._img.hasAttribute("src")){
    
    
        this._img.src=this._elementRef.nativeElement.getAttribute("src");
    
    }
    
    this._unreg = this._platform.addEventListener(this._img, 'load', function () {
        _this._hasLoaded = true;
        _this.update();
    }, { passive: true });
    

    };

I hope in quickly fix by Ionic team:)

Hello all! Thanks for using Ionic! Could someone post a repo that i can use to reproduce this issue?

@jgw96 I emailed you a sample

Do you still have the problem? The "ion-img" does not work as expected on my app, but I can not find an explanation for the moment

Same here. Was this fixed?

@naveedahmed1 Could you post your sample here? I'm not sure we're talking about the same problem

We also ran into this issue with our non-virtualScroll grid. We reproduced the issue in a plunker. Seems to work fine in a finite (non-virtualScroll) list. Whenever we add ion-infinite-scroll to the list the ion-images show issues with loading and unloading.

So 'normal' lists seem to work just fine. Lists with virtualScroll or infiniteScroll seem to have issues.

RC5 - same issue

Well apparently ion-img should only be used in conjunction with virtualScroll:
https://github.com/driftyco/ionic/commit/a5bbbd55cbd0e256614b6a1062aabbab4b1f21bd

I have exactly the same behavior as @pavimus

After the virtual scroll buffer, image does not appear, css class is "img-unloaded" (see screenshot below)

ionimg

with ionic 2 final. Please, could you communicate on this problem?

I have this bug also in latest ionic

As we really needed this to work in our scrollable grid of images (ion-grid, without virtual scroll), we have temporarily replaced the <project_root>/node_modules/ionic-angular/components/img/img.js file in our project with this gist.

After some digging around it appears that the _top_ and _bottom_ of an ion-img are not relative to the absolute top of the container it is in, causing the wrong images to be loaded/unloaded. See lines 231 and 242 of the gist for the workaround.

We also tried extending ion-img, but without much success. And building a (temporary) custom version of the Ionic dist files and using that as a local dependency also appears to be more complicated than we thought. So while the Ionic team works on this, we will be using this workaround.

@sajTempler Is it possible to load images only when scroll stopped with that plugin?

This bug and some more (images not responsive and only 5x5 on chrome/android, images not loading on first start before any scrolling..) broke a production app which heavily relies on showing articles with lazy loaded images.
Nice that we get no documentation whatsoever on such changes. Not that this is anything news.

@ventr1x I also wonder what devs are doing because this critical bug is still open from december 16

It's just plain broken (it never really worked, in beta it wasn't even mentioned in any doc).

I switched to ng2-lazyload-image and got it working with rc6 like that (so some might not go through the same non documented things..):

Component

import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';

@Component({
  templateUrl: 'image-modal.html'
})
export class ImageModal {
  @ViewChild(Content) content: Content;

  constructor() {
  }

}

View
<img [src]="img" [lazyLoad]="img" [scrollObservable]="content.ionScroll" />

@ventr1x Is it possible to load images only when user stopped scrolling with this plugin?

@jgw96 any status update?

Same problem here..
If i put the ion-img inside a segment it won't load.
http://plnkr.co/edit/Zb2EQQVCFgdyZ1CRfPsW?p=preview

can easily reproduce with Ionic 3.1.1 here https://github.com/shprink/ionic-withwebworker-vs-withoutwebworker

Though this isn't related to the issue, @shprink have you found any way to run complete ionic app from webworker?

Have not tried anything like this yet @naveedahmed1

Ok, the link you shared had webworker in url so I thought you might have tried it. I just checked you are using service workers. But unfortunately service workers aren't supported on device whereas web workers work on device as well.

ion-img within a virtual scroll is supposed to load the img in a web worker that's why it is in the title.

I replaced ion-img with img and it works fine within the virtual scroll use img instead of ion-img

The doc says that one should use ion-img for performance reasons, see: https://ionicframework.com/docs/api/components/virtual-scroll/VirtualScroll/

Therefore, going for imginstead of ion-img cannot be a permanent solution and I hope that this long standing bug will be fixed soon.

@manucorporat Any progress on this issue, yet?

+1

I also had this issue. The bug is the calculation of the img::top and img::bottom in ion-img. This will be used to set the flag canRequest and canRender in Content::updateImgs for ion-img while scrolling.
My first workaround was to extend ion-img for virtual lists.

import {Component, ElementRef, Renderer, Optional} from "@angular/core";
import {Img, Platform, DomController, Content} from "ionic-angular";

@Component({
  selector: 'virtual-ion-img',
  template: '<img>'
})
export class VirtualIonImg extends Img {
  constructor(private __elementRef: ElementRef,
              __renderer: Renderer,
              __plt: Platform,
              @Optional() private __content: Content,
              __dom: DomController) {
    super(__elementRef, __renderer, __plt, __content, __dom);
  }

  get top(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.top + this.__content.scrollTop - this.__content._cTop;
  }
  get bottom(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.bottom + this.__content.scrollTop - this.__content._cTop;
  }
}

Another option is to fix the calculation in Content::imgsUpdate by override this function in your page.

import {updateImgs} from "ionic-angular/components/content/content";
import {Component, ViewChild} from "@angular/core";
import {Content} from "ionic-angular";

@Component({
  templateUrl: 'virtual-list.html',
})
export class VirtualListPage {
  @ViewChild(Content) _content: Content;
  ngAfterViewInit(){
    if(this._content) {
      this._content.imgsUpdate = () => {
        if (this._content._scroll.initialized && this._content._imgs.length && this._content.isImgsUpdatable()) {
          // reset cached bounds
          this._content._imgs.forEach((img:Img)=>img._rect = null);
          // use global position to calculate if an img is in the viewable area
          updateImgs(this._content._imgs, this._content._cTop * -1, this._content.contentHeight, this._content.directionY, 1400, 400);
        }
      };
    }
  }
}

DavidWiesner thanks for the answer
i'm new in ionic and angular ( testing ionic vs react native in fact )

in which file I have to past this please ? in app.components.ts ?

@DavidWiesner, Thanks for the solution. Can you provide us an example? I'm stuck with the updateImgs() function

@alainib

for the first workaround

you have to create a new file e.g. src/components/virtual-ion-img.ts this new component than has to register in src/app/app.module.ts

import {VirtualIonImg} from "../components/virtual-ion-img";
...
@NgModule({
    declarations: [
        //... all other pages and components,
        VirtualIonImg
    ],
//... all other stuff e.g.: imports, providers
    entryComponents: [
        //... other pages and components,
        VirtualIonImg
    ]
})

Than you can use the tag <virtual-ion-img [src]="url"></virtual-ion-img> in place of <ion-img> like described in http://ionicframework.com/docs/api/components/virtual-scroll/VirtualScroll/#images-within-virtual-scroll

for the second workaround

Just edit the typescript page file which has an virtual scroll inside and add the imports, the ViewChild stuff and the method ngAfterViewInit.

@kabus202 I edited my comment and add the missing import statement. The function updateImgs is defined in the ionic angular content package and has to be imported.

@DavidWiesner The first workaround works better, but I still see stale images in place of images that do not load.

@DavidWiesner : Thanks a lot ! Your first workaround seems to be working perfectly for me (in a very simple example I built to convince myself that I was not crazy and that VirtualScroll was indeed broken), I'll try it in a real life app now.

Could you maybe make a pull request to fix the actual Ionic _Img_ component ?

@DavidWiesner thanks for the explanation.
I still have trouble sorry (i'm new and trying react/ionic/nativscript in same time)

this is what i do :

app.module.ts

import { NgModule, ErrorHandler } from '@angular/core';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import {VirtualIonImg} from "../components/virtual-ion-img";


@NgModule({
  declarations: [
    MyApp,      AboutPage,      ContactPage,        HomePage,       TabsPage
    VirtualIonImg
  ],
  imports: [
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,  AboutPage,      ContactPage,    HomePage,TabsPage
    VirtualIonImg
  ],
  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}]
})
export class AppModule {}

virtual-ion-img.ts

import {Component, ElementRef, Renderer, Optional} from "@angular/core";
import {Img, Platform, DomController, Content} from "ionic-angular";

@Component({
  selector: 'virtual-ion-img',
  template: '<img>'
})
export class VirtualIonImg extends Img {
  constructor(private __elementRef: ElementRef,
              __renderer: Renderer,
              __plt: Platform,
              @Optional() private __content: Content,
              __dom: DomController) {
    super(__elementRef, __renderer, __plt, __content, __dom);
  }

  get top(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.top + this.__content.scrollTop - this.__content._cTop;
  }
  get bottom(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.bottom + this.__content.scrollTop - this.__content._cTop;
  }
}

my view

<ion-content padding>
  <h2>Ionic List items</h2>
    <ion-list [virtualScroll]="items">
        <ion-item *virtualItem="let item">
            {{ item.i }}
            <virtual-ion-img [src]="item.src"
                 alt="item.image"  height="200" width="300" >
            </virtual-ion-img>
        </ion-item>
    </ion-list>

  FIN
</ion-content>

i have this error :

[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of
       date.
Error: Template parse errors:
Can't bind to 'src' since it isn't a known property of 'virtual-ion-img'.
1. If 'virtual-ion-img' is an Angular component and it has 'src' input, then verify that it is part of this module.
2. If 'virtual-ion-img' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this componen
t to suppress this message.
 ("
        {{ item.i }}

        <virtual-ion-img [ERROR ->][src]="item.src"
             alt="item.image"  height="200" width="300" >
                </virtual-ion-img>
"): HomePage@16:25

what i'm missing please ?

@alainib Maybe you need to use [src]="item.src" instead of src="item.src

kabus202 . thanks for help. the error i get is with [src] , i tryed both but i paste wrong html code her ;)

with 'src' i get this error

typescript: ..._amap/react-native-compare-ionic2-master/ionic/src/components/virtual-ion-img.ts, line: 14
Supplied parameters do not match any signature of call target.

            __dom: DomController) {
  super(__elementRef, __renderer, __plt, __content, __dom);

ngc failed: Failed to transpile TypeScript

@alainib which version of ionic do you use? In 3.2 the constructor of Img was changed. Before Ionic 3.2 you have to add NgZone as another parameter to the constructor.

VirtualIonImg before Ionic 3.2

import {Component, ElementRef, Renderer, Optional, NgZone} from "@angular/core";
import {Img, Platform, DomController, Content} from "ionic-angular";

@Component({
  selector: 'virtual-ion-img',
  template: '<img>'
})
export class VirtualIonImg extends Img {
  constructor(private __elementRef: ElementRef,
              __renderer: Renderer,
              __plt: Platform, 
              __zone: NgZone,
              @Optional() private __content: Content,
              __dom: DomController) {
    super(__elementRef, __renderer, __plt, __zone, __content, __dom);
  }

  get top(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.top + this.__content.scrollTop - this.__content._cTop;
  }
  get bottom(){
    this._rect = (<HTMLElement>this.__elementRef.nativeElement).getBoundingClientRect();
    return this._rect.bottom + this.__content.scrollTop - this.__content._cTop;
  }
}

It's been six months, why hasn't it been fixed?

@WangRongda Did you submit a PR that should have been accepted that fixes this?

@janpio Magically, it display normally right now. I has been in trouble several days becouse the ion-img can't display normally.Sorry.

Still have the issue, in a list with ~200 items with remote images, the images either not loading or are scrambled (images from previous items are on a current item). Any idea how to fix this? I tried the solution with virtual-ion-img and didn't worked

@dspachos as I understand ionic team mentioned that fixing virtual scroll bugs is not a priority for them at the moment, try to use infinite-scroll instead.

@JustasKuizinas But infinite-scroll is not the solution. At the end, all items are in the DOM. So there are lots of memory issues especially in iOS.

There was similar problems in ionic1.x. I thought all of them is fixed in ionic2 or 3. Unfortunately there is no solution.

@vahidvdn it's not the solution but ionic team themselves said it's best option right now till virtual scroll is fixed :)

@JustasKuizinas I hope they make a fix for this problem.

But there is a good library called vs-repeat (for both angularjs and angular). I tested for angularjs. It's really awesome, but have a lot of lags while scrolling in iOS.

I don't know what is the priority for ionic team, but virtualScroll is one of the most important components that real world apps use.

@vahidvdn Totally agree with you, I'll finish my current app using Ionic, but I've decided that for my next app I'll use another framework (React Native probably or Native script). The Ionic team is doing great work, but the framework is having performance issues. In my current app, I ended up with a static list of maximum 50 items with images (due to the virtual scroll bug) and when I press the Back button there is a lag (I simple use popView, the default behaviour). This lag is not present for example when my lists have 15-20 items.
Moreover, in iOS when the device is in battery save mode (and the CPU probably is slowing down things) the performance is even worse, almost not usable.

@dspachos few months ago I also thought oh it's virtual scroll it must be top priority to make it work like a charm so I chose ionic instead of nativescript, but now it's sad to hear that it's still broken and we cant get lag free performance with huge lists of data.

I'm had the same issue, but I know that my lists will have less than 150 items. I tried to use img instead of ion-img and it works fine without performance lose. I lost some time trying to solve with ion-img but actually not all lists needs this resource.

@diegomachado1 Are you sure your images are in their right position? Please slow down your network connection, then test again. When some images don't get loaded, previous images come to their places and conflict with each other.

2017-08-16 and ionic 3.6 and problem still exists.
In my case I apply second fix (posted upper) and it works.

@decpio Would you please tell us what exactly you did?

ok,

I added to my broken page:
import { Component, ViewChild } from '@angular/core';
import { updateImgs } from 'ionic-angular/components/content/content';
import { Img } from 'ionic-angular/components/img/img-interface';
import { Content } from 'ionic-angular';

/* 2017-08-16 - add this to class body
    start FIX#9660 ion-img doesn't correctly work with virtualScroll
    https://github.com/ionic-team/ionic/issues/9660#issuecomment-304840427
*/
@ViewChild(Content) _content: Content;
ngAfterViewInit() {
    if (this._content) {
        this._content.imgsUpdate = () => {
            if (this._content._scroll.initialized && this._content._imgs.length && this._content.isImgsUpdatable()) {
                // reset cached bounds
                this._content._imgs.forEach((img: Img) => (<any>img)._rect = null);
                // use global position to calculate if an img is in the viewable area
                updateImgs(this._content._imgs, this._content._cTop * -1, this._content.contentHeight, this._content.directionY, 1400, 400);
            }
        };
    }
}
/*
end FIX#9660
*/

and thats it - problem disappear.
My broken page:













<ion-content padding> <ion-grid [virtualScroll]="__items" [bufferRatio]="2" approxItemHeight="80px" approxItemWidth="100%" [virtualTrackBy]="ItemComparer"> <div *virtualItem="let item"> <ion-row align-items-center justify-content-center> <ion-col col-auto> <ion-item> <ion-thumbnail item-start> <ion-img [src]="'my-personalized-url?item='+item?.item"></ion-img> </ion-thumbnail> </ion-item> </ion-col> </ion-row> </ion-grid>

@DavidWiesner Thank you! I'm using Ionic-Angular 3.6.0 (the latest at the time of this writing), and it works as expected.

The 2nd one works very well too. But I didn't want to use it because of width and height issues. I also encountered some issues where the bottom items are overlapped by the items above them if they haven't had their image loaded. But when I do scroll down, the overlapping issues are gone. The previous items that have disappeared from the viewport started to overlap. And once those items are in the viewport and the images loaded again, the overlapping issue are gone for those batches. Just FYI.

@decpio your solution works perfect for me. Images remain as "unloaded" as long as scroll don't reach them but are loaded and appear when it should be. Thank you very much!!!

Just one thing noticed, if screen/window/frame size changes after the page has been loaded, lacy load still works only for those number of items that are located within the init range. But this could be caused by the origin behavior already.

thanks @DavidWiesner & @decpio the second workaround fix the problem on Ionic 3.7.1

So the workaround fixes the issue for Ionic 3.8 too. Why not using it @manucorporat @adamdbradley
This is still something really bad for any VS use...
@masimplo Would you check it? After your awesome work for https://github.com/ionic-team/ionic/pull/12917 you definitively have skills to dive in VS... 🙉

this workaround is not working on iOS9. On iOS10 & iOS11 it's ok.

@HugoHeneault, @manucorporat, @adamdbradley : I fully agree that this workaround should be merged in Ionic (I'd do a pull request but as I'm not the author of the workaround I don't feel confortable making it myself), maybe it's not perfect, but it's still infinitely better than without the patch.

I think the issue is that the Ionic team don't realize that virtualscroll is not working. There's an entry that says "virtual-scroll: flickering issue fixes" in the 3.8 changelog, why would you go and fix some flickering issues for a feature that you know doesn't work at all ?

I agree @nicolus the Ionic team don't realize that virtualscroll/ion-img is not working and that virtualscroll is not working with ion-refresh. @HugoHeneault @manucorporat @adamdbradley

@HugoHeneault I haven't really worked with ion-img at all. I probably should have, but haven't. I can take a look but I don't have a reference on what is broken.

@nicolus the entry in the changelog is from a PR I submitted myself that fixes a regression issue in virtual scroll. I understand your frustration, but that PR fixed a particular issue with VS that made it unusable when the underlying data set was getting updated often, it was not a complete rewrite of the component that solved all issues.

I too agree that VS needs a lot more attention but it has two main issues that probably make its maintenance unviable:

  1. Virtual scroll is a hard problem to solve in the first place. Very few frameworks/libraries have solved it successfully and with certain restrictions. Ionic VS tries to solve everything, variable item size, multi column, headers/footers per item, images, resizing etc. The existing implementation has gone through various refactoring cycles fixing bugs here and there many which are unrelated with the component it self (look at point 2 for more info)
  2. Ionic virtual scroll interacts with many ionic components. Ion-img for images, infinite scroll for loading more data, content for scrolling etc. It is also supposed to render both ionic elements ion-item, ion-card etc as well as custom angular elements.

This complexity is too much for a PR to handle and it requires a complete redesign about what virtual scroll does (which means it has to align with ionic team's goals), how it does it and what interactions with other components it should have.

Moving to ionic v4 I think many of these will change (for one it will probably be able to render only other web components and not angular components inside it) like iron-list of polymer does today so not sure if putting in the effort in fixing the current implementation has any real value for people that will continue using ionic framework after its v4 release in their projects. I too am looking for options out of this rabbit hole as without virtual scroll we cannot compete with native applications in rendering a realistic amount of data.

@masimplo : you're right, I forgot that virtual scroll is used for a lot more than just ion-img (because that's what I personally use it for).
I didn't mean to criticize this particular bugfix, I just wish we had more feedback from the team regarding this issue.

I hope for a quick fix on this one. Are there any news? Is this investigated by the team?

I hope in a fix too

@RafaelKr @fdambrosio I think it's better not to hope for any fixes on components before v4 is released. Unfortunately for us working with ionic3, we have to deal with buggy components or to fix them by ourselves. Feel free to fix & create PR ;)

+1

try using this way
html <ion-img [src]="image.url" [alt]="image.alt">

still waiting for a fix...

You have to wait for ionic v4.

@miqmago: Please read here for further information:
https://blog.ionicframework.com/whats-the-issue-with-issues/

I had same issue of showing image in inside [virtualScroll] how do i fix them.

You have to wait for ionic v4.

It would be stupid to believe that it will be fixed in Ionic 4.
We will have new bugs, but the team will focus on Ionic 5, then 6, leaving a lot of bugs for each new version.
On the side of React, there is a risk of breaking changes in each version, but at least we know what to expect.
Very disappointed by Ionic... It's unworthy to let bugs drag for so long and let users fix them.

@mopi1402 I know that how issues have been handled by ionic team in the past isn't really good. But if you want to learn how they will handle versioning and upcoming issues, you should read
https://blog.ionicframework.com/whats-the-issue-with-issues/
https://blog.ionicframework.com/ionic-semantic-versioning-release-schedule-and-lts/

Don't forget that ionic framework is open sourced and that anyone can help fixing issues. :)

@mopi1402 If you are an Angular developer, I suggest Nativescript instead of react-native.
Here you can find why Nativescript is better than react.

I agree @mopi1402 this is one of the most used feature

Still not working in v4 beta.

it's no good that it's not working with Ionic 4

Ionic is an open source software guys, if you want things to get fixed quickly you can create a patch and submit a PR 👍

@HugoHeneault : It's open source software that I pay $29 a month through my pro subscription (I mean sure the framework itself is free, but it's not like they're a non-profit organization, they give the framework for free on order to make money on subscriptions), so I don't expect to have to fix it myself for free.

I can understand that it's a hard issue to fix, that ionic 4 is still beta, that it's a low priority issue... All those are perfectly valid reasons, but "it's OSS fix it yourself lol" is not.

@nicolus You're quite right, and I've also been complaining when the services I pay for were not working. But we should keep in mind that even if Ionic company might be making money from premium services, many devs from their teams are working a lot and need to earn their living... for a free tool that anyone can use without paying.

For me it's the way OSS work: you have no obligation on paying their services and can create awesome apps without giving a cent, but they provide services to make your life easier. I'm also paying for many pro subscriptions which doesn't mean I can't help when a fix is possible without spending days on it.

This issue has been automatically identified as an Ionic 3 issue. We recently moved Ionic 3 to its own repository. I am moving this issue to the repository for Ionic 3. Please track this issue over there.

If I've made a mistake, and if this issue is still relevant to Ionic 4, please let the Ionic Framework team know!

Thank you for using Ionic!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexbainbridge picture alexbainbridge  ·  3Comments

gio82 picture gio82  ·  3Comments

manucorporat picture manucorporat  ·  3Comments

alan-agius4 picture alan-agius4  ·  3Comments

BilelKrichen picture BilelKrichen  ·  3Comments