Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17656] iOS: Open event for window on first tab of tab group fires when it shouldn't

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.4.0
Fix Version/sn/a
ComponentsiOS
Labelsqe-3.4.0, reprod
ReporterDhirendra Jha
AssigneeUnknown
Created2014-09-09T09:54:43.000+0000
Updated2018-02-28T20:04:03.000+0000

Description

This is not a regression as its happen on SDK 3.3.0.GA build. 1. Run the below code. Actual Result - Active tab on launch is tab 2 but open events are fired first for win 1 & second for win 2 Expected Result - On launch the active tab must be tab2 & only win2 open event must be fired. Additional Info - It works fine on Android. See the issue TIMOB-8222
Titanium.UI.setBackgroundColor('#000');
var tabGroup = Titanium.UI.createTabGroup();
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({
	title : 'Tab 1',
	backgroundColor : '#fff'
});

win1.addEventListener('open', function() {
	alert('win1 open event fired');
});

var tab1 = Titanium.UI.createTab({
	icon : 'KS_nav_views.png',
	title : 'Tab 1',
	window : win1
});

var label1 = Titanium.UI.createLabel({
	color : '#999',
	text : 'I am Window 1',
	font : {
		fontSize : 20,
		fontFamily : 'Helvetica Neue'
	},
	textAlign : 'center',
	width : 'auto'
});

win1.add(label1);

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({
	title : 'Tab 2',
	backgroundColor : '#fff'
});

win2.addEventListener('open', function() {
	alert('win2 open event fired');
});

var tab2 = Titanium.UI.createTab({
	icon : 'KS_nav_ui.png',
	title : 'Tab 2',
	window : win2
});

var label2 = Titanium.UI.createLabel({
	color : '#999',
	text : 'I am Window 2',
	font : {
		fontSize : 20,
		fontFamily : 'Helvetica Neue'
	},
	textAlign : 'center',
	width : 'auto'
});

win2.add(label2);

//
// add tabs
//
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

tabGroup.setActiveTab(1);
alert(tabGroup.getActiveTab());
// open tab group
tabGroup.open(); 

Comments

  1. Lee Morris 2017-06-19

    I am able to reproduce this issue with the following environment; iPhone 7 (10.2) Studio 4.9.0.201705302345 Ti SDK 6.1.1.v20170609091155 Appc NPM 4.2.9 Appc CLI 6.2.1 Ti CLI 5.0.13 Alloy 1.9.11 Arrow 2.0.0 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source