|
1 | 1 | import { ScrollEventData } from "../scroll-view"; |
2 | | -import { TextView as TextViewDefinition } from "."; |
| 2 | +import { TextViewBase as TextViewBaseCommon, maxLinesProperty } from "./text-view-common"; |
3 | 3 | import { |
4 | | - EditableTextBase, editableProperty, hintProperty, textProperty, colorProperty, placeholderColorProperty, |
| 4 | + editableProperty, hintProperty, textProperty, colorProperty, placeholderColorProperty, |
5 | 5 | borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, |
6 | 6 | paddingTopProperty, paddingRightProperty, paddingBottomProperty, paddingLeftProperty, |
7 | 7 | Length, _updateCharactersInRangeReplacementString, Color, layout, |
@@ -110,7 +110,7 @@ class NoScrollAnimationUITextView extends UITextView { |
110 | 110 | } |
111 | 111 |
|
112 | 112 | @CSSType("TextView") |
113 | | -export class TextView extends EditableTextBase implements TextViewDefinition { |
| 113 | +export class TextView extends TextViewBaseCommon { |
114 | 114 | nativeViewProtected: UITextView; |
115 | 115 | private _delegate: UITextViewDelegateImpl; |
116 | 116 | private _isShowingHint: boolean; |
@@ -333,6 +333,20 @@ export class TextView extends EditableTextBase implements TextViewDefinition { |
333 | 333 | let left = layout.toDeviceIndependentPixels(this.effectivePaddingLeft + this.effectiveBorderLeftWidth); |
334 | 334 | this.nativeTextViewProtected.textContainerInset = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right }; |
335 | 335 | } |
| 336 | + [maxLinesProperty.getDefault](): number { |
| 337 | + return 0; |
| 338 | + } |
| 339 | + [maxLinesProperty.setNative](value: number) { |
| 340 | + this.nativeTextViewProtected.textContainer.maximumNumberOfLines = value; |
| 341 | + |
| 342 | + if (value !== 0) { |
| 343 | + this.nativeTextViewProtected.textContainer.lineBreakMode = NSLineBreakMode.ByTruncatingTail; |
| 344 | + } |
| 345 | + else { |
| 346 | + this.nativeTextViewProtected.textContainer.lineBreakMode = NSLineBreakMode.ByWordWrapping; |
| 347 | + } |
| 348 | + } |
| 349 | + |
336 | 350 | } |
337 | 351 |
|
338 | 352 | TextView.prototype.recycleNativeView = "auto"; |
0 commit comments