react-hook-form: Invalid prop 'checked' of type 'number' supplied to 'CheckBox', expected 'boolean'

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?

About this issue

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

Most upvoted comments

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