1 | import { TextBase, whiteSpaceProperty } from '../text-base';
|
2 | import { profile } from '../../profiling';
|
3 | import { CSSType } from '../core/view';
|
4 | import { booleanConverter } from '../core/view-base';
|
5 | export * from '../text-base';
|
6 | let Label = class Label extends TextBase {
|
7 | get textWrap() {
|
8 | return this.style.whiteSpace === 'normal';
|
9 | }
|
10 | set textWrap(value) {
|
11 | if (typeof value === 'string') {
|
12 | value = booleanConverter(value);
|
13 | }
|
14 | this.style.whiteSpace = value ? 'normal' : 'nowrap';
|
15 | }
|
16 | createNativeView() {
|
17 | return new org.nativescript.widgets.StyleableTextView(this._context);
|
18 | }
|
19 | initNativeView() {
|
20 | super.initNativeView();
|
21 | const textView = this.nativeTextViewProtected;
|
22 | textView.setSingleLine(true);
|
23 | textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
24 | textView.setGravity(android.view.Gravity.CENTER_VERTICAL);
|
25 | }
|
26 | [whiteSpaceProperty.setNative](value) {
|
27 |
|
28 | const newValue = value === 'initial' ? 'nowrap' : value;
|
29 | super[whiteSpaceProperty.setNative](newValue);
|
30 | }
|
31 | };
|
32 | __decorate([
|
33 | profile,
|
34 | __metadata("design:type", Function),
|
35 | __metadata("design:paramtypes", []),
|
36 | __metadata("design:returntype", void 0)
|
37 | ], Label.prototype, "createNativeView", null);
|
38 | Label = __decorate([
|
39 | CSSType('Label')
|
40 | ], Label);
|
41 | export { Label };
|
42 | Label.prototype._isSingleLine = true;
|
43 | Label.prototype.recycleNativeView = 'auto';
|
44 |
|
\ | No newline at end of file |