Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to uncheck the checkbox after selection and value is set to an array #2240

Closed
emjaksa opened this issue Jan 24, 2020 · 4 comments
Closed

Comments

@emjaksa
Copy link

emjaksa commented Jan 24, 2020

馃悰 Bug report

After updating formik from v2.1.0 to v2.1.2 the checkbox type sets value to an empty array instead of a boolean. As a result you cannot uncheck the checkbox.

Current Behavior

Unable to uncheck the checkbox after selection and value is an array

Expected behavior

Can check and uncheck the checkbox and the form value is a boolean.

Reproducible example

v2.1.0
https://codesandbox.io/s/formik-checkbox-v210-bl4we

v2.1.2
https://codesandbox.io/s/formik-checkbox-v212-7bwh7

Your environment

Software Version(s)
Formik 2.1.2
React 16.12.0
TypeScript
Browser Chrome 79.0.3945.130
npm/Yarn
Operating System OSX
@emjaksa emjaksa changed the title Formik unable to uncheck and check field of type="checkbox" and form value set to array Unable to uncheck the checkbox after selection and value is set to an array Jan 24, 2020
@emjaksa
Copy link
Author

emjaksa commented Jan 30, 2020

Looks like this was resolved in version 2.1.3

@emjaksa emjaksa closed this as completed Jan 30, 2020
@shadowfoxish
Copy link

Note: It will still behave this way if you initialize the checkbox value to 1 or 0, so make sure to use true or false

@ScottEnock
Copy link

Experiencing the same issue. Can we reopen this please? @emjaksa

@johnrom
Copy link
Collaborator

johnrom commented Mar 9, 2021

This is fixed in #2255 which will land in v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants