From 75bd1d2c4979b0b7fd05e294d831c71daa9f8335 Mon Sep 17 00:00:00 2001 From: Manol Donev Date: Thu, 15 Mar 2018 16:21:03 +0200 Subject: [PATCH] fix(uilabel): line height setter should not break line break mode (#5544) fix(uilabel): line height setter should not break line break mode --- tns-core-modules/ui/text-base/text-base.ios.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tns-core-modules/ui/text-base/text-base.ios.ts b/tns-core-modules/ui/text-base/text-base.ios.ts index f711086e3..e2a966c66 100644 --- a/tns-core-modules/ui/text-base/text-base.ios.ts +++ b/tns-core-modules/ui/text-base/text-base.ios.ts @@ -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 = (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 }); } @@ -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 = (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); }