question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RadioButton.Group does not support `0` as a value

See original GitHub issue

Current behaviour

Cannot select a RadioButton inside of a RadioButton.Group whose value is 0

Expected behaviour

Should be able to select the value

Code sample

https://snack.expo.io/Vi2GImYP9

Try clicking the “First” and “Second” radio buttons. Notice that you cannot get “First” to become selected. This code is the example code from the docs, with the difference being that the value for the First button is {0} instead of {"0"}

Your Environment

software version
react-native 0.63.3
react-native-paper 4.3.0
node 14.13.1
npm 6.14.8
yarn 1.22.10
expo 39.0.2

See Snack link in the Code Sample section above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gregfentoncommented, Nov 13, 2020

Add to that use case: internationalization. If you want to display different labels based on l10n/i18n, then you likely want to generalize the values of your selections.

This is essentially why my codebase is using the array index (0 … n) of the data being selected. We then look up the selection’s value in an internationalized label table to fetch the appropriate display value. We store the index value (0…n) in the database as the “data” for the selection.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to post radio button value false/0, if radio button option is ...
Radio buttons are submitted by the name group they are bound to, thus only a single value for the radio button name group...
Read more >
Xamarin.Forms RadioButton - Microsoft Learn
RadioButton objects don't have to belong to the same parent to be grouped. They are mutually exclusive provided that they share a group...
Read more >
Radio Group - Reactive Web Error - OutSystems
The environment you're logged into doesn't support 'Radio Button ... to set specific value for each radio button within the Radio group.
Read more >
sap.m.RadioButtonGroup - API Reference - Demo Kit
Determines the index of the selected/checked RadioButton. Default is 0. If no radio button is selected, the selectedIndex property will return -1. Default...
Read more >
In LWC is there a way to Save selected Radio Button value to ...
Basically I've rendered picklist as radio button group in record edit form, as picklist values are bit long. But Radio group are not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found