How can I get the length of the text in a label?

If I have an label which is for example defined as following:

Label: { text: { textAlign: 'right', fontSize: 38, lineHeight: 44, fontFace: 'RegRoboto' } },

How can I get the length of this label to perform some alignment calculations?

Thank you

Hello!

For the alignment of text or any content that you don’t know the length (width) I suggest you look at the flex properties. Here’s the documentation on the subject Flexbox · Lightning :smiley:

1 Like