Appcelerator Alloy Expressions in TSS

64 Views Asked by At

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
}
1

There are 1 best solutions below

0
miga On BEST ANSWER

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/