1
votes

I am developing a NativeScript application. I want to use radiobutton functionality in my application.

I have tried to achieve this by using "nativescript-radiobutton" plugin, but it doesn't support in iOS.

Is there any solution through which it works for both Android and iOS platform?

Thank you in advance.

1
Perhaps you can use nativescript-checkbox npmjs.com/package/nativescript-checkbox - Nick Iliev

1 Answers

1
votes

Use this Html for the radio button -

<Label text="{{ checkYes ? '&#xf192;' : '&#xf10c;'}}" 
       class="{{ checkYes ? 'fontawesome' : 'radioBefore'}}" 
       (tap)="changeAction()">
</Label>

Apply these two classes for Font Awesome -

.font-awesome {
   font-family: "fontawesome-webfont";
   font-size: 24;
}

.radioBefore {
   font-family: "fontawesome-webfont";
   font-size: 24;
}

Add Font-awesome.ttf file in fonts folder and then change the radio buttons selected or unselected with changeAction()

Function - Initialize this.changeYes = true

 changeGenderMale(){
    if(this.changeYes == true)
      this.changeYes = false;
    else
      this.changeYes = true;
 }