Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27496] Android: Setting ListView row item property not in template will be wrongly duplicated on offscreen rows

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2019-11-12T10:58:02.000+0000
Affected Version/sRelease 8.2.1, Release 8.2.0, Release 8.1.1
Fix Version/sRelease 8.3.0
ComponentsAndroid
LabelsEscalation, ListView, android, engSchedule, regression
ReporterNazmus Salahin
AssigneeGary Mathews
Created2019-10-24T02:14:09.000+0000
Updated2019-11-12T10:58:02.000+0000

Description

The customer discovered a bug with ListView on Android. The issue happens when having a very long list. They use one template for all items and show/hide certain parts of it depending on their business logic. They've noticed that when scrolling below the fold and scroll back up items are being re-rendered using styles from the LAST item in the list. Instead of showing/hiding items, they colored them red. Notice that when rendered it looks correct. When scrolling down and encounter accounts colored with red background and scroll up - previously non-colored accounts also get the red background. The customer tested on Samsung S6, S7, S8, S9, S10 with SDK 8.2.0 GA. Note: We tested the issue on 8.2.0.GA, Sumsang Galaxy A7(Android 9) and the issue is reproducible on our end. *Test steps:* 1. Download the attached project. 2. Open appcelerator studio and import the project. 2. Run the project on a device. *Test code:* https://drive.google.com/file/d/14BetKOnAO_JN7Kr33sJti65Jcmdrkga3/view?usp=sharing *Test result:* https://drive.google.com/file/d/10PFwqwx-CYTnJzfft6PmFpZG_UF1TDGp/view?usp=sharing Note: On iOS it works as expected.

Attachments

FileDateSize
20191106_133543.mp42019-11-06T21:41:22.000+00005234941

Comments

  1. Gary Mathews 2019-10-29

    Here's a simplified test case:
       const win = Ti.UI.createWindow({ backgroundColor: 'gray' });
       const listView = Ti.UI.createListView({
           templates: {
               template: {
                   type: 'Ti.UI.View',
                   childTemplates: [
                       {
                           type: 'Ti.UI.View',
                           bindId: 'view',
                           properties: {
                               height: 30,
                               backgroundColor: 'white'
                           },
                           childTemplates: [
                               {
                                   type: 'Ti.UI.Label',
                                   bindId: 'label',
                                   properties: {
                                       color: 'black'
                                   }
                               }
                           ]
                       }
                   ]
               }
           },
           defaultItemTemplate: 'template'
       });
       
       const items = [];
       for (let i = 0; i < 18; i++) {
           items.push({
               template: 'template',
               label: {
                   text: Item #${i}
               }
           });
       }
       items.push({
           template: 'template',
           label: {
               text: Item #19
           },
           view: {
               backgroundColor: 'red'
           }
       });
       listView.sections = [ Ti.UI.createListSection({ items }) ];
       
       win.add(listView);
       win.open();
       
  2. Gary Mathews 2019-10-29

    master: https://github.com/appcelerator/titanium_mobile/pull/11302
  3. Christopher Williams 2019-11-06

    merged to master
  4. Lokesh Choudhary 2019-11-06

    [~gmathews], When I tap on the red row & then scroll up & down I am able to reproduce the issue. Seems its fixed for the original case & this can be a side effect. [^20191106_133543.mp4]
  5. Gary Mathews 2019-11-07

    master: https://github.com/appcelerator/titanium_mobile/pull/11319
  6. Gary Mathews 2019-11-11

    8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11323
  7. Lokesh Choudhary 2019-11-11

    FR Passed. Waiting for Jenkins to merge.
  8. Christopher Williams 2019-11-11

    merged to master and 8_3_X
  9. Samir Mohammed 2019-11-12

    Closing ticket, fix verified in SDK version 8.3.0.v20191111195828 and SDK version 9.0.0.v20191111145151 Test and other information can be found at: master: https://github.com/appcelerator/titanium_mobile/pull/11319 8_3_X: https://github.com/appcelerator/titanium_mobile/pull/11323

JSON Source