Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6722] ListView: continuous update for scrolling event

GitHub Issuen/a
TypeNew Feature
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterMichael Gangolf
AssigneeJoshua Quick
Created2021-10-04T12:30:47.000+0000
Updated2021-10-04T19:24:47.000+0000

Description

The current scrolling event will only fire when there is a change in the direction. *Adding continuousUpdate:* When continuousUpdate is enabled the scrolling event will fire for every visibleItem/Section change. Would love to see an iOS parity ticket!
var toggle = true;
var win = Ti.UI.createWindow();
var btn = Ti.UI.createButton({
	title: "change",
	bottom: 20
});

btn.addEventListener("click", function() {
	toggle = !toggle;
	listView.continuousUpdate = toggle
  console.log(listView.continuousUpdate);
})
win.add(btn);

var listView = Ti.UI.createListView({
	height: Ti.UI.FILL,
	width: Ti.UI.FILL,
	continuousUpdate: true
});
var sections = [];

for (var s = 0; s < 5; s++) {
	var section = Ti.UI.createListSection({
		headerTitle: 'Section ' + s
	});
	var set = [];
	for (var i = 0; i < 20; ++i) {
		set.push({
			properties: {
				title: 'Item 0 ' + i
			}
		})
	}
	section.setItems(set);
	sections.push(section);
}

listView.sections = sections;
win.add(listView);

listView.addEventListener("scrolling", function(e) {
	console.log("Item", e.firstVisibleItemIndex, e.firstVisibleSectionIndex);
})
win.open();

Comments

No comments

JSON Source