Skip to content

Commit 117bbad

Browse files
committed
fix: bring back max nblines with textWrap
1 parent 359c6d3 commit 117bbad

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/label.android.ts

+13-16
Original file line numberDiff line numberDiff line change
@@ -341,40 +341,37 @@ export class Label extends LabelBase {
341341
const nativeView = this.nativeTextViewProtected;
342342
switch (value) {
343343
case 'end':
344-
// nativeView.setSingleLine(true);
345344
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.END);
346345
break;
347346
case 'start':
348-
// nativeView.setSingleLine(true);
349347
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.START);
350348
break;
351349
case 'marquee':
352-
// nativeView.setSingleLine(true);
353350
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.MARQUEE);
354351
break;
355352
case 'middle':
356-
// nativeView.setSingleLine(true);
357353
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.MIDDLE);
358354
break;
359355
case 'none':
360-
// nativeView.setSingleLine(false);
361356
nativeView.setEllipsize(null);
362357
break;
363358
}
364359
}
365360

366361
[whiteSpaceProperty.setNative](value: WhiteSpace) {
367-
const nativeView = this.nativeTextViewProtected;
368-
switch (value) {
369-
case 'initial':
370-
case 'normal':
371-
nativeView.setSingleLine(false);
372-
// nativeView.setEllipsize(null);
373-
break;
374-
case 'nowrap':
375-
nativeView.setSingleLine(true);
376-
// nativeView.setEllipsize(android.text.TextUtils.TruncateAt.END);
377-
break;
362+
if (!this.lineBreak) {
363+
const nativeView = this.nativeTextViewProtected;
364+
switch (value) {
365+
case 'initial':
366+
case 'normal':
367+
nativeView.setSingleLine(false);
368+
nativeView.setEllipsize(null);
369+
break;
370+
case 'nowrap':
371+
nativeView.setSingleLine(true);
372+
nativeView.setEllipsize(android.text.TextUtils.TruncateAt.END);
373+
break;
374+
}
378375
}
379376
}
380377
[textShadowProperty.setNative](value: TextShadow) {

src/label.ios.ts

+7
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,13 @@ export class Label extends LabelBase {
808808
// only if no lineBreak
809809
if (!this.lineBreak) {
810810
nativeView.textContainer.lineBreakMode = whiteSpaceToLineBreakMode(value);
811+
if (!this.maxLines) {
812+
if (value === 'normal') {
813+
this.nativeViewProtected.textContainer.maximumNumberOfLines = 0;
814+
} else {
815+
this.nativeViewProtected.textContainer.maximumNumberOfLines = 1;
816+
}
817+
}
811818
}
812819
}
813820

0 commit comments

Comments
 (0)