mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-26 03:01:51 +08:00
refactor(core-modules): implement createNativeView and initNativeView for all components
refactor(core-modules): implement createNativeView and initNativeView for all components
This commit is contained in:

committed by
Martin Yankov

parent
71107533bb
commit
46705ee332
@ -36,18 +36,16 @@ export class Switch extends SwitchBase {
|
||||
public checked: boolean;
|
||||
|
||||
public createNativeView() {
|
||||
initializeCheckedChangeListener();
|
||||
const nativeView = new android.widget.Switch(this._context);
|
||||
const listener = new CheckedChangeListener(this);
|
||||
nativeView.setOnCheckedChangeListener(listener);
|
||||
(<any>nativeView).listener = listener;
|
||||
return nativeView;
|
||||
return new android.widget.Switch(this._context);
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeViewProtected;
|
||||
nativeView.listener.owner = this;
|
||||
const nativeView = this.nativeViewProtected;
|
||||
initializeCheckedChangeListener();
|
||||
const listener = new CheckedChangeListener(this);
|
||||
nativeView.setOnCheckedChangeListener(listener);
|
||||
(<any>nativeView).listener = listener;
|
||||
}
|
||||
|
||||
public disposeNativeView() {
|
||||
|
Reference in New Issue
Block a user