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.

Invalid prop 'checked' of type 'number' supplied to 'CheckBox', expected 'boolean'

See original GitHub issue

Please consider asking the question at our spectrum channel.

https://spectrum.chat/react-hook-form

Describe the question?

I am receiving the following error when attempting to use a CheckBox from React Native Elements with a Controller in React Native.

Invalid prop 'checked' of type 'number' supplied to 'CheckBox', expected 'boolean

The Controller documentation seems a little hazy. Am I using this correctly? It seems to be trying to pass the number 2263 to the checkbox, instead of a boolean value.

Code Snippet

      <Controller
        as={CheckBox}
        control={control}
        name="optIn"
        valueName="checked"
        onChangeName="onPress"
        title="Opt In to Newsletter"
        defaultValue={true}
      />

Do I somehow need to convert the value to a boolean and then pass it down?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:30 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
LucidNinjacommented, Mar 17, 2020

Ok. I’ll see how I go and let you know.

0reactions
bluebill1049commented, Mar 17, 2020

I have removed many of my replies here as well, apparently as my help is useless, so no point of keep them here too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed prop type: Invalid prop `value` of type `number ...
I have a postalCode and it is numeric value. I have set the keyboardType="numeric" on <TextInput /> but I still have this error...
Read more >
Invalid prop 'value' of type 'number' supplied to 'TextInput'
In this case when the value is alphanumeric then the value is treated as a string but in the case of numeric, it...
Read more >
invalid prop `value` of type `boolean` supplied to `checkbox ...
Knob component has issue with Invalid prop value of type string supplied to Knob, expected number and DatePicker component has similar issue Invalid...
Read more >
invalid prop `rows` of type `object` supplied to `forwardref ...
Failed prop type: Invalid prop children of type array supplied to ForwardRef(ListItemIcon) , expected a single ReactElement. failed Proptypes. Open side panel.
Read more >
How To Use PropTypes In React - Web Dev Simplified Blog
Warning: Failed prop type: Invalid prop age of type string supplied to Component , expected number . This is great since we can...
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