mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Disable recycling of native views
createNativeView will set iOS nativeView if it is null/undefined
This commit is contained in:
@@ -7,7 +7,7 @@ export class SwitchBase extends View implements SwitchDefinition {
|
||||
public checked: boolean;
|
||||
}
|
||||
|
||||
SwitchBase.prototype.recycleNativeView = true;
|
||||
// SwitchBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const checkedProperty = new Property<SwitchBase, boolean>({ name: "checked", defaultValue: false, valueConverter: booleanConverter });
|
||||
checkedProperty.register(SwitchBase);
|
||||
@@ -45,6 +45,7 @@ export class Switch extends SwitchBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = this;
|
||||
}
|
||||
@@ -52,6 +53,7 @@ export class Switch extends SwitchBase {
|
||||
public disposeNativeView() {
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
[checkedProperty.getDefault](): boolean {
|
||||
|
||||
Reference in New Issue
Block a user