mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
NativeView recycled for android
This commit is contained in:
@ -4,7 +4,7 @@ import { TextBase, WhiteSpace } from "../text-base";
|
||||
export * from "../text-base";
|
||||
|
||||
export class Label extends TextBase implements LabelDefinition {
|
||||
private _android: android.widget.TextView;
|
||||
nativeView: android.widget.TextView;
|
||||
|
||||
get textWrap(): boolean {
|
||||
return this.style.whiteSpace === WhiteSpace.NORMAL;
|
||||
@ -13,14 +13,18 @@ export class Label extends TextBase implements LabelDefinition {
|
||||
this.style.whiteSpace = value ? WhiteSpace.NORMAL : WhiteSpace.NO_WRAP;
|
||||
}
|
||||
|
||||
get android(): android.widget.TextView {
|
||||
return this._android;
|
||||
}
|
||||
|
||||
public _createNativeView() {
|
||||
const textView = this._android = new android.widget.TextView(this._context);
|
||||
const textView = new android.widget.TextView(this._context);
|
||||
textView.setSingleLine(true);
|
||||
textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
return textView;
|
||||
}
|
||||
|
||||
public _initNativeView(): void {
|
||||
const textView = this.nativeView;
|
||||
textView.setSingleLine(true);
|
||||
// textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
}
|
||||
}
|
||||
|
||||
Label.prototype.recycleNativeView = true;
|
@ -38,10 +38,6 @@ export class Label extends TextBase implements LabelDefinition {
|
||||
return this.nativeView;
|
||||
}
|
||||
|
||||
get _nativeView(): TNSLabel {
|
||||
return this.nativeView;
|
||||
}
|
||||
|
||||
get textWrap(): boolean {
|
||||
return this.style.whiteSpace === WhiteSpace.NORMAL;
|
||||
}
|
||||
@ -237,3 +233,5 @@ export class Label extends TextBase implements LabelDefinition {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Label.prototype.recycleNativeView = true;
|
Reference in New Issue
Block a user