Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-548

Widget views containing valid child elements are not accepted like with require

    Details

      Description

      Having a view like:

      <Alloy>
        <TableView>
          <Widget src="my.alloy.widget" />
        </TableView>
      </Alloy>
      

      and the widget's view being like:

      <Alloy>
        <HeaderPullView>
          <View>
            <ImageView id="arrow" />
            <ActivityIndicator />
            <Label id="status">Pull down to refresh</Label>
          </View>
        </HeaderPullView>
      </Alloy>
      

      You get the following compile error:

      [ERROR] :  [ERROR] Error with <Widget> at line 3
      [ERROR] :  [ERROR] Child element must be on of the following: [Ti.UI.TableView.HeaderView,Ti.UI.TableView.HeaderPullView,Ti.UI.TableView.FooterView,Ti.UI.TableView.Search,Ti.UI.TableViewRow,Ti.UI.TableViewSection,Ti.UI.SearchBar]
      [ERROR] :  Alloy compiler failed
      

      Trying the same thing using a regular require fails even harder:

      [ERROR] :  /usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:80
      [ERROR] :  	var name = node.nodeName,
      [ERROR] :  	               ^
      [ERROR] :  TypeError: Cannot read property 'nodeName' of undefined
      [ERROR] :      at Object.exports.getNodeFullname (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:80:17)
      [ERROR] :      at Object.exports.validateNodeName (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:1083:25)
      [ERROR] :      at parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ProxyProperty.js:23:11)
      [ERROR] :      at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/base.js:11:17)
      [ERROR] :      at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Alloy.Abstract._ProxyProperty.js:13:27)
      [ERROR] :      at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.TableView._ProxyProperty.js:11:52)
      [ERROR] :      at Object.exports.parse (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/parsers/Ti.UI.TableView.HeaderPullView.js:2:53)
      [ERROR] :      at Object.exports.generateNode (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/compilerUtils.js:231:48)
      [ERROR] :      at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:406:28
      [ERROR] :      at Array.forEach (native)
      [ERROR] :      at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)
      [ERROR] :      at parseAlloyComponent (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:398:5)
      [ERROR] :      at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:197:5
      [ERROR] :      at Array.forEach (native)
      [ERROR] :      at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)
      [ERROR] :      at /usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:189:5
      [ERROR] :      at Array.forEach (native)
      [ERROR] :      at Function.T.each.T.forEach (/usr/local/lib/node_modules/alloy/Alloy/lib/alloy/underscore.js:5:625)
      [ERROR] :      at module.exports (/usr/local/lib/node_modules/alloy/Alloy/commands/compile/index.js:187:4)
      [ERROR] :      at Object.<anonymous> (/usr/local/lib/node_modules/alloy/Alloy/alloy.js:87:46)
      [ERROR] :      at Module._compile (module.js:449:26)
      [ERROR] :      at Object.Module._extensions..js (module.js:467:10)
      [ERROR] :      at Module.load (module.js:356:32)
      [ERROR] :      at Function.Module._load (module.js:312:12)
      [ERROR] :      at Module.require (module.js:362:17)
      [ERROR] :      at require (module.js:378:17)
      [ERROR] :      at Object.<anonymous> (/usr/local/lib/node_modules/alloy/bin/alloy:3:1)
      [ERROR] :      at Module._compile (module.js:449:26)
      [ERROR] :      at Object.Module._extensions..js (module.js:467:10)
      [ERROR] :      at Module.load (module.js:356:32)
      [ERROR] :      at Function.Module._load (module.js:312:12)
      [ERROR] :      at Module.runMain (module.js:492:10)
      [ERROR] :      at process.startup.processNextTick.process._tickCallback (node.js:244:9)
      [ERROR] :  Alloy compiler failed
      

      Replace the `headerPullView` by `TableViewRow` and the regular require works again, but the widget still produces the same error.

      I guess both have to do with `validateNodeName()` and `inspectRequireNode()` in Alloy's `compilerUtil.js`. I tried to do some debugging myself but couldn't fix it. I hope you guys can, since I have some interesting use cases for it

        Attachments

          Activity

            People

            • Assignee:
              tlukasavage Tony Lukasavage
              Reporter:
              fokkezb Fokke Zandbergen
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration