Nativescript-angular: FormattedString's Spans cannot be styled using margin, padding, and alignment

Created on 9 Aug 2018  路  4Comments  路  Source: NativeScript/nativescript-angular

Which platform(s) does your issue occur on?

  • iOS 4.1.1
  • iOS/Android versions
  • emulator, iPhone 6

-Playground used Android real device

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it) 4.1.0
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project)
    "tns-android": {
      "version": "4.1.3"
    },
    "tns-ios": {
      "version": "4.1.1"
    }

Please, tell us how to recreate the issue in as much detail as possible.

Put 2 Spans inside a FormattedString, and try to style it with things besides color.

Is there any code involved?

https://play.nativescript.org/?template=play-ng&id=HTQkgE

Most helpful comment

This is pretty limiting. There's no way for me to make sure the icon text + text on my Button or Label to be aligned vertically. Right now it looks very strange, even if the font size is set to exactly the same, there is still a minor difference between the two font sets in terms of height and alignment.

All 4 comments

Hi @kamok,
Thank you for the sample project.
The margin seems not to be supported by the Spans. You can check all available properties for this component here. Regarding that, you can set up the fontFamily, fontSize, color and backgroundColor.

This is pretty limiting. There's no way for me to make sure the icon text + text on my Button or Label to be aligned vertically. Right now it looks very strange, even if the font size is set to exactly the same, there is still a minor difference between the two font sets in terms of height and alignment.

@tsonevn Have you got an alternative solution for this? You provided a blunt and unhelpful answer to @kamok

Use 3 spans, one the middle with a " \n" and small fontsize

Was this page helpful?
0 / 5 - 0 ratings