Skip to content

Instantly share code, notes, and snippets.

@falkolab
Last active November 12, 2015 09:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save falkolab/efa28be3c7f56e6d1f1f to your computer and use it in GitHub Desktop.
Save falkolab/efa28be3c7f56e6d1f1f to your computer and use it in GitHub Desktop.
require('uiModules')
<Alloy>
<ListView title="Demo: SVG + ListView" defaultItemTemplate="customTemplate">
<Templates>
<ItemTemplate name="customTemplate">
<SvgView platform="android" bindId="svgImage" ns="Alloy.Globals.uiModules" />
<View platform="ios" bindId="svgImage" ns="Com.Geraudbourdin.Svgview"/>
</ItemTemplate>
</Templates>
<ListSection>
<ListItem svgImage:image="/images/foo1.svg"/>
<ListItem svgImage:image="/images/foo2.svg"/>
<ListItem svgImage:image="/images/foo3.svg"/>
</ListSection>
</ListView>
</Alloy>
// app/lib/uiModules.js
var o = {
createSvgView: function(opts) {
var m = require("com.geraudbourdin.svgview");
return m.createView(opts);
}
};
// place other modules here to use with ns or module attributes in alloy
//_.extend(o, require(""));
module.exports = o;
Alloy.Globals.uiModules = o;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment