Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19209] iOS: ListView randomly not shown since 4.1.x

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2015-07-25T00:04:36.000+0000
Affected Version/sn/a
Fix Version/sRelease 4.1.1, Release 5.0.0
ComponentsiOS
Labelslistview
ReporterSebastian Klaus
AssigneePedro Enrique
Created2015-07-10T08:55:57.000+0000
Updated2015-09-10T18:17:32.000+0000

Description

Operating System
  Name                        = Mac OS X
  Version                     = 10.10.4
  Architecture                = 64bit
  # CPUs                      = 8
  Memory                      = 17179869184

Node.js
  Node.js Version             = 0.10.38
  npm Version                 = 1.4.28

Titanium CLI
  CLI Version                 = 4.0.1

Titanium SDK
  SDK Version                 = 4.1.0.GA
  SDK Path                    = /Volumes/Data/Users/sebastian/Library/Application Support/Titanium/mobilesdk/osx/4.1.0.GA
  Target Platform             = iphone
since the update to 4.1.0.GA, my listViews are not showing every time I open a window with a listview in iOS. Can't reproduce it. It's absolute randomly. I'm coming from 4.1.0.v20150516202834 where it works as normal. I posted it into the community and [~fokkezb] confirms this bug: https://community.appcelerator.com/topic/2513/4-1-0-ga-now-available/14 I think I can workaround this bug while giving explizit height in the properties. So far in my testing, the problem doesn't appear anymore.
var win = Ti.UI.createWindow();

var itemTemplate = {
    properties: {
        // These are the same as the list data item properties
        // The list data item properties supersedes these if both are defined
        accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_NONE
    },
    childTemplates: [ // Add view subcomponents to the ListItem
        {
            // Display a Label
            type: 'Ti.UI.Label',
            // If there is a rowtitle dictionary in the ListDataItem,
            // that data binds with this view subcomponent
            bindId: 'rowtitle',
            properties: {
                // Set view properties for the Label view subcomponent
                font: {fontSize: '14dp'}
            },
            childTemplates: [
                // View subcomponents can also have subcomponents
            ]
        }
        // ...add more components
    ]
};

// Simplest list data items that can be displayed in a list view
var data = [
    {
        properties: {
            height: 44
        },
        rowtitle: {
            text: 'Row 1'
        }
    },
    {
        properties: {
            height: 44
        },
        rowtitle: {
            text: 'Row 2'
        }
    },
    {
        properties: {
            height: 44
        },
        rowtitle: {
            text: 'Row 3'
        }
    }
];

var data1 = [
    {
        properties: {
            height: Ti.UI.SIZE
        },
        rowtitle: {
            text: 'Row 1'
        }
    },
    {
        properties: {
            height: Ti.UI.SIZE
        },
        rowtitle: {
            text: 'Row 2'
        }
    },
    {
        properties: {
            height: Ti.UI.SIZE
        },
        rowtitle: {
            text: 'Row 3'
        }
    }
];
// works
//var listSection = Titanium.UI.createListSection({items: data});
// works randomly not
var listSection = Titanium.UI.createListSection({items: data1});

// Add the list section to a list view
var listView = Titanium.UI.createListView({
    sections: [listSection]
});

var listView = Titanium.UI.createListView({
    sections: [listSection],
    templates: {
        default: itemTemplate
    },
    defaultItemTemplate: 'default'
});

win.add(listView);

win.open();

Comments

  1. Fokke Zandbergen 2015-07-10

    I can only [find](https://github.com/appcelerator/titanium_mobile/commits/0ff8c6818ca7a1b1cd0da18c11c60bab00ccb423/iphone/Classes) one relevant commit since 20150516 if at that time it was indeed still working like [~benutzername] says: https://github.com/appcelerator/titanium_mobile/commit/304c4d1cf2ba6c4109cf76973846cef6ce29f334
  2. PaRnanZio Gun 2015-07-10

    I'm having problems on a ListView, maybe related to this ticket. On a view I have some elements (labels, ..) and a ListView. If the ListView is there, nothing is visible (blank page), if I comment the ListView everything works fine.
  3. Nuno Costa 2015-07-13

    I confirm the blank ListView special when I run a clean build. Related with Ti.UI.SIZE and Int. normal values
  4. Mike Stancliffe 2015-07-13

    We are also experiencing this. I will add, when run on iOS 7 it seems to happen far less frequently, on iOS 8 it is very common.
  5. Keith 2015-07-13

  6. Shawn Lan 2015-07-15

    Having the same issue. Only after upgraded to 4.1.0. Please fix asap. Thanks.
  7. Velan Vijatovic 2015-07-15

    Same issue here, although it happens for both dynamic and static height items in my case.
  8. Collin Price 2015-07-15

    I am seeing the same results as Velan Vijatovic.
  9. Peter Ladis 2015-07-16

    I am also seeing the same issue on 4.1.0 GA....its doesnt happen on 4.0.0GA
  10. Arjan 2015-07-17

    Same problem, but also with static height (since 4.1.0.GA, 4.0.0.GA works fine). Also, when I remove the listView from his parent container, rebuild/add it again, it doesn't seem to disappear.
  11. Keith 2015-07-17

    I created a sample video of the issue, as this can be ridiculously hard to recreate sometimes: https://www.youtube.com/watch?v=vDyStdRbqO0&feature=youtu.be As it's so random, I found the easiest way to reproduce it is to create two windows, each with a listview, calling eachother on itemclick, so you can keep recreating the listviews over and over until the bug finally happens. Happy to share sample project if needed. I'll note that I use two item templates on each listview - I couldn't get the bug to trigger with only one template, but this could just be down to the seemingly random nature of the bug.
  12. Thibault Lenclos 2015-07-20

    Why is this planned for 4.3.0 instead of 4.1.1 ?
  13. Shawn Lan 2015-07-20

    Please understand the ListView is just randomly not showing on iOS, without conditions (not because of dynamic item height, etc.). So this is urgent. I can't release any update with 4.1.0 because of this bug. Is 4.3.0 going to be released soon?
  14. Mauro Piccotti 2015-07-23

    I have the same problem. In my app every ListView works the most of the times and sometimes it remains blank. In some I append blocks of data scrolling down (setMarker or addMarker doesn't make any difference), in some I add all data in at the beginning. Sometimes it remains blank at the first loading, sometimes I can refresh the view 20 times and it always works (but continuing soon or later it remains blank). The easiest block of code I can show you is this one: var section = $.list.sections[0]; section.deleteItemsAt(0, section.items.length); queryResult = expirationRepository.list(); section.appendItems(queryResult.map(modelToViewItemFunction));
  15. Alan Leard 2015-07-24

    If you inspect the ListView object when it doesn't appear, it is missing the dictTemplates property. Here is an example when the listview DOES show up:
        { "backgroundColor" : "white",
          "canScroll" : true,
          "caseInsensitiveSearch" : true,
          "defaultItemTemplate" : "jobDetailTemplate",
          "dictTemplates" : { "jobDetailTemplate" : {  },
              "jobHeaderTemplate" : {  }
            },
          "height" : "FILL",
          "horizontalWrap" : true,
          "id" : "listView",
          "refreshControl" : { "id" : "refresh",
              "tintColor" : "#393939"
            },
          "separatorColor" : "transparent",
          "visible" : true
        }
        
    And here is the same exact listview (No code changes) when it does not appear:
        { "backgroundColor" : "white",
          "canScroll" : true,
          "caseInsensitiveSearch" : true,
          "defaultItemTemplate" : "jobDetailTemplate",
          "height" : "FILL",
          "horizontalWrap" : true,
          "id" : "listView",
          "refreshControl" : { "id" : "refresh",
              "tintColor" : "#393939"
            },
          "separatorColor" : "transparent",
          "visible" : true
        }
        
  16. Pedro Enrique 2015-07-24

    PR: https://github.com/appcelerator/titanium_mobile/pull/6983
  17. Pedro Enrique 2015-07-24

    PR for 4.1.X https://github.com/appcelerator/titanium_mobile/pull/6984
  18. Chee Kiat Ng 2015-07-25

    CR and FT Passed. PRs merged!
  19. Eric Merriman 2015-08-04

    Unable to reproduce the fail case with attached sample code. I was able to reproduce with the sample code in TIMOB-19249 on 3 of 20 attempts. With SDK 4.1.1.v20150802200935 I was unable to reproduce with 40 attempts. Closing as fixed.
  20. Keith 2015-08-05

    https://github.com/appcelerator/titanium_mobile/pull/6984 seems to have done the job. Thanks to the devs for the quick fix.
  21. A Barresi 2015-08-05

  22. Gertjan Smits 2015-09-08

    Is there a workaround for 4.1.0? Maybe a dirty hack to force the listview to draw or something? I need to go live soon... and because 4.1.1 is not released yet, this doesn't help me now :)
  23. Thibault Lenclos 2015-09-08

    In the meantime you can try to use 4.1.1 continuous builds if it doesn't break your app [http://builds.appcelerator.com.s3.amazonaws.com/index.html#4_1_X].
  24. Gertjan Smits 2015-09-08

    Yeah I'm kind of reluctant to use a non GA SDK for a production build.
  25. Fokke Zandbergen 2015-09-08

    [~gertjans] just patch the 4.0 SDK you use with: https://github.com/appcelerator/titanium_mobile/pull/6984/files
  26. Gertjan Smits 2015-09-08

    That I can do. Works, thank you sir!

JSON Source