Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1527] Cannot use Ti.UI.iOS.TabbedBar in ListView template

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-11-22T02:41:41.000+0000
Affected Version/salloy 1.9.2
Fix Version/sRelease 6.1.0, alloy 1.9.5
Componentsn/a
Labelsn/a
ReporterHans Knöchel
AssigneeFeon Sua Xin Miao
Created2016-10-27T11:25:59.000+0000
Updated2016-12-09T00:11:22.000+0000

Description

When using the following code inside an Alloy view, the Alloy compiler will crash: Code:
<Alloy>
	<Window>
		<ListView>
			<Templates>
				<ItemTemplate name="TabbedItem">
					<Label class="title" bindid="title"/>
					<TabbedBar platform="ios" bindId="tabs">
			                	<Labels>
			               			<Label class="test1">Label 1</Label>
			                		<Label class="test2">Label 2</Label>
			            		</Labels>
			        	</TabbedBar>
				</ItemTemplate>
			</Templates>
			<ListSection>
				<ListItem template="TabbedItem" tabs:index="0" />
			</ListSection>
		</ListView>
	</Window>
</Alloy>
Crash:
[DEBUG] /usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.ItemTemplate.js:71
[DEBUG]         				return childTemplates + '.push(' + state.item.symbol + ');';
[DEBUG]         				                                             ^
[DEBUG] TypeError: Cannot read property 'symbol' of undefined
[DEBUG]     at Object.CU.generateNodeExtended.post (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.ItemTemplate.js:71:51)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:14:17)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ItemArray.js:18:27)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.BarItemTypes.js:19:48)
[DEBUG]     at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:332:48)
[DEBUG]     at Object.exports.generateNodeExtended (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:269:17)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ItemContainer.js:51:15
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ItemContainer.js:31:4)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:11:17)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ItemContainer.js:20:27)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.ButtonBar.js:14:52)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.iOS.TabbedBar.js:2:38)
[DEBUG]     at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:332:48)
[DEBUG]     at Object.exports.generateNodeExtended (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:269:17)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.ItemTemplate.js:64:15
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.ItemTemplate.js:54:5)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:11:17)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract.ItemTemplate.js:10:27)
[DEBUG]     at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:332:48)
[DEBUG]     at Object.exports.generateNodeExtended (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:269:17)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.ListView.js:132:17
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.ListView.js:123:6
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.ListView.js:49:4)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:11:17)
[DEBUG]     at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.ListView.js:30:27)
[DEBUG]     at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:332:48)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:416:29
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:407:5)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:777:28
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at parseAlloyComponent (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:771:5)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:406:6
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:395:6
[DEBUG]     at Array.forEach (native)
[DEBUG]     at Function._.each._.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:79:11)
[DEBUG]     at module.exports (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:391:4)
[DEBUG]     at Object.<anonymous> (/usr/local/lib/node_modules/alloy/Alloy/alloy.js:113:46)
[DEBUG]     at Module._compile (module.js:409:26)
[DEBUG]     at Object.Module._extensions..js (module.js:416:10)
[DEBUG]     at Module.load (module.js:343:32)
[DEBUG]     at Function.Module._load (module.js:300:12)
[DEBUG]     at Module.require (module.js:353:17)
[DEBUG]     at require (internal/module.js:12:17)
[DEBUG]     at Object.<anonymous> (/usr/local/lib/node_modules/alloy/bin/alloy:3:1)
[DEBUG]     at Module._compile (module.js:409:26)
[DEBUG]     at Object.Module._extensions..js (module.js:416:10)
[DEBUG]     at Module.load (module.js:343:32)
[DEBUG]     at Function.Module._load (module.js:300:12)
[DEBUG]     at Function.Module.runMain (module.js:441:10)
[DEBUG]     at startup (node.js:139:18)
[DEBUG]     at node.js:974:3
[ERROR] Alloy compiler failed

Comments

  1. Feon Sua Xin Miao 2016-11-01

    PR: https://github.com/appcelerator/alloy/pull/802
  2. Hans Knöchel 2016-11-21

    [~fmiao] Which fix-version should this fix go into?
  3. Wilson Luu 2016-12-09

    Closing ticket as fixed. Verified that if I use the above Alloy view code, then I do not get the TypeError: Cannot read property 'symbol' of undefined when I use appc run. Also, verified that I get the error when I compile the Alloy view with alloy@1.9.2. Tested on: Appc CLI NPM: 4.2.8 Appc CLI Core: 6.1.0-312 Alloy: 1.9.5 Arrow: 1.10.0-19 SDK: 6.0.0.GA Node: v4.6.2 OS: Mac OS X (10.12.1) Xcode: 8.1 Devices: iphone 7 plus simulator (10.1)

JSON Source