RadioButton.Group does not support `0` as a value
See original GitHub issueCurrent 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:
- Created 3 years ago
- Comments:13 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
PR is up: https://github.com/callstack/react-native-paper/pull/2368