recycling now happens only if nativeView and android properties are not accessed. (#4627)

recycleNativeView filed now accepts: "always" | "never" | "auto". Always will recycle the nativeView no matter if its nativeView or android proprties are accessed. Never will disable recycling. Auto will recycle it only if nativeView and android properties are not accessed.
This commit is contained in:
Hristo Hristov
2017-08-01 15:04:16 +03:00
committed by GitHub
parent 8535e5459a
commit 0f14101238
110 changed files with 844 additions and 834 deletions

View File

@@ -27,7 +27,7 @@ export class ProgressBase extends View implements ProgressDefinition {
// }
}
ProgressBase.prototype.recycleNativeView = true;
ProgressBase.prototype.recycleNativeView = "auto";
/**
* Represents the observable property backing the value property of each Progress instance.

View File

@@ -8,7 +8,7 @@ export * from "./progress-common";
const R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL = 0x01010078;
export class Progress extends ProgressBase {
nativeView: android.widget.ProgressBar;
nativeViewProtected: android.widget.ProgressBar;
public createNativeView() {
return new android.widget.ProgressBar(this._context, null, R_ATTR_PROGRESS_BAR_STYLE_HORIZONTAL);
@@ -18,21 +18,21 @@ export class Progress extends ProgressBase {
return 0;
}
[valueProperty.setNative](value: number) {
this.nativeView.setProgress(value);
this.nativeViewProtected.setProgress(value);
}
[maxValueProperty.getDefault](): number {
return 100;
}
[maxValueProperty.setNative](value: number) {
this.nativeView.setMax(value);
this.nativeViewProtected.setMax(value);
}
[colorProperty.getDefault](): android.graphics.drawable.Drawable {
return null;
}
[colorProperty.setNative](value: Color) {
let progressDrawable = this.nativeView.getProgressDrawable();
let progressDrawable = this.nativeViewProtected.getProgressDrawable();
if (!progressDrawable) {
return;
}
@@ -48,7 +48,7 @@ export class Progress extends ProgressBase {
return null;
}
[backgroundColorProperty.setNative](value: Color) {
let progressDrawable = this.nativeView.getProgressDrawable();
let progressDrawable = this.nativeViewProtected.getProgressDrawable();
if (!progressDrawable) {
return;
}

View File

@@ -10,7 +10,7 @@ export class Progress extends ProgressBase {
constructor() {
super();
this.nativeView = this._ios = UIProgressView.new();
this.nativeViewProtected = this._ios = UIProgressView.new();
}
get ios(): UIProgressView {