Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28573] Android: Complex items added to ListView after window open can cause scroll performance issues as of 9.3.0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2021-11-03T01:04:49.000+0000
Affected Version/sRelease 9.3.0
Fix Version/sRelease 10.1.1
ComponentsAndroid
LabelsListView, android, performance, regression
ReporterJoshua Quick
AssigneeJoshua Quick
Created2021-11-02T23:25:23.000+0000
Updated2021-11-17T10:58:55.000+0000

Description

*Summary:* As of Titanium 9.3.0, list items added to a ListView after the window has opened can cause a huge scroll performance issue. This is only noticeable if the list item templates contain a lot of child views, such as 16 or more. This is not an issue if items are added before the window has opened. *Note:* This is an issue with TableView as well. *Steps to reproduce:*

Build and run [^ListViewTemplateManyViewsTest.js] on Android.

Fling the ListView down.

Notice how bad the scrolling stutters.

*Cause:* All Titanium proxy objects are assigned the root activity by default, which is the splash screen window. https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/src/java/org/appcelerator/kroll/KrollProxy.java#L173 The issue with this is that ListView will notice that the ListItem's activity does not match the activity the ListView is attached to and will *+correctly+* update the ListItem's activity and release its old views. This behavior is correct because the item needs to use the same theme as the ListView, but the item should favor the top-most activity and not the root activity when created. https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/ui/src/java/ti/modules/titanium/ui/widget/listview/ListViewHolder.java#L165-L168 *Work-Around:* Add the items before the window opens, such as during ListView or ListSection creation.

Attachments

FileDateSize
ListViewTemplateManyViewsTest.js2021-11-02T23:23:51.000+00001976

Comments

  1. Joshua Quick 2021-11-02

    PR (master): https://github.com/appcelerator/titanium_mobile/pull/13163
  2. Ewan Harris 2021-11-17

    Backport PR: https://github.com/appcelerator/titanium_mobile/pull/13183

JSON Source