Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4954] 'postlayout' event not fired when property "run-on-main-thread" is set to true

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionDuplicate
Resolution Date2017-05-10T12:20:20.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAlloy, Hyperloop, Titanium SDK & CLI
Labelsios
ReporterFabian Martinez
AssigneeShak Hossain
Created2017-05-09T20:14:45.000+0000
Updated2017-05-10T12:20:20.000+0000

Description

If I set
<property name="run-on-main-thread" type="bool">true</property>
in tiapp.xml then the 'postlayout' event of any view is not fired. An alloy test case may be index.js:
$.win.addEventListener('open', function(e){
    console.log(e);
});
$.viewContent.addEventListener('postlayout', function(e){
    console.log('viewContent');
    console.log(e);
});
$.label.addEventListener('postlayout', function(e){
    console.log('label');
    console.log(e);
});
$.win.addEventListener('postlayout', function(e){
    console.log(e);
});
$.win.open();
index.xml:
<Alloy>
    <Window id="win" backgroundColor="#FFF">
        <View id="viewContent">
            <Label id="label">Hello, World</Label>
        </View>
    </Window>
</Alloy>
Expected result when preperty set to TRUE: view all the events log in the console. What's happening: only the "open" event is fired. If I set the property to FALSE, then all the events are logged. This happens with 6.0.4.GA and 6.0.2.GA. I have tested this with sdk 6.1.0.v20170508081747 and works as expected (all events are fired).

Comments

  1. Fabian Martinez 2017-05-09

    The same happens with classic app (non Alloy), Hyperloop enabled, 6.0.4.GA, iOS (iphone7 10.3 emulator). If I create a new project and app.js is:
       var win = Ti.UI.createWindow({title: 'title', backgroundColor: '#fff' });
       var label = Ti.UI.createLabel({ text: 'message', color: "#333"});
       win.add(label);
       win.addEventListener('open', function(e){
          console.log(e);
       });
       win.addEventListener('postlayout', function(e){
          console.log(e);
       });
       win.open();
       
    then the console log is:
       [INFO] :   TestProject2/1.0 (6.0.4.74f7d21)
       [TRACE] :  [HYPERLOOP] willStartNewContext <KrollContext: 0x608000269900>
       [INFO] :   {
       [INFO] :       bubbles = 0;
       [INFO] :       cancelBubble = 0;
       [INFO] :       source = "[object TiUIWindow]";
       [INFO] :       type = open;
       [INFO] :   }
       [TRACE] :  [HYPERLOOP] didStartNewContext <KrollContext: 0x608000269900>
       [TRACE] :  Uploaded tiapp metadata with Appcelerator Platform!
       
    if I switch to 6.1.0.v20170508081747 and recompile, the console log is:
       [INFO] :   TestProject2/1.0 (6.1.0.77cc59d)
       [TRACE] :  [HYPERLOOP] willStartNewContext <KrollContext: 0x608000073040>
       [INFO] :   {
       [INFO] :       bubbles = 0;
       [INFO] :       cancelBubble = 0;
       [INFO] :       source = "[object TiUIWindow]";
       [INFO] :       type = open;
       [INFO] :   }
       [DEBUG] :  Application booted in 191.500962 ms
       [TRACE] :  [HYPERLOOP] didStartNewContext <KrollContext: 0x608000073040>
       [INFO] :   {
       [INFO] :       bubbles = 0;
       [INFO] :       cancelBubble = 0;
       [INFO] :       source = "[object TiUIWindow]";
       [INFO] :       type = postlayout;
       [INFO] :   }
       [TRACE] :  updating tiapp metadata with Appcelerator Platform...
       [TRACE] :  Uploaded tiapp metadata with Appcelerator Platform!
       
  2. Hans Knöchel 2017-05-10

    Hey there, I remember we fixed this for 6.1.0, but 6.0.x was already out of the house. Release 6.1.0 is expected to be released around end of this month, you can already use the latest build from [here](http://builds.appcelerator.com/#6_1_X), I hope that helps!
  3. Fabian Martinez 2017-05-10

    Thank you for your response. Is there a release notes draft available to check what the build fixes?
  4. Hans Knöchel 2017-05-10

JSON Source