[TIMOB-23366] Windows: Hardware back button exits app instead of closing window inside tab
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2016-06-02T12:45:06.000+0000 |
Affected Version/s | Release 5.3.0 |
Fix Version/s | n/a |
Components | Windows |
Labels | n/a |
Reporter | Fokke Zandbergen |
Assignee | Kota Iguchi |
Created | 2016-05-12T15:32:44.000+0000 |
Updated | 2019-05-09T06:46:17.000+0000 |
Description
Looking at other Windows apps the expected behaviour when using
Ti.UI.Tab.open()
to open a child Window and then pressing the device back button should close the child Window, revealing the previous Window again.
Example for all of this:
var colors = ['blue', 'gray', 'red'];
function createWindow(depth) {
var win = Ti.UI.createWindow({
layout: 'vertical',
backgroundColor: colors[depth % colors.length]
});
win.add(Ti.UI.createLabel({
text: 'Depth ' + depth
}));
var openBtn = Ti.UI.createButton({
top: 20,
title: 'Open Child'
});
openBtn.addEventListener('click', function () {
tabA.open(createWindow(depth + 1));
});
win.add(openBtn);
if (depth > 0) {
var closeViaWinBtn = Ti.UI.createButton({
top: 20,
title: 'Close via Window'
});
closeViaWinBtn.addEventListener('click', function () {
win.close();
});
win.add(closeViaWinBtn);
var closeViaTabBtn = Ti.UI.createButton({
top: 20,
title: 'Close via Tab'
});
closeViaTabBtn.addEventListener('click', function () {
tabA.close(win);
});
win.add(closeViaTabBtn);
var backViaWinButton = Ti.UI.Windows.createAppBarButton({
icon: Ti.UI.Windows.SystemIcon.BACK
});
backViaWinButton.addEventListener('click', function () {
win.close();
});
var backViaTabButton = Ti.UI.Windows.createAppBarButton({
icon: Ti.UI.Windows.SystemIcon.BACKTOWINDOW
});
backViaTabButton.addEventListener('click', function () {
tabA.close(win);
});
win.add(Ti.UI.Windows.createCommandBar({
items: [backViaWinButton, backViaTabButton]
}));
}
return win;
}
var tabA = Ti.UI.createTab({
title: 'Tab A',
window: createWindow(0)
});
var tabB = Ti.UI.createTab({
title: 'Tab B',
window: Ti.UI.createWindow({
backgroundColor: 'green'
})
});
Ti.UI.createTabGroup({
tabs: [tabA, tabB]
}).open();
I can't reproduce this on my end with the latest 5_3_X on both WP 8.1 and Windows 10 Mobile.
This seems to work with latest 5_3_X but I do get this in the logs:
Oops that happens, it should be kept internal. I'll remove it soon. Nice catch!
I think we can mark this "Can't Reproduce" for now. Feel free to reopen if that's not the case.