Strange Horizontal ListView Behavior


#1

Hi,

The code is as Nativescript PlayGround
It is a sample code that user can mark an item in the listview by clicking the heart.

Everything works expectedly when the listview scrollDirection is “Vertical” as line 35 in the XML. When change to “Horizontal” as line 34, two bugs(?) happens.

  1. It gets “undefined” when I try to get “heart_4” as line 86 by click the button “Test”. But if scroll to “EEE” then click, it can get the object and heart will be marked.
  2. When tap the heart of “AAA”, it will be marked. However, the hearts of “D”, “G”, “J” are also marked.

Any advise?

Thanks


#2

I was not able to reproduce the issues you mentioned in a Android 7.x device. However I would recommend you to not assign dynamic ids on a ListView / directly access the templates rather control the template by data. Here is a similar example