1

How can I go about writing expression for font size, top, height, width... with TSS in appcelerator alloy project

'.myLabel': {
    backgroundColor: '#fff',
    height: Ti.Platform.displayCaps.platformHeight / 2,
    width: (Ti.Platform.displayCaps.platformWidth + 50) / 2
}
Peter Kriens
  • 15,196
  • 1
  • 37
  • 55

1 Answers1

1

You can't do calculations like this in TSS. You would do that in your controller and assign the value to each element OR use a global variable in alloy.js where you do the calculation and assign that variable. Have a look at this blog post: https://www.tidev.io/2014/10/22/how-to-use-expressions-in-tss/

miga
  • 3,997
  • 13
  • 45