[TIMOB-7820] iOS: Events - Focus event is fired multiple times during initial launch of app
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | High | 
| Status | Closed | 
| Resolution | Fixed | 
| Resolution Date | 2012-07-05T03:48:21.000+0000 | 
| Affected Version/s | Release 1.8.1, Release 1.8.2 | 
| Fix Version/s | Release 2.0.0, Sprint 2012-06 | 
| Components | iOS | 
| Labels | module_tabgroup, parity, qe-ios021312, qe-testadded | 
| Reporter | Wilson Luu | 
| Assignee | Stephen Tramer | 
| Created | 2012-02-27T10:37:23.000+0000 | 
| Updated | 2012-07-05T03:48:21.000+0000 | 
Description
	Steps to reproduce:
1. Run following code:
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
	name: "win 1"
});
var tab1 = Ti.UI.createTab({
	name: "Tab 1",
	title:'Tab 1',
	window:win1
});
var win2 = Ti.UI.createWindow({
	name: "win 2",
	title:'Tab 2',
	backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
	name: "Tab 2",
	title:'Tab 2',
	window:win2
});
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.addEventListener('focus', function(e){
	Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);
});
tab1.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab1 focus event fired! - ' + e.source.name);
});
tab2.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab2 focus event fired! - ' + e.source.name);
});
win1.addEventListener('focus', function(e){
	Ti.API.info('-------------> win1 focus event fired! - ' + e.source.name);
});
win2.addEventListener('focus', function(e){
	Ti.API.info('-------------> win2 focus event fired! - ' + e.source.name);
});
tab1.addEventListener('blur', function(e){
	Ti.API.info('**************> tab1 blur event fired! - ' + e.source.name);
});
tab2.addEventListener('blur', function(e){
	Ti.API.info('**************> tab2 blur event fired! - ' + e.source.name);
});
win1.addEventListener('blur', function(e){
	Ti.API.info('**************> win1 blur event fired! - ' + e.source.name);
});
win2.addEventListener('blur', function(e){
	Ti.API.info('**************> win2 blur event fired! - ' + e.source.name);
});
tabGroup.open();
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> win1 focus event fired! - win 1
I/TiAPI   ( 1770): -------------> tab1 focus event fired! - Tab 1
I/TiAPI   ( 1770): -------------> tabGroup focus event fired! - Tab 1
I/TiAPI   ( 1770): -------------> win1 focus event fired! - win 1
Please note that the following is not a bug on iOS (as far as the ticket is concerned):
This is because the source checks fore.source.name, and the source of the tabgroup "focus" event is the tabgroup itself (not the tab). This is a separate parity issue to resolve.Closing bug. Verified fix on: SDK build: 2.0.0.v20120316093247 Titanium Studio, build: 2.0.0.201203152033 Device: iPhone4s (V5.0.1)
Reopening to update labels.