React-native yup validation with Checkbox

I’m stuck on a problem with validating a checkbox with yup, used with useForm and CheckBox component. I won’t be able to send whole lot of code because of the size of the project but I can explain what exactly is the problem.
This is a sign-up form and there is a sign up button that stayes blurred /inactive until all fields and inputs reach the validation conditions. What’s not happening for me is that the button never gets activated, eventhough the acceptTerms checkbox should be valid.
The button worked as intended until I added the checkbox validation, but now, nothing.

  const validationSchema = useMemo(
    () =>
        acceptTerms: yup.boolean().oneOf([true], 'You need to accept our Terms of Service and Privacy Policy to be able to proceed.').required().default(false),

The above code seems to be correct. But then…

const { control, handleSubmit, errors, formState } = useForm<
    ISignupFields & { "acceptTerms": boolean }
    mode: "onChange",
    resolver: yupResolver(validationSchema),
    shouldUnregister: true,

I am not sure that the “acceptTerms” is defined correctly. And…

const [isChecked, setIsChecked] = useState(false);

                render={({ onChange, onBlur, value }) => (
          onPress = {() => setIsChecked(!isChecked)}

the real issue seems to be in this code above.

Would appreciate some help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.