Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11117] iOS: TabGroup - TabGroup has undefined value

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2016-11-02T12:30:46.000+0000
Affected Version/sRelease 2.1.3, Release 3.1.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-ios090112
ReporterTamila Smolich
AssigneeHans Knöchel
Created2012-09-25T19:22:36.000+0000
Updated2017-03-24T17:59:56.000+0000

Description

Description: TabGroup has undefined value. Console info:
[INFO] -------------> tab1 focus event fired! - Tab 1
[INFO] -------------> tabGroup focus event fired! - undefined
[INFO] -------------> win1 focus event fired! - win 1
[INFO] **************> win1 blur event fired! - win 1
[INFO] **************> tab1 blur event fired! - Tab 1
[INFO] -------------> tabGroup focus event fired! - undefined
[INFO] -------------> tab2 focus event fired! - Tab 2
[INFO] -------------> win2 focus event fired! - win 2
[INFO] **************> win2 blur event fired! - win 2
[INFO] **************> tab2 blur event fired! - Tab 2
This is not a regression, occurs on 2.1.2 and 2.1.1 as well. Steps to reproduce: 1. Run the following code and check the console:
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();
2. Interchangeably press the two tabs Expected result: All values should be defined Actual result: TabGroup has undefined value

Comments

  1. Shameer Jan 2013-03-26

    Issue reproduces Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 iOS iPhone Simulator: iOS SDK version: 6.0
  2. Priya Agarwal 2013-11-20

    Hi, Got through the bug as I was executing TabGroup related test Cases. I think according to the code the tab group behavior(giving value as undefined) is correct. Since there is no custom property named "name" is assigned for tab group. Hence the value retrieved for it gives undefined. And on modifying the code:
       var tabGroup = Ti.UI.createTabGroup({name:'test'});
       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.activeTab.name);gives the current tab name
       	Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);// gives the name of tab group.
       });
       
       tabGroup.open();
       
       
    Above code works fine as per expectations. Please let me know if anything wrong else bug can be updated. Tested Environment: Appcelerator Studio: 3.2.0.201311200357 SDK:3.2.0.v20131119142443 alloy: 1.3.0 acs: 1.0.7 npm: 1.3.2 titanium: 3.2.0-alpha titanium-code-processor: 1.1.0-alpha Xcode:5.0.2 OS: Mac OSX 10.9 Device: iphone5S(V7.0.2)
  3. Hans Knöchel 2016-11-02

    As [~pagarwal] noted correctly, the "name" property was not set and therefore undefined in the log. Using the following (simplified) test-case, it works as expected:
       var tabGroup = Ti.UI.createTabGroup({
           name: "tabgroup"
       });
        
       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);
       });
       
        
       tabGroup.open();
       
  4. Lee Morris 2017-03-24

    Closing ticket as invalid with reference to the above comments.

JSON Source