1

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.

Aanal Shah
  • 1,946
  • 2
  • 20
  • 30

1 Answers1

1

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;
 }
boop_the_snoot
  • 3,209
  • 4
  • 33
  • 44
Dlucidone
  • 1,091
  • 9
  • 23