[TIMOB-24478] Android: postlayout function is called twice when the app starts
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Resolved |
| Resolution | Fixed |
| Resolution Date | 2017-03-20T22:20:21.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | ILAY SENER |
| Assignee | Gary Mathews |
| Created | 2017-03-12T23:46:10.000+0000 |
| Updated | 2017-03-20T22:20:21.000+0000 |
Description
postlayout calls the linked function twice when the app starts for the first time. when the view/window called/loaded the second time, postlayout function gets called only once.
This is also the same with titanium.
Attachments
| File | Date | Size |
|---|---|---|
| bluewin.js | 2017-03-12T23:44:48.000+0000 | 787 |
| bluewin.xml | 2017-03-12T23:44:56.000+0000 | 255 |
| index.js | 2017-03-14T02:43:36.000+0000 | 156 |
| index.js | 2017-03-12T23:44:46.000+0000 | 989 |
| index.xml | 2017-03-14T02:43:43.000+0000 | 192 |
| index.xml | 2017-03-12T23:44:53.000+0000 | 1646 |
| Screen Shot 2017-03-14 at 13.41.39.png | 2017-03-14T02:43:57.000+0000 | 136349 |
Hey Ilay! This is iOS right? We need to build a single-file example to simplify the testing. Let me know if we can help with that, thx! And in addition to that: On Ti.UI.Window instances, you would rather choose the
openorfocusevent that are specifically made for window lifetime-tracking. Anyway, thepostlayoutevent should still only fire once.HI Hans, Ran the app on Android simulator. Will send the single file tomorrow for testing. Is it any easier if I upload the file to github for future ?
Thanks, changed the title! Just a simple app.js attached to this ticket, inline as JS or linked via Github is fine. Assigning to [~gmathews] for now, thx!
OK. Please find the single js & xml file, along with the console screengrab.
On load is called once, but the postlayout is called twice...
var win = Ti.UI.createWindow({backgroundColor: 'gray'}); win.addEventListener('open', function() { Ti.API.info('open event fired.'); }); win.addEventListener('postlayout', function() { Ti.API.info('postlayout event fired.'); }); win.open();master: https://github.com/appcelerator/titanium_mobile/pull/8887