redux-form-material-ui icon indicating copy to clipboard operation
redux-form-material-ui copied to clipboard

Radio buttons does not work with numeric values

Open madox2 opened this issue 8 years ago • 4 comments

When I pass numeric values to radio buttons, it does not work as expected. I have to to click two times on button to select it. E.g.:

<Field name="count" component={RadioButtonGroup}>
  <RadioButton value={1} label="one" />
  <RadioButton value={2} label="two" />
  <RadioButton value={3} label="three" />
</Field>

After quick debugging I have found that when I click on the button first time, the type of value is string. After second click on the same radio button is the value numeric and button becomes selected.

However it works just fine with string values.

madox2 avatar May 19 '17 10:05 madox2

I'm seeing this too.. thanks for the workaround, using strings works for me 👍

ptim avatar May 28 '17 01:05 ptim

Had this too. I was able to resolve it with normalize={v => Number(v)} - not sure if this is the most ideal way though.

shubsengupta avatar Dec 20 '17 17:12 shubsengupta

which MUI version you're using ?

mihirsoni avatar Dec 25 '17 15:12 mihirsoni

Also, if it is MUI 1.0 and knows the fix would mind sending PR ?

mihirsoni avatar Dec 25 '17 15:12 mihirsoni