In order to adjust the size of a switch in NativeScript, CSS manipulation alone is insufficient. Native methods must be utilized to modify the size. To demonstrate this process, I have prepared a sample playground for you which can be accessed here.
After testing the functionality on iOS and confirming its effectiveness, it was found that accessing the nativeElement of Switch component and implementing the necessary adjustments within the loaded method are crucial steps.
<Switch #mySwitch checked="true" class="m-15 firstSwitchStyle"
(loaded)="switchLoaded($event)"></Switch>
In your TypeScript file (.ts), consider incorporating the following code snippet:
declare let CGAffineTransformMakeScale: any; // Alternatively, utilize tns-platform-declarations instead of resorting to casting as any
@ViewChild('mySwitch') mySwitch: ElementRef;
switchLoaded(args) {
let mySwitch = this.mySwitch.nativeElement;
if (isIOS) {
let iosSwitch = mySwitch.nativeView;
iosSwitch.transform = CGAffineTransformMakeScale(3, 3);
}
}