Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-28399] Android: TableView setData does not preserve TableViewRow child views

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2021-03-29T21:40:33.000+0000
Affected Version/sn/a
Fix Version/sRelease 10.0.0
ComponentsAndroid
Labelsn/a
ReporterJoe Falcone
AssigneeGary Mathews
Created2021-02-17T06:39:25.000+0000
Updated2021-03-29T21:40:33.000+0000

Description

It appears that the rewrite of TableView to use RecyclerView has left a few loose ends. We were shocked to see code that had run for years and years broken. The problem is that the new TableView (and probably ListView) implementations don't handle TableViewRows with child views properly. In particular, say you start by creating TableViewRows which are composed of multiple child views like images and labels and push those TableViewRows into an array. Then you create a TableView and then TableView.setData(TableViewRows). Everything is fine. Then later you use TableView.setData(TableViewRows) to set new information into the rows. When you do that, [theory] the attributes of the child views of the TableViewRows are zeroed [/theory] so it looks as though the child views have disappeared when the TableView is shown after the setData. But the bottom line is that the child views of the TableViewRow disappear after the setData with SDK 9.3 and above, and the child views continue to be displayed after the setData with SDK 9.2.2 and prior. BEFORE:
"children":[],"size":{"height":20,"width":34,"y":0,"x":0},"rect":{"absoluteX":0,"height":20,"width":34,"y":0,"absoluteY":80,"x":0}
AFTER:
"children":[],"size":{"height":0,"width":0,"y":0,"x":0},"rect":{"absoluteX":0,"height":0,"width":0,"y":0,"absoluteY":0,"x":0}
I've attached a test program where it creates a TableView with several composite rows with a colored label and image. Then if you click on any row, the TableView has setData applied with the same TableViewRow data array and (voila) the label and image disappear replaced by the title field - they are still children, but they have zero dimensions. Sounds crazy but it is really happening. I won't speculate as to whether this is a deep copy vs shallow copy bug or some other mischief but this really disrupted our release schedule.

Attachments

FileDateSize
tvtest.zip2021-02-17T06:28:09.000+00008657535
tvtest 2.zip2021-02-17T20:05:21.000+00008657647

Comments

  1. Joe Falcone 2021-02-17

    I've modified the test program to use forEach to print out the contents of the tableData array (and I shortened the array to 2 rows). Initially, the tableData row children have reasonable rendered values and then after either the first or second setData(tableData), they disappear. I'm not sure whether this is just a rendering time artifact or evidence of a problem. The bottom line is that the child objects are no longer rendered after the setData is repeated which is not the behavior we see with SDK 9.2.2 and prior.
  2. Gary Mathews 2021-03-18

    master: https://github.com/appcelerator/titanium_mobile/pull/12620
  3. Christopher Williams 2021-03-23

    merged to master and 10_0_X for 10.0.0 target.
  4. Lokesh Choudhary 2021-03-25

    FR Passed.

JSON Source