feat(core): maxLines support for all text components (#9884)

This commit is contained in:
farfromrefuge
2022-04-30 19:50:05 +02:00
committed by GitHub
parent 17a87a4a86
commit df10ceb491
12 changed files with 57 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
import { ScrollEventData } from '../scroll-view';
import { textProperty } from '../text-base';
import { TextViewBase as TextViewBaseCommon, maxLinesProperty } from './text-view-common';
import { TextViewBase as TextViewBaseCommon } from './text-view-common';
import { editableProperty, hintProperty, placeholderColorProperty, _updateCharactersInRangeReplacementString } from '../editable-text-base';
import { CoreTypes } from '../../core-types';
import { CSSType } from '../core/view';
@@ -408,18 +408,6 @@ export class TextView extends TextViewBaseCommon {
right: inset.right,
};
}
[maxLinesProperty.getDefault](): number {
return 0;
}
[maxLinesProperty.setNative](value: number) {
this.nativeTextViewProtected.textContainer.maximumNumberOfLines = value;
if (value !== 0) {
this.nativeTextViewProtected.textContainer.lineBreakMode = NSLineBreakMode.ByTruncatingTail;
} else {
this.nativeTextViewProtected.textContainer.lineBreakMode = NSLineBreakMode.ByWordWrapping;
}
}
}
TextView.prototype.recycleNativeView = 'auto';