mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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.
23 lines
804 B
TypeScript
23 lines
804 B
TypeScript
import * as button from "tns-core-modules/ui/button";
|
|
import * as view from "tns-core-modules/ui/core/view";
|
|
|
|
export class Button extends button.Button {
|
|
nativeBackgroundRedraws = 0;
|
|
backgroundInternalSetNativeCount = 0;
|
|
fontInternalSetNativeCount = 0;
|
|
|
|
[view.backgroundInternalProperty.setNative](value) {
|
|
this.backgroundInternalSetNativeCount++;
|
|
return super[view.backgroundInternalProperty.setNative](value);
|
|
}
|
|
[view.fontInternalProperty.setNative](value) {
|
|
this.fontInternalSetNativeCount++;
|
|
return super[view.fontInternalProperty.setNative](value);
|
|
}
|
|
_redrawNativeBackground(value: any): void {
|
|
this.nativeBackgroundRedraws++;
|
|
super._redrawNativeBackground(value);
|
|
}
|
|
}
|
|
Button.prototype.recycleNativeView = "never";
|