{ "id": "176282", "key": "TIMOB-28533", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "21201", "description": "", "name": "Release 10.1.0", "archived": false, "released": true, "releaseDate": "2021-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2021-09-10T09:28:34.000+0000", "created": "2021-09-08T09:21:28.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "ListView", "android", "regression" ], "versions": [ { "id": "21177", "name": "Release 9.3.1", "archived": false, "released": true, "releaseDate": "2021-01-26" } ], "issuelinks": [], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2021-09-10T09:28:34.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "The current {{ListView.scrollToItem}} always scrolls to the first section if there are multiple.\r\n\r\nI've tested 10.1.0 after https://github.com/appcelerator/titanium_mobile/pull/12762 was merged with this code:\r\n\r\n{code}\r\nconst win = Ti.UI.createWindow();\r\nconst animation = { animated: true };\r\nconst toggle_animation = Ti.UI.createButton({ bottom: 20, title: `animated: ${animation.animated}` });\r\n\r\nfunction createSection(sectionId, rows) {\r\n\tconst section = Ti.UI.createListSection({\r\n\t\theaderTitle: `Section ${sectionId}`\r\n\t});\r\n\tconst items = [];\r\n\r\n\tfor (let i = 0; i < rows; i++) {\r\n\t\titems.push({\r\n\t\t\tproperties: {\r\n\t\t\t\ttitle: `${sectionId} Row #${i}`,\r\n\t\t\t\tsearchableText: `Row #${i}`\r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\tsection.items = items;\r\n\r\n\treturn section;\r\n}\r\nconst listView = Ti.UI.createListView({ sections: [ createSection(0, 40),createSection(1, 40),createSection(2, 40) ] });\r\n\r\ntoggle_animation.addEventListener('click', e => {\r\n\tanimation.animated = !animation.animated;\r\n\ttoggle_animation.title = `animated: ${animation.animated}`;\r\n});\r\n\r\nsetInterval(_ => {\r\n\tconst i = Math.floor(Math.random() * listView.sections[0].itemCount);\r\n\tlistView.scrollToItem(1, i, animation); // use second section\r\n\tconsole.log(`scrollToItem: ${i}`);\r\n}, 2000);\r\n\r\nwin.add([ listView, toggle_animation ]);\r\nwin.open();\r\n{code}\r\n(almost the same as in the ticket but with 3 sections and scrollToItem(1, random)\r\n\r\nIt should scroll to the 2nd section, so rows with \"1 - row...\" should be the targets. But it is always going to \"0 - row ...\" items.\r\n\r\nSDK: 10.1.0 (compiled 9/8/2021)\r\nAndroid 11, Pixel 4 (device)", "attachment": [], "flagged": false, "summary": "Android: ListView scrollToItem always uses first section", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "459037", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~michael], I'm pretty sure this is fixed in the following PR since we internally use {{scrollToItem()}} to handle tap-and-hold to start item selection. I'll need to double check.\r\nhttps://github.com/appcelerator/titanium_mobile/pull/12769\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-09-08T15:58:32.000+0000", "updated": "2021-09-08T15:58:32.000+0000" }, { "id": "459038", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~michael] I pushed a fix for this into https://github.com/appcelerator/titanium_mobile/pull/12769, thanks for reporting this", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2021-09-08T17:25:55.000+0000", "updated": "2021-09-08T17:25:55.000+0000" }, { "id": "459039", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~gmathews] Awesome, thanks for the quick fix. Works fine (y)", "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2021-09-08T17:44:06.000+0000", "updated": "2021-09-08T17:44:06.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }