Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17923] iOS: Complex non-composite layouts show before lay-out since 3.3.0

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-11-24T23:57:13.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.5.0, Release 4.0.0
ComponentsiOS
Labelshorizontal, layout, regression, vertical
ReporterFokke Zandbergen
AssigneeVishal Duggal
Created2014-10-27T14:00:13.000+0000
Updated2014-12-01T22:05:32.000+0000

Description

A few weeks ago I started noticing that a lot of apps where I used complex horizontal and vertical layouts were showing their children before they were layed out. I made a simple test case that showed this has been the case since 3.3.0 and is not related to iOS 8 which I first assumed. *NOTE:* In some occasions I've (as well as Jason) have seen the children not being layed out at all!

Test case

Run the following test case again Titanium 3.3.0.GA or later:
var win = Ti.UI.createWindow({
  backgroundColor: 'white'
});

win.add(Ti.UI.createLabel({
  text: 'Click'
}));

win.addEventListener('click', function(e) {

  var win = Ti.UI.createWindow({
    backgroundColor: 'red',
    layout: 'vertical',
  });

  win.addEventListener('click', function(e) {
    win.close();
  });

  for (var i = 0; i < 500; i++) {
    win.add(Ti.UI.createLabel({
      top: (i === 0) ? 20 : 0,
      color: 'white',
      text: 'Line #' + (i + 1)
    }));
  }

  win.open();

});

win.open();

Attached videos

The movies I recorded show clearly that the children show center-top (except the first label which has top:20 before being layed out at their proper place. Before Titanium 3.3.x the children views didn't show up until they were layed out, which of course looks better. - 323-710.mov Titanium 3.2.3 & iOS 7.1 (vertical) (/) - 330-710.mov Titanium 3.3.0 & iOS 7.1 (vertical) (x) - 330-710-horizontal.mov Titanium 3.3.0 & iOS 7.1 (horizontal) (x) - 340-810.mov Titanium 3.4.0 & iOS 8.1 (vertical) (x)

Attachments

FileDateSize
323-710.mov2014-10-27T14:00:13.000+0000249271
330-710.mov2014-10-27T14:00:13.000+0000393144
330-710-horizontal.mov2014-10-27T14:00:13.000+0000507790
340-810.mov2014-10-27T14:00:13.000+0000574757

Comments

  1. Ivan Skugor 2014-10-28

    Workaround is to set window's content visible property to false prior to window opening and then in window "open" event listener set it back to true. It looks ok, but it's not perfect solution since there's delay in showing content, but at least content doesn't look awful while window is opening.
  2. Vishal Duggal 2014-11-24

    Pull pending master - https://github.com/appcelerator/titanium_mobile/pull/6387 3_5_X - https://github.com/appcelerator/titanium_mobile/pull/6388
  3. Ewan Harris 2014-12-01

    Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.5.0.v20141125154115, 3.6.0.v20141201111717 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Xcode 6.2 beta iPhone 6 Plus (8.1.1), iPad Retina 2 (8.1.1), iPhone Simulator (8.2) Using the attached code ran on the above devices, behavior now matches the expected and the children are not shown before they are laid out. Closing ticket.

JSON Source