Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1744] Allow TabGroup as a child of a NavigationWindow

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusResolved
ResolutionFixed
Resolution Date2021-01-05T10:38:40.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.15.4, CLI Release 9.0.0
Componentsn/a
Labelsn/a
ReporterMichael Gangolf
AssigneeEwan Harris
Created2021-01-04T14:11:09.000+0000
Updated2021-02-09T11:38:12.000+0000

Description

Description

TIMOB-27316 allowed this in the SDK so Alloy needs to allow it too, test code from that ticket below
<Alloy>
	<NavigationWindow>
		<!-- View code for NavWindowTabGroupTest.js -->
		<!-- <TabGroup title="Tabgroup">
			<Tab title="tab">
				<Window>
					<Button title="Open child" top="50%" onClick="openWindow"/>
				</Window>
			</Tab>
			<Tab title="tab">
				<Window>
					<Button title="Open child" top="50%" onClick="openWindow"/>
				</Window>
			</Tab>
		</TabGroup> -->

		<!-- View code for NavWindowChildTabsTest.js -->
		<Window>
			<Button title="Open TabGroup" onClick="openTabGroup"/>
		</Window>
	</NavigationWindow>
</Alloy>
function openWindow() {
	var childWindow = Ti.UI.createWindow({
		title: "Child Window",
		backgroundColor: "white",
	});
	var closeButton = Ti.UI.createButton({
		title: "Close Window",
	});
	closeButton.addEventListener("click", function() {
		$.index.closeWindow(childWindow, { animated: true });
	});
	childWindow.add(closeButton);
	$.index.openWindow(childWindow, { animated: true });
}

function openTabGroup() {
	var tabGroupSettings = {
		title: "TabGroup",
		tabs: [createTab("Tab 1"), createTab("Tab 2"), createTab("Tab 3")],
	};
	var tabGroup = Ti.UI.createTabGroup(tabGroupSettings);
	$.index.openWindow(tabGroup, { animated: true });
}

function createTab(title) {
	var window = Ti.UI.createWindow({ title: title });
	window.add(Ti.UI.createLabel({
		text: title + " View",
		top: "25%",
	}));
	var openButton = Ti.UI.createButton({
		title: "Open Child Window",
		top: "50%",
	});
	openButton.addEventListener("click", function() {
		var childWindow = Ti.UI.createWindow({
			title: title + " Child Window",
			backgroundColor: "white",
		});
		var closeButton = Ti.UI.createButton({
			title: "Close Window",
		});
		closeButton.addEventListener("click", function() {
			$.index.closeWindow(childWindow, { animated: true });
		});
		childWindow.add(closeButton);
		$.index.openWindow(childWindow, { animated: true });
	});
	window.add(openButton);
	var tab = Ti.UI.createTab({
		title: title,
		icon: "/assets/images/tab1.png",
		window: window,
	});
	return tab;
}

$.index.open();

Comments

  1. Ewan Harris 2021-01-04

    PR: https://github.com/appcelerator/alloy/pull/1067
  2. Ewan Harris 2021-01-04

    alloy-devkit PR: https://github.com/appcelerator/alloy-devkit/pull/222

JSON Source