mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -1,51 +1,51 @@
|
||||
import { Label as LabelDefinition } from ".";
|
||||
import { TextBase, WhiteSpace, whiteSpaceProperty } from "../text-base";
|
||||
import { profile } from "../../profiling";
|
||||
import { CSSType } from "../core/view";
|
||||
import { booleanConverter } from "../core/view-base";
|
||||
import { Label as LabelDefinition } from '.';
|
||||
import { TextBase, WhiteSpace, whiteSpaceProperty } from '../text-base';
|
||||
import { profile } from '../../profiling';
|
||||
import { CSSType } from '../core/view';
|
||||
import { booleanConverter } from '../core/view-base';
|
||||
|
||||
export * from "../text-base";
|
||||
export * from '../text-base';
|
||||
|
||||
let TextView: typeof android.widget.TextView;
|
||||
|
||||
@CSSType("Label")
|
||||
@CSSType('Label')
|
||||
export class Label extends TextBase implements LabelDefinition {
|
||||
nativeViewProtected: android.widget.TextView;
|
||||
nativeTextViewProtected: android.widget.TextView;
|
||||
nativeViewProtected: android.widget.TextView;
|
||||
nativeTextViewProtected: android.widget.TextView;
|
||||
|
||||
get textWrap(): boolean {
|
||||
return this.style.whiteSpace === "normal";
|
||||
}
|
||||
set textWrap(value: boolean) {
|
||||
if (typeof value === "string") {
|
||||
value = booleanConverter(value);
|
||||
}
|
||||
get textWrap(): boolean {
|
||||
return this.style.whiteSpace === 'normal';
|
||||
}
|
||||
set textWrap(value: boolean) {
|
||||
if (typeof value === 'string') {
|
||||
value = booleanConverter(value);
|
||||
}
|
||||
|
||||
this.style.whiteSpace = value ? "normal" : "nowrap";
|
||||
}
|
||||
this.style.whiteSpace = value ? 'normal' : 'nowrap';
|
||||
}
|
||||
|
||||
@profile()
|
||||
public createNativeView() {
|
||||
if (!TextView) {
|
||||
TextView = android.widget.TextView;
|
||||
}
|
||||
@profile()
|
||||
public createNativeView() {
|
||||
if (!TextView) {
|
||||
TextView = android.widget.TextView;
|
||||
}
|
||||
|
||||
return new TextView(this._context);
|
||||
}
|
||||
return new TextView(this._context);
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const textView = this.nativeTextViewProtected;
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
}
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const textView = this.nativeTextViewProtected;
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
}
|
||||
|
||||
[whiteSpaceProperty.setNative](value: WhiteSpace) {
|
||||
// Label initial value is no-wrap. set in initNativeView
|
||||
const newValue = value === "initial" ? "nowrap" : value;
|
||||
super[whiteSpaceProperty.setNative](newValue);
|
||||
}
|
||||
[whiteSpaceProperty.setNative](value: WhiteSpace) {
|
||||
// Label initial value is no-wrap. set in initNativeView
|
||||
const newValue = value === 'initial' ? 'nowrap' : value;
|
||||
super[whiteSpaceProperty.setNative](newValue);
|
||||
}
|
||||
}
|
||||
|
||||
Label.prototype._isSingleLine = true;
|
||||
Label.prototype.recycleNativeView = "auto";
|
||||
Label.prototype.recycleNativeView = 'auto';
|
||||
|
||||
Reference in New Issue
Block a user