A NativeScript Label widget. It is a direct replacement for the {N} Label widget.
Installation
Run the following command from the root of your project:
tns plugin add nativescript-htmllabel
This command automatically installs the necessary files, as well as stores nativescript-htmllabel as a dependency in your project's package.json file.
Configuration
It works exactly the same way as the {N} plugin. However it adds a few improvements
iOS Performances
On iOS generating html string can be slow using the system way.
You can enable DTCoreText
to make it faster.
- add pod
DTCoreText
in your app Podfile atApp_Resources/ios
pod 'DTCoreText'
- enable it in your
app.(js|ts)
(as soon as possible)
;
Properties
-
html
Html text that will be used to render text. HTML supported tags are a bit different on iOS and Android. To make sure it works as expected, for now only used Android supported ones -
verticalTextAlignment
You can also set it through css withvertical-text-alignment
-
textShadow
You can also set it through css withtext-shadow
. The format isoffsetx offsety blurradius color
Improvements
- Override the {N} font loading system to make it much faster
- faster creation of
FormattedString
- faster label creation and drawing, especially on android