[TIMOB-13236] iOS: Window - Parent window is closed leaving the child window open
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2016-10-18T20:07:21.000+0000 |
Affected Version/s | Release 3.1.0 |
Fix Version/s | n/a |
Components | iOS |
Labels | qe-3.1.0 |
Reporter | Anshu Mittal |
Assignee | Hans Knöchel |
Created | 2013-03-28T08:48:47.000+0000 |
Updated | 2017-03-24T17:59:26.000+0000 |
Description
Parent window is closed leaving the child window open.
This is not regression since the issue occurs in 3.0.2 GA as well.
Steps to reproduce:
1. Create an app using the code below and execute on IOS device.
2. Click on 'Test1' button.
3. Click on 'open win2' 2 times.
4. Click on 'close Windows'.
Actual:
Green window(parent window) is closed while win2(purple window) is still open.
Expected:
All windows should be closed when parent window is closed.
//app.js
var window1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var btn1=Ti.UI.createButton({
top:20,
title:'Test1'
});
window1.add(btn1);
var win=Ti.UI.createWindow({
top: 0,
right: 0,
bottom: 0,
left: 0,
backgroundColor: 'white'
});
var animWin2;
var animWin3;
btn1.addEventListener('click',function(){
animWin2 = true;
animWin3 = true;
OpenWindow();
});
var win2 = null;
var win3 = null;
function OpenWindow() {
win.open();
loadWindow();
Ti.Gesture.addEventListener('orientationchange', function() {
if (win2) {
Ti.API.error('before: height: ' + win2.height);
Ti.API.error('before: size.height: ' + win2.size.height);
var ht = Ti.Platform.displayCaps.platformHeight - 400;
Ti.API.error('ht: ' + ht);
win2.height = ht;
Ti.API.error('after: height: ' + win2.height);
Ti.API.error('after: size.height: ' + win2.size.height);
}
});
}
function loadWindow() {
var header = Ti.UI.createWindow({
top: 0,
right: 0,
left: 0,
height: 200,
backgroundColor: 'green'
});
win.add(header);
var btn1 = Ti.UI.createButton({
top: 0,
left: 0,
width: 100,
height: 50,
title: 'open win2'
});
btn1.addEventListener('click', function() {
var ht = Ti.Platform.displayCaps.platformHeight - 400;
win2 = Ti.UI.createWindow({
left: 0,
top: 200,
width: '100%',
height: ht,
backgroundColor: 'purple',
opacity: animWin2 ? 0 : 1,
url: 'win2.js'
});
if (animWin2) {
win2.open({
opacity: 1,
duration: 1000,
}, function() {
win2.opacity = 1;
});
} else {
win2.open();
}
});
header.add(btn1);
var btn2 = Ti.UI.createButton({
top: 0,
left: 150,
width: 100,
height: 50,
title: 'open win3'
});
btn2.addEventListener('click', function() {
if (animWin3) {
win3.open({
opacity: 1,
duration: 1000,
});
} else {
win3.open();
}
});
header.add(btn2);
var btn3 = Ti.UI.createButton({
top: 100,
left: 0,
width: 150,
height: 50,
title: 'Close Windows'
});
btn3.addEventListener('click', function() {
win.close();
win2.close();
win3.close();
});
header.add(btn3);
win3 = Ti.UI.createWindow({
top: '50%',
left: '50%',
width: 100,
height: 100,
backgroundColor: 'yellow',
opacity: animWin3 ? 0 : 1,
url: 'win3.js',
});
}
window1.open()
//win2.js
var win = Ti.UI.currentWindow;
var lbl = Ti.UI.createLabel({
top: 100,
left: 100,
width: 100,
height: 50,
text: 'Window 2'
});
win.add(lbl);
//win3.js
var win = Ti.UI.currentWindow;
var lbl = Ti.UI.createLabel({
top: 0,
left: 0,
width: 100,
height: 50,
text: 'Window 3'
});
win.add(lbl);
Windows should not be handled through opacity and Window references should be done with the
require
method instead of the deprecatedurl
property. UsemyWindow.close()
to "hide" windows instead, thx!Closing ticket as invalid with reference to the above comments.