Nativescript: Label textWrap - provide CSS property

Created on 19 Nov 2016  路  5Comments  路  Source: NativeScript/NativeScript

It only makes sense to make textWrap a CSS property much like verticalAlignment/horizontalAlignment can be set with vertical-align/horizontal-align.

I would recommend text-wrap.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

css feature

Most helpful comment

@enchev

still not working on tns 2.5.2

.whiteSpace {
  white-space: normal; /* default value */
}
<label text="{{team}}" class="whiteSpace" width="100%" height="auto" horizontalAlignment="left"/>

All 5 comments

By CSS specifications the property is called word-wrap - Perhaps, should follow these in order to make NatieScript more understandable for web-developers!? (although that would raise questions about textWrap and word-wrap name inconsistency)

Actually I think the CSS property that would be closest to this would be white-space: normal (multiline) and white-space: nowrap (single line).

Here is an example: https://jsfiddle.net/0913ar4b/2/

word-wrap defines how individual words should be handled if they are too long to fit on a single line - rather than how a whole block of text is handled.

Obviously white-space bares little resemblance to the current textWrap. Perhaps they could be pseudonyms for the same property so people could use whichever makes sense for them?

Hey folks,

We support already white-space:
https://github.com/NativeScript/NativeScript/blob/master/apps/app/ui-tests-app/css/white-space.xml

@NathanWalker will this work for you?

@enchev

still not working on tns 2.5.2

.whiteSpace {
  white-space: normal; /* default value */
}
<label text="{{team}}" class="whiteSpace" width="100%" height="auto" horizontalAlignment="left"/>

white-space: normal; seems to work for 4.2.1, maybe earlier as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kn9ts picture kn9ts  路  3Comments

vtisnado picture vtisnado  路  3Comments

NickIliev picture NickIliev  路  3Comments

guillaume-roy picture guillaume-roy  路  3Comments

yclau picture yclau  路  3Comments