Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

AntD switch is not correctly if type is checkbox. #41

Closed
iamchanii opened this issue Dec 17, 2019 · 4 comments · Fixed by #42
Closed

AntD switch is not correctly if type is checkbox. #41

iamchanii opened this issue Dec 17, 2019 · 4 comments · Fixed by #42

Comments

@iamchanii
Copy link
Contributor

Describe the bug
When I use Antd switch with RHFInput, I think it is right to set type to checkbox. then, Switch is not working. but if type is input, it is working.

To Reproduce
Checkout below codesandbox.

Codesandbox link
https://codesandbox.io/s/rhf-input-with-antd-switch-2rdwx

Expected behavior
It should be work with type="checkbox" not type="input"

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Chrome 78 on catalina

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
I think it is a bug. so I will create a PR for resolve this issue. can I?

@iamchanii
Copy link
Contributor Author

As I inspected, getValue should be check target.checked is undefined or not.

@bluebill1049
Copy link
Member

want to spend a PR for this @iamchanii ?

@iamchanii
Copy link
Contributor Author

If I can, YES!

@bluebill1049
Copy link
Member

lovely thank you

iamchanii added a commit to iamchanii/react-hook-form-input that referenced this issue Dec 17, 2019
bluebill1049 pushed a commit that referenced this issue Dec 17, 2019
* Check target.checked is undefined (fix #41)

* Fix wrong logic
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants