malkoty
malkoty

Reputation: 99

Can not close root window of the navWindow. Close this window instead when trying to close modal

I get the following error even after having closed the modal.

Can not close root window of the navWindow. Close this window instead when trying to close modal

Below is my code

var mainWindow = Ti.UI.createWindow({
  title : 'My Title',
    barColor : topBarColor,
    backgroundColor : 'white'
  });

var modalWindow = Ti.UI.createWindow({
  modal : true,
  barColor : topBarColor,
  backgroundColor : 'pink'
});

var navWin = Ti.UI.iOS.createNavigationWindow({
  modal: true,
  window: modalWindow
});

navWin.open();

This is how I close the windows

mainWindow.close();
modalWindow.close();

Upvotes: 1

Views: 479

Answers (1)

Byters
Byters

Reputation: 56

You have to pass the navigationWindow to the modal:

var navWin = Ti.UI.iOS.createNavigationWindow({
        modal: true,
        window: modalWindow
});

modalWindow.navWin = navWin;
navWin.open();

And then close it like this:

modalWindow.navWin.close();

Upvotes: 2

Related Questions