Ion-list get index of current visible items


I’ve a substantial list (potentially thousands) of items I display in an ion-list and one of the elements I have in each item is a custom countdown string which updates the list of items through a service every second to change the element data. This actually works ok on IOS but on android it puts a massive performance hit on the app.

A solution I had in the original native android version of this app was to just update the data for the visible list items on the screen, which would be maximum 5 or 6 items.

My question is, is there a way of telling the index of the items being displayed on the screen at any time?


You should check out collection repeat, which actual handles this. Instead of tell the number of items that should be on screen, you set the height explicitly and then every item that isn’t in the viewport is hidden.


I’ve had a look at that before alright but how do I get the indexes of the items that are currently being displayed? Or at least the items that are being displayed so I can have the timeout function just update those items?


I might have a look at sticking with a ion-list and using this type of thing to figure out how far down I’m scrolled given I’ve a fair idea of the list item heights.

My issue will be the phone screen resolutions but I can over-estimate that and still make performance savings.



I have the same problem.

Would you’ve found a solution?