NativeScript Angular

Text View

The TextView component can be used to type larger text content in your app. The component can also be used show any content by setting the editable property to false.

Usage

<TextView hint="Enter some text..." 
          [text]="tvtext"
          (textChange)="onTextChange($event)">
</TextView>
import { Component } from "@angular/core";
import { EventData } from "tns-core-modules/data/observable";
import { TextView } from "tns-core-modules/ui/text-view";

@Component({
    moduleId: module.id,
    templateUrl: "./usage.component.html"
})
export class UsageComponent {
    tvtext = "";

    onTextChange(args: EventData) {
        const tv = args.object as TextView;
        console.log(tv.text);
    }
}

Improve this document

Demo Source


Properties

Name Type Description
autocapitalizationType AutocapitalizationType Gets or sets the autocapitalization type.
autocorrect boolean Enables or disables autocorrection.
keyboardType KeyboardType Gets or sets the soft keyboard type
letterSpacing number Gets or sets letter space style property.
lineHiehgt number Gets or sets line height style property.
maxLength number Gets or sets the max number of symbols allowed as input.
returnKeyType ReturnKeyType Gets or sets the soft keyboard return key flavor.
secure string Gets or sets if a text field is for password entry.
text string Gets or sets the text.
textAlignment TextAlignment Gets or sets the text alignment.
textDecoration TextDecoration Gets or sets the text decoration.
textTransform TextTransform Gets or sets the text transform.
whiteSpace WhiteSpace Gets or sets white space style property.

Methods

Name Description
focus Tries to focus the view. Returns a value indicating whether this view or one of its descendants actually took focus. Returns boolean.
dismissSoftInput Hides the soft input method, ususally a soft keyboard.

Events

Name Description
blur Emitted when the text field is unfocused.
focus Emitted when the text field is focused.
textChange Emitted when there is a new text input.

API References

Name Type
tns-core-modules/ui/text-view Module
TextView Class

Native Component

Android iOS
android.widget.EditText UITextView