Files
Nicu 3c79ded42b feat(textview): added maxLines property (#7943)
* feat(textview): added maxLines property

* feat(text-view): moved implementation to TextView

* feat(text-view): changes based on CR

* feat(text-view): Normalize behavior in between android and iOS

* chore: updated NativeScript.api.md

* chore: add new line before return

Co-authored-by: Dimitar Topuzov <dtopuzov@gmail.com>
Co-authored-by: Vasil Trifonov <v.trifonov@gmail.com>
2020-01-16 12:41:26 +02:00

34 lines
1.2 KiB
TypeScript

import { TextViewBase as TextViewBaseCommon, maxLinesProperty } from "./text-view-common";
import { CSSType } from "../editable-text-base";
export * from "../text-base";
@CSSType("TextView")
export class TextView extends TextViewBaseCommon {
public _configureEditText(editText: android.widget.EditText) {
editText.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_VARIATION_NORMAL | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE | android.text.InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
editText.setGravity(android.view.Gravity.TOP | android.view.Gravity.START);
}
public resetNativeView(): void {
super.resetNativeView();
this.nativeTextViewProtected.setGravity(android.view.Gravity.TOP | android.view.Gravity.START);
}
[maxLinesProperty.getDefault](): number {
return 0;
}
[maxLinesProperty.setNative](value: number) {
if (value <= 0) {
this.nativeTextViewProtected.setMaxLines(Number.MAX_VALUE);
return;
}
this.nativeTextViewProtected.setMaxLines(value);
}
}
TextView.prototype.recycleNativeView = "auto";