CheckboxWithLabel returns empty array instead of true
See original GitHub issueBelow is how I am implementing the checkbox.
<Field
Label={{label: 'Remember me'}}
checked={false}
onChange={() => console.log('checked')}
name="remember"
value="1"
color="primary"
component={CheckboxWithLabel}
/>
When I check the box it returns empty array instead of boolean. This causes the error below:
Warning: Failed prop type: Invalid prop `checked` of type `array` supplied to `ForwardRef(Checkbox)`, expected `boolean`.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:22
Top Results From Across the Web
CheckboxWithLabel returns empty array instead of true #114
Below is how I am implementing the checkbox. ... When I check the box it returns empty array instead of boolean. This causes...
Read more >Checkbox input returning empty string instead of true/false ...
I think the error here is because you are not actually passing a checked property to the <Checkbox> component.
Read more >Building a custom checkbox in React - LogRocket Blog
Default and custom checkboxes in React. The checkbox is a control element that provides an option to toggle between true and false states....
Read more ><input type="checkbox"> - HTML: HyperText Markup Language
inputInstance.indeterminate = true; ... in the box (it looks somewhat like a hyphen or minus sign) instead of a check/tick in most browsers....
Read more >Checkbox class - material library - Flutter - Dart API docs
A Material Design checkbox. The checkbox itself does not maintain any state. Instead, when the state of the checkbox changes, the widget calls...
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
I’ve managed to get i work but couldn’t use formik-material-ui, here’s a hack while waiting for a fix:
Using onChange prop I can manually set the form state using the Formik context.
For
Switch
(boolean behaviour i.e. not multiple), I managed to make it work in Formik 2 natively (without formik-material-ui), using<Field as>
syntax. Extract:using formik 2.0.6 and material-ui 4.6.1