[TIMOB-4946] iOS: Window titleControl click events get lost
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-02-01T15:59:54.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | Sprint 2012-01, Release 2.0.0, Release 1.8.1 |
Components | iOS |
Labels | module_window, parity, qe-testadded |
Reporter | Matthew Congrove |
Assignee | Vishal Duggal |
Created | 2011-08-09T07:29:42.000+0000 |
Updated | 2012-03-04T22:16:41.000+0000 |
Description
To reproduce, add an event listener to a window titleControl. After two clicks, event stops firing. Reproduction code is attached. As an interesting side note, if you apply an animation to the tabGroup open method the application will crash without error on the 2nd click.
tabGroup = Titanium.UI.createTabGroup();
function createNavBarTitleControl() {
var view = Titanium.UI.createView({
backgroundColor: "#FF0000",
width: 65,
height: 17
});
return view;
}
var win = Titanium.UI.createWindow({
backgroundColor: "#FFF",
barColor: "#111",
url: "test.js",
titleControl: createNavBarTitleControl(),
title: "Recents"
});
var tab = Titanium.UI.createTab({
title: "Recents",
window: win,
hasChild: true
});
tabGroup.addTab(tab);
tabGroup.setActiveTab(0);
tabGroup.open({
transition: Titanium.UI.iPhone.AnimationStyle.FLIP_FROM_LEFT
});
function addEventListenerToTitleControl() {
var win = Titanium.UI.currentWindow;
win.titleControl.addEventListener("click", function(eventObject) {
alert("Click Registered");
});
}
addEventListenerToTitleControl();
As a note, if you add the event listener to the titleControl BEFORE you add it to the window, it works. It only crashes / loses events if you try to add the event listener to window.titleControl after it's been added. This problem is also occurring for other items in the navigation bar, e.g., the rightNavButton.
I've noticed the same thing in 1.7.2. My workaround was to recreate the title control each time it was clicked, which is very ugly but seems to work.
Pull pending 1131
Still can repro with 1.9.0.v20120112104633, after the first 2 click you have to click multiple times to see the alert again
Tested with 1.9.0.v20120112104633, need to make the red box bigger, before porting, make it bigger so the hit space is easier to get to