Skip to content

Commit

Permalink
fix(uilabel): line height setter should not break line break mode (#5544
Browse files Browse the repository at this point in the history
)

fix(uilabel): line height setter should not break line break mode
  • Loading branch information
manoldonev committed Mar 15, 2018
1 parent e43c754 commit 75bd1d2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tns-core-modules/ui/text-base/text-base.ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export class TextBase extends TextBaseCommon {
paragraphStyle.lineSpacing = this.lineHeight;
// make sure a possible previously set text alignment setting is not lost when line height is specified
paragraphStyle.alignment = (<UITextField | UITextView | UILabel>this.nativeViewProtected).textAlignment;
if (this.nativeViewProtected instanceof UILabel) {
// make sure a possible previously set line break mode is not lost when line height is specified
paragraphStyle.lineBreakMode = this.nativeViewProtected.lineBreakMode;
}
attrText.addAttributeValueRange(NSParagraphStyleAttributeName, paragraphStyle, { location: 0, length: attrText.length });
}

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

Expand Down

0 comments on commit 75bd1d2

Please sign in to comment.