[TIMOB-8030] iOS: Window's "open" event fires twice when animating or properties are set
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-07-09T02:21:08.000+0000 |
Affected Version/s | Release 1.8.2 |
Fix Version/s | Release 2.0.2, Release 2.1.0, Sprint 2012-07, Release 1.8.3 |
Components | iOS |
Labels | api, module_window, qe-testadded |
Reporter | Varun Joshi |
Assignee | Vishal Duggal |
Created | 2012-03-15T10:05:09.000+0000 |
Updated | 2013-12-10T06:19:32.000+0000 |
Description
When properties or animations are set to the window as follows: (See the comments in the code below)
{noformat}
var appWin = Ti.UI.createWindow({
width: '100%',
height: '100%',
backgroundColor: 'white'
});
var btn = Ti.UI.createButton({
top: 0,
left: 0,
width: 100,
height: 50,
title: 'bug'
});
btn.addEventListener('click', demoBug);
appWin.add(btn);
appWin.open();
function demoBug() {
var win = Ti.UI.createWindow({
top: Ti.Platform.displayCaps.platformHeight,
right: 0,
bottom: -Ti.Platform.displayCaps.platformHeight,
left: 0,
backgroundColor: 'red',
});
var num = 0;
win.addEventListener('open', function() {
Ti.API.error('win:open:' + (++num));
alert('open called');
})
// These 2 lines are the cause of the bug. Remove either one or both, the
// bug doesn't manifest.
win.top = 50;
win.bottom = 50;
// win.duration = 0;
// win.open();
win.open({
top: 50,
bottom: 50
//duration: 0
});
}
{noformat}
*ACTUAL BEHAVIOR*
The open gets fired twice (can be confirmed by the alert statement). If the properties are set just once (either inside the open function or separately), the open event gets fired just once.
*EXPECTED BEHAVIOR*
Open should be fired just once.
Pull pending #1798
Tested with 2.0.2.v20120505151714 with iPhone 4 5.0.1
Reopening to update labels.
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967