Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28399

Android: TableView setData does not preserve TableViewRow child views

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Release 10.0.0
    • Component/s: Android
    • Labels:
      None
    • Environment:

      SDK 9.3 and above. Tested on Mac Catalina on a Samsung Galaxy G920A

      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

          Activity

            People

            • Assignee:
              gmathews Gary Mathews
              Reporter:
              jfalcone Joe Falcone
              Reviewer:
              Joshua Quick
              Tester:
              Lokesh Choudhary
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration