Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8030] iOS: Window's "open" event fires twice when animating or properties are set

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-09T02:21:08.000+0000
Affected Version/sRelease 1.8.2
Fix Version/sRelease 2.0.2, Release 2.1.0, Sprint 2012-07, Release 1.8.3
ComponentsiOS
Labelsapi, module_window, qe-testadded
ReporterVarun Joshi
AssigneeVishal Duggal
Created2012-03-15T10:05:09.000+0000
Updated2013-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.

Comments

  1. Vishal Duggal 2012-03-22

    Pull pending #1798
  2. Natalie Huynh 2012-05-10

    Tested with 2.0.2.v20120505151714 with iPhone 4 5.0.1
  3. Neha Chhabra 2012-07-09

    Reopening to update labels.
  4. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4967

JSON Source