Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14691] iOS: ListView scrollToItem broken

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-09-03T05:53:42.000+0000
Affected Version/sRelease 3.1.1, Release 3.2.0
Fix Version/sRelease 3.4.0
ComponentsiOS
LabelsiOS, listview, qe-manualtest, scrollToItem, supportTeam
ReporterMark Mokryn
AssigneeIngo Muschenetz
Created2013-07-28T19:40:14.000+0000
Updated2014-09-10T22:59:24.000+0000

Description

*Problem* On iOS the ListView will not be properly displayed or scrolled. On Android (tested 4.1.2 phone) works as expected. *Test case*
var win = Ti.UI.createWindow({
	backgroundColor : 'white'
});
var listView = Ti.UI.createListView({
	top : '150dp'
});

var btn = Ti.UI.createButton({
	top : '45dp',
	width : '300dp',
	height : '40dp',
	title : 'iOS will mess up'
});
btn.addEventListener('click', function() {
	listView.removeAllChildren();
	var fruitSection = Ti.UI.createListSection({
		headerTitle : 'Fruits'
	});
	var sections = [];
	fruitSection.setItems([]);
	sections.push(fruitSection);
	listView.sections = sections;

	for (var i = 0; i < 100; i++) {// 100 to show it works on Android. But even 1 loop will break iOS
		listView.sections[0].appendItems([{
			properties : {
				title : 'Apple ' + i
			}
		}]);
		// listView.sections[0].insertItemsAt(i, [{properties: { title: 'Apple ' + i}}]); // this doesn't work either
		listView.scrollToItem(0, i);
		// this line causes the bug - comment it out to try
	}
	//listView.scrollToItem(0, 99); // if you try the scroll at the end, comment out the previous - *usually* buggy, not always
	Ti.API.info('finished');

});
win.add(btn);
win.add(listView);
win.open();

Comments

  1. Mark Mokryn 2013-07-28

  2. Daniel Sefton 2013-07-29

    Tested and confirmed on iOS 6 simulator and iPhone 4 device with Ti SDK 3.1.1 GA and latest 3.2 CI.
  3. Shameer Jan 2014-09-03

    Bug exist with TiSDK 3.1.1.GA and 3.2.0 but cannot reproduce with 3.4.0 GA Appcelerator Studio, build: 3.3.0.201407111535 iOS 6.1
  4. Mark Mokryn 2014-09-03

    With 3.4.0 GA? You mean 3.3.0.GA?
  5. Ingo Muschenetz 2014-09-03

    No, we are asking people to confirm issues with the latest master release to see if they have been fixed. Please download the latest 3.4.0 build from builds.appcelerator.com and see if it is fixed for you as well.
  6. Olga Romero 2014-09-03

    Environment tested Mac osx 10.9.4 Maverics Appcelerator Studio, build: 3.4.0.201409021758 Titanium SDK, build: 3.4.0.v20140829184521 acs@1.0.16 alloy@1.5.0-dev (git://github.com/appcelerator/alloy.git#28af71f2e10ca61929443277176323ec8746ee14) install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium@3.4.0-dev (git://github.com/appcelerator/titanium.git#be6d7a682c881e42246a2d31caac931b5f694024) titanium-code-processor@1.1.1 Xcode6-Beta7 iOS 8.0 (iPhone5s) and iOS 7.0.3(iPhone5) Simulators ListView displayed properly, scrollToItem works as expected.
  7. Olga Romero 2014-09-10

    Tested with Mac osx 10.9.4 Maverics Appcelerator Studio, build: 3.4.0.201409081810 Titanium SDK, build: 3.4.0.v20140909222515 acs@1.0.16 alloy 1.5.0-rc install@0.1.7 npm@1.4.23 sudo@1.0.3 titanium 3.4.0-rc titanium-code-processor@1.1.1 Xcode6-Beta7 Device: iPhone 5S iOS 8.0 Works as expected.

JSON Source