Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4946] iOS: Window titleControl click events get lost

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-02-01T15:59:54.000+0000
Affected Version/sRelease 1.7.2
Fix Version/sSprint 2012-01, Release 2.0.0, Release 1.8.1
ComponentsiOS
Labelsmodule_window, parity, qe-testadded
ReporterMatthew Congrove
AssigneeVishal Duggal
Created2011-08-09T07:29:42.000+0000
Updated2012-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();

Comments

  1. Matthew Congrove 2011-08-09

    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.
  2. Paul Mietz Egli 2011-09-29

    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.
  3. Vishal Duggal 2012-01-05

    Pull pending 1131
  4. Natalie Huynh 2012-01-12

    Still can repro with 1.9.0.v20120112104633, after the first 2 click you have to click multiple times to see the alert again
  5. Natalie Huynh 2012-01-12

    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

JSON Source