Skip to content

Commit 75bd1d2

Browse files
authored
fix(uilabel): line height setter should not break line break mode (NativeScript#5544)
fix(uilabel): line height setter should not break line break mode
1 parent e43c754 commit 75bd1d2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tns-core-modules/ui/text-base/text-base.ios.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ export class TextBase extends TextBaseCommon {
131131
paragraphStyle.lineSpacing = this.lineHeight;
132132
// make sure a possible previously set text alignment setting is not lost when line height is specified
133133
paragraphStyle.alignment = (<UITextField | UITextView | UILabel>this.nativeViewProtected).textAlignment;
134+
if (this.nativeViewProtected instanceof UILabel) {
135+
// make sure a possible previously set line break mode is not lost when line height is specified
136+
paragraphStyle.lineBreakMode = this.nativeViewProtected.lineBreakMode;
137+
}
134138
attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
135139
}
136140

@@ -171,6 +175,10 @@ export class TextBase extends TextBaseCommon {
171175
paragraphStyle.lineSpacing = style.lineHeight;
172176
// make sure a possible previously set text alignment setting is not lost when line height is specified
173177
paragraphStyle.alignment = (<UITextField | UITextView | UILabel>this.nativeViewProtected).textAlignment;
178+
if (this.nativeViewProtected instanceof UILabel) {
179+
// make sure a possible previously set line break mode is not lost when line height is specified
180+
paragraphStyle.lineBreakMode = this.nativeViewProtected.lineBreakMode;
181+
}
174182
dict.set(NSParagraphStyleAttributeName, paragraphStyle);
175183
}
176184

0 commit comments

Comments
 (0)