I am interested in expanding the functionality of the NativeScript Switch UI component by creating a custom directive for it.
@Directive({
selector: "CustomSwitch"
})
export class CustomSwitch extends Switch {
constructor() {
super();
// Implement custom events here
if (isIOS) {
// Modify background and other properties here.
}
}
}
It seems that the ViewBase class has a method named setNativeView. Can someone provide an example of how this can be achieved and suggest the best approach?
While CSS is useful for global styling, I also require the capability to extend the component to expose custom events.