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

@@ -7,6 +7,8 @@ export class StackLayoutBase extends LayoutBase implements StackLayoutDefinition
public orientation: "horizontal" | "vertical";
}
StackLayoutBase.prototype.recycleNativeView = true;
export const orientationProperty = new Property<StackLayoutBase, "horizontal" | "vertical">({
name: "orientation", defaultValue: "vertical", affectsLayout: isIOS,
valueConverter: (v) => {

View File

@@ -3,25 +3,13 @@
export * from "./stack-layout-common";
export class StackLayout extends StackLayoutBase {
private _layout: org.nativescript.widgets.StackLayout;
get android(): org.nativescript.widgets.StackLayout {
return this._layout;
}
get _nativeView(): org.nativescript.widgets.StackLayout {
return this._layout;
}
nativeView: org.nativescript.widgets.StackLayout;
public _createNativeView() {
const layout = this._layout = new org.nativescript.widgets.StackLayout(this._context);
return layout;
return new org.nativescript.widgets.StackLayout(this._context);
}
[orientationProperty.getDefault](): "horizontal" | "vertical" {
return "vertical";
}
[orientationProperty.setNative](value: "horizontal" | "vertical") {
this._layout.setOrientation(value === "vertical" ? org.nativescript.widgets.Orientation.vertical : org.nativescript.widgets.Orientation.horizontal)
this.nativeView.setOrientation(value === "vertical" ? org.nativescript.widgets.Orientation.vertical : org.nativescript.widgets.Orientation.horizontal)
}
}