Problem description
When opening a modal windows with animation, if a previous modal is still closing, the opening fails and an error is reported:
[ERROR] : Script Error = Attempting to begin a modal transition from <UINavigationController: 0xd140570> to <UINavigationController: 0x14b69080> while a transition is already in progress. Wait for viewDidAppear/viewDidDisappear to know the current transition has completed at app.js (line 25).
Steps to reproduce
Use the following code:
var win = Ti.UI.createWindow({
backgroundColor: 'black',
fullscreen: true
});
win.addEventListener('click', function() {
openWin();
});
win.open();
function openWin() {
var win = Ti.UI.createWindow({
backgroundColor: 'white',
modal: true
});
win.addEventListener('click', function() {
win.close();
openWin();
});
// setTimeout(function() {
win.open({
animated: true
});
// }, 500);
}
1. Run the app: you will see just a black screen
2. Click on the window, and it will open a modal window with animation
3. Click on the new opened window: the error will be shown
Workaround
By decommenting the setTimeout lines, when the modal window has finished closing, a new one is open; however, this is not a good workaround, as the time to wait might vary (500ms works fine on my Simulator, for example, while 200ms fails).
Another note: the same error appears if you try to open the window inside a 'close' event.
Closing ticket as invalid.