Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4416] iOS: Closing a Nav Group Interprets Window's JS Again

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2011-10-27T14:52:26.000+0000
Affected Version/sRelease 1.7.0
Fix Version/sSprint 2011-28, Release 1.8.0
ComponentsiOS
Labelsn/a
ReporterDawson Toth
AssigneeBlain Hamon
Created2011-06-15T09:19:03.000+0000
Updated2011-10-27T14:52:33.000+0000

Description

Problem

Closing a nav group causes the open window's JavaScript to be interpreted and run again, as if it were being opened for the first time.

Reproduction

Drop the following in an app.js win1.js and win2.js, respectively. - When you run it, "win1" (a nav group) will be opened - You'll see an alert ("Win 1 Opened!"). - After 1 second, win1 will be closed and win2 will be opened. - You'll see an alert ("Win 2 Opened!") followed by another ("Win 1 Opened!").
var win1 = Ti.UI.createWindow();
win1.add(Titanium.UI.iPhone.createNavigationGroup({
    window: Titanium.UI.createWindow({
        navBarHidden: true,
        backgroundColor: '#f00',
        url: 'win1.js'
    })
}));

var win2 = Titanium.UI.createWindow({
    backgroundColor: '#0f0',
    url: 'win2.js'
});

win1.open();

setTimeout(function() {
    win2.open({transition:Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT});
    win1.close();
}, 1000);
alert('Win 1 Opened!');
alert('Win 2 Opened!');

Workaround

This isn't really a workaround, but if you do not close the nav group, this bug won't show up. Hide it instead (call win1.hide() instead of win1.close() and the bug will go away).

Associated Helpdesk Ticket

http://appc.me/c/APP-422396

Comments

  1. Alan Vaghti 2011-08-29

    Passed as expected on: iPad 3rd Gen 4.0.2 iPad 2 4.3.2 iPhone 4 4.2.10 SDK: version=1.8.0 timestamp=08/26/11 14:53 githash=8e978eb...

JSON Source