Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15078] iOS7: Modal Window is not closing correctly

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2013-09-12T19:53:35.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 19, 2013 Sprint 19 API, Release 3.1.3, Release 3.2.0
ComponentsiOS
Labelsios7, module_window, qe-testadded, triage
ReporterRafael Kellermann Streit
AssigneeVishal Duggal
Created2013-09-07T13:13:10.000+0000
Updated2014-04-22T09:54:50.000+0000

Description

When I try to close a modal Window, it have no animation and put a **WARN** in console: **The top View controller is not a container controller. This window will open behind the presented controller.** Example code:
var win1 = Ti.UI.createWindow({
	backgroundColor: "#FF00FF",
	title: "Window 1"
});

var navWindow = Ti.UI.iOS.createNavigationWindow({
	window: win1
});

navWindow.open();

win1.addEventListener("focus", function() {
	alert("win1 focused");
});

win1.addEventListener("click", function() {
	var buttonClose = Ti.UI.createButton({
		title: "Close"
	});

	var win2 = Ti.UI.createWindow({
		leftNavButton: buttonClose,
		backgroundColor: "#FFFF00",
		title: "Window 2"
	});
	
	var navWindow2 = Ti.UI.iOS.createNavigationWindow({
		modal: true,
		window: win2
	});

	navWindow2.open();
	
	buttonClose.addEventListener("click", function() {
		navWindow2.close();
	});
});

Comments

  1. Sabil Rahim 2013-09-10

    master https://github.com/appcelerator/titanium_mobile/pull/4663 3_1_X https://github.com/appcelerator/titanium_mobile/pull/4664
  2. Matt Langston 2013-09-10

    FR passed for 3_1_X and PR merged. FR passed for master and PR merged.
  3. Priya Agarwal 2013-09-10

    Verified the Fix with: Appc Studio: 3.1.3.201309072408 Sdk:3.1.3.v20130909192251 CLI version : 3.1.2 Alloy : 1.2.2-beta MAC OSX: 10.8.4 XCode : 5beta6 Device: Ipad3(v7) Modal window now closes without warning.
  4. Rafael Kellermann Streit 2013-09-10

    Thanks! Could someone explain why modal window is not closing with animation? I don't get it.
  5. kosso 2013-09-11

    Rafael: You need to specify {animated:true} in the your close() method.
       navWindow2.close({animated:true});
       
  6. Rafael Kellermann Streit 2013-09-11

    Kosso: It doesn't work for me. It works to you?
  7. kosso 2013-09-11

    Hi Rafael: Sorry. You're absolutely right. Now that I've tried to actually implement the new NavigationWindow for a modal window, I cannot get it to close with an animation, despite the setting.
  8. Eric Merriman 2013-09-12

    Will verify and report back.
  9. Vishal Duggal 2013-09-12

    master - https://github.com/appcelerator/titanium_mobile/pull/4677 3_1_X - https://github.com/appcelerator/titanium_mobile/pull/4678
  10. Vishal Duggal 2013-09-12

    [~rafaelks],[~kosso] The problem is that the view of the navigationController was being prematurely detached (windowWillClose) and hence the close() functionality appeared to be non animated. The animated parameter is true by default for closing modal windows so you need not specify it. Have moved the detaching of views to windowDidClose method, which is called after the modal window is dismissed. Should be fixed after the above two PR's are merged. Thanks for catching that.
  11. Rafael Kellermann Streit 2013-09-12

    Thank you for your fast feedback Vishal! :-) Waiting for new Titanium SDK build to test it.
  12. Federico Casali 2013-09-13

    Cannot reproduce the WARN message using the provided test sample and setting also all windows to modal. Verified as fixed. TiSDK 3.1.3.v20130912171547 Xcode 5 on iPad Mini 7 and iPhone iOS 7 simulator Closing.
  13. Jonatan Lundin 2013-10-11

    As far as I can tell this issue still exists in 3.1.3 with NavigationWindows as mentioned by @kosso.
  14. Ingo Muschenetz 2013-10-11

    [~mrlundis] is this with the same sample code as shown above?
  15. Jonatan Lundin 2013-10-11

    The example code above appears to work, but I'm experiencing the same issue with code generated through Alloy. At first glance the code appears to be comparable, but I have some more things going on though, like an opened keyboard, etc. I'll try to figure out what's causing this and try to extract another sample illustrating the issue.
  16. Ingo Muschenetz 2013-10-11

    If you can file the Alloy sample, that might be enough for us to go on.
  17. Jonatan Lundin 2013-11-01

    I've done some more testing now, and it appears like the animation runs after all. The duration seemed to be extremely short however. Most likely because of to many other things happening on the main thread at the same time, delaying the start of the animation, causing it to appear almost instantaneous. I fixed the issue by waiting for the rendering of the view below to complete before closing the modal window.

JSON Source