nativescript-community / nativescript-community/ui-label

Text is not centered when using lineHeight

Open
#20 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
20
Forks
9
Avg merge
1d 11h
Merged PRs (30d)
3

Description

simplified template is
<GridLayout rows="auto, auto, auto, auto" columns="*, 10, auto" @tap="tapEvent" class="checklist-list-template"> <HTMLLabel text="item.machinery.firstname" class="headline2" row="0" col="0" textWrap="true" verticalTextAlignment="center" verticalAlignment="middle" lineHeight="50" backgroundColor="blue"/> <HTMLLabel text="item.machinery.lastname" row="1" col="0" textWrap="true" lineHeight="50" verticalTextAlignment="center" backgroundColor="red"/> <HTMLLabel textWrap="true" row="2" lineHeight="50" verticalTextAlignment="center" backgroundColor="green"> <FormattedString lineHeight="50" verticalTextAlignment="center" backgroundColor="green"> <Span text="qrCode"/> <Span text="parsedDueDate.text" lineHeight="50" verticalTextAlignment="center" backgroundColor="green"/> </FormattedString> </HTMLLabel> <HTMLLabel text="arrow_forward_ios" class="mdi-outlined-18px" row="0" col="2" verticalAlignment="top" horizontalAlignment="right"/> </GridLayout>

the text is not centered (also tried setting vertical-align: middle; via css text-alignment: center; works though).

Additionally lineHeight is not applied when using FormattedString (hence why i tried setting it everywhere in there).
Currently cant build for android so I can only confirm this for iOS.

used packages
"@nativescript/android": "8.6.2",
"@nativescript/ios": "8.6.3",
"@nativescript-community/text": "1.5.47",
"@nativescript-community/ui-label": "1.3.26",
"@nativescript/core": "8.6.2"

Simulator Screenshot - iPhone 14 Pro - 2024-04-09 at 11 05 56

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by reproducing the simplified GridLayout template on iOS with the listed NativeScript packages, then trace the HTMLLabel and FormattedString layout behavior. Done means text is vertically centered with lineHeight and lineHeight is applied inside FormattedString.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.