Skip to content

Instantly share code, notes, and snippets.

@falkolab
Last active Nov 12, 2015
Embed
What would you like to do?
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