mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
* feat(list-view): Adds the ability to check whether or not an Item at index is Visible on screen within a listView * feat(list-view): add the unit-test for checking if list-item is visible. * clean(list-view): fix invalid reference in list-view-common * chore(list-view): remove unused logic * test(list-view) updates the tests for checking if item at index is visible * chore(ListView Tests): update the test_check_if_item_at_index_is_visible unit test to include 40 children, and test if the last item is visible or not. * Chore(ListView IOS): Apply requested changes to the for-loop, and replace with Array.some for readability. * chore(ListView android): Fix TSLint issues.
ListView module.
var lm = require("ui/label");
var lvm = require("ui/list-view");
var data = [];
for(var i = 0, l = 1000; i < l; i++) {
data.push(i);
}
var lv = new lvm.ListView();
lv.items = data;
lv.on(lvm.ListView.itemLoadingEvent, function(args){
var label = args.view;
if(!label) {
label = new lm.Label();
args.view = label;
}
label.text = "Item " + args.index;
});