NativeView recycled for android

This commit is contained in:
Hristo Hristov
2017-03-28 12:48:19 +03:00
parent 5e555bcfd4
commit f2898f84d5
114 changed files with 1480 additions and 1391 deletions

View File

@ -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;

View File

@ -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;