Skip to content

Commit f5f140f

Browse files
committed
chore: Reverted line-height changes
1 parent fa2066b commit f5f140f

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

packages/core/platforms/ios/src/UIView+NativeScript.m

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,8 @@ - (void)nativeScriptSetTextDecorationAndTransform:(NSString*)text textDecoration
3030
// make sure a possible previously set text alignment setting is not lost when line height is specified
3131
if ([self isKindOfClass:[UIButton class]]) {
3232
paragraphStyle.alignment = ((UIButton*)self).titleLabel.textAlignment;
33-
34-
if (((UIButton*)self).titleLabel.font) {
35-
paragraphStyle.lineSpacing = lineHeight - ((UIButton*)self).titleLabel.font.lineHeight;
36-
}
3733
} else {
3834
paragraphStyle.alignment = ((UILabel*)self).textAlignment;
39-
40-
if (((UILabel*)self).font) {
41-
paragraphStyle.lineSpacing = lineHeight - ((UILabel*)self).font.lineHeight;
42-
}
4335
}
4436

4537
if ([self isKindOfClass:[UILabel class]]) {
@@ -100,17 +92,9 @@ -(void)nativeScriptSetFormattedTextDecorationAndTransform:(NSDictionary*)details
10092
// make sure a possible previously set text alignment setting is not lost when line height is specified
10193
if ([self isKindOfClass:[UIButton class]]) {
10294
paragraphStyle.alignment = ((UIButton*)self).titleLabel.textAlignment;
103-
104-
if (((UIButton*)self).titleLabel.font) {
105-
paragraphStyle.lineSpacing = lineHeight - ((UIButton*)self).titleLabel.font.lineHeight;
106-
}
10795
} else {
10896
// Paragraph alignment is also important for tappable spans as NSTextContainer takes it into account
10997
paragraphStyle.alignment = ((UILabel*)self).textAlignment;
110-
111-
if (((UILabel*)self).font) {
112-
paragraphStyle.lineSpacing = lineHeight - ((UILabel*)self).font.lineHeight;
113-
}
11498
}
11599

116100
if (isLabel) {

packages/core/ui/text-base/index.android.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,6 @@ export class TextBase extends TextBaseCommon {
367367
if (!this.formattedText) {
368368
this.nativeTextViewProtected.setTextSize(value);
369369

370-
// Re-calculate line-height
371-
if (this.lineHeight != 0) {
372-
// It's done automatically for API 28+
373-
if (SDK_VERSION < 28) {
374-
this._setLineHeightLegacy(this.lineHeight);
375-
}
376-
}
377-
378370
// Re-calculate letter-spacing
379371
if (this.letterSpacing != 0) {
380372
this._updateLetterSpacing(this.letterSpacing);
@@ -494,15 +486,6 @@ export class TextBase extends TextBaseCommon {
494486
}
495487
}
496488

497-
_setLineHeightLegacy(value: number): void {
498-
const dpValue = value * layout.getDisplayDensity();
499-
const fontHeight = this.nativeTextViewProtected.getPaint().getFontMetricsInt(null);
500-
// Actual line spacing is the diff of line height and font height
501-
const lineSpacing = Math.max(dpValue - fontHeight, 0);
502-
503-
this.nativeTextViewProtected.setLineSpacing(lineSpacing, 1);
504-
}
505-
506489
_updateLetterSpacing(value: number): void {
507490
const emValue = value / this.fontSize;
508491
org.nativescript.widgets.ViewHelper.setLetterspacing(this.nativeTextViewProtected, emValue);

0 commit comments

Comments
 (0)