Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11256] iOS: Opening a window just after a modal window is closed fails

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2012-10-24T22:52:18.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam, regression
ReporterDavide Cassenti
AssigneeArthur Evans
Created2012-10-04T10:48:56.000+0000
Updated2017-03-22T21:35:12.000+0000

Description

Problem description

Opening a window just after a modal is closed will not work.

Steps to reproduce

Use the following code to see the issue:
(function() {
    var mainWindow = Ti.UI.createWindow({
        backgroundColor: '#fff',
    });

    mainWindow.button = Ti.UI.createButton({
        title: 'Open Modal Window'
    });

    mainWindow.add(mainWindow.button);

    var modalWindow = Ti.UI.createWindow({
                modal: true,
                backgroundColor: '#ccc'
            });

    modalWindow.button = Ti.UI.createButton({
        title: 'Close'
    });

    modalWindow.add(modalWindow.button);

    mainWindow.button.addEventListener('click', function(){
        modalWindow.open({modalStyle:Ti.UI.iPhone.MODAL_PRESENTATION_FORMSHEET});
    });

    modalWindow.button.addEventListener('click', function(){
        modalWindow.close();

        var newWindow = Ti.UI.createWindow({
            backgroundColor: 'green'
        });

        /* If I delay opening the window I get the behaviour I had prior to this release.
        setTimeout(function(){
            newWindow.open()
        }, 300);*/

        newWindow.open();
    });

    mainWindow.open();

})();

Note

The same code works with SDK 2.1.2; also, commenting newWindow.open() and uncommenting the timeout, works too. It also works removing modal = true

Comments

  1. Ingo Muschenetz 2012-10-08

    This took advantage of a bug in 2.1.2 which was fixed in 2.1.3. We need to document how to do this correctly as a release note.
  2. Vishal Duggal 2012-10-24

    Open the new window in the modal window close handler
       modalWindow.addEventListener('close',function(){
           var newWindow = Ti.UI.createWindow({
               backgroundColor: 'green'
           });
           newWindow.open();
        });
       
  3. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source