For instance, the url to the image.įrom now, you will need to intercept the image and insert it later. Every property you set in tss or xml file regarding the ImageView will be inside the args variable. This basic example basically overrides your createImageView method and makes it possible for you to extend. Your file ( /app/lib/authImage.js) should look something like this: So the basic thing the lib needs to do is have a function called createImageView and that function should return an ImageView. Note: This solution is only possible with Alloy Creating authImage libĪs discussed above, Alloy is looking for a createImageView function inside the authImage lib. I will guide you through the creation of the module, or in this case a commonjs file from the lib folder.
In fact, because I use ImageView here, the exact code this translates to is: require('authImage').createImageView(args).Īs you can see, this gives a great opportunity to add logic to ImageViews. Under the hood it behaves like require('authImage'). What this does is it looks for a commonjs/module/widget inside your app. Within your Views, this is the only change you need to do.Īs you can see, I added module="authImage". There is a property you can use in your Alloy View called module. The answer to this problem is in Alloy Extending. But it will require you to not use the ListView component, as ListViews have no extend support. In fact, you can change it easily with minimal effort and hardly any impact on your code. So what do you, rewrite the entire app to be able to fetch images? Images are no longer public and they need to be fetched using oAuth tokens. While you’re developing the app, and the backend of your app evolves the need arises to secure the system. Just add an ImageView to your View and add the URL and you’re done.
It is really easy to include images in your app. Rene Pot is an Appcelerator Titan, long time member of the Titanium community, and runs the Slack Titanium Channel For more, you can follow him on Medium and Twitter. Note: This post was originally published on Medium.