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.

Switch UI doesn't update when set using resetFields

See original GitHub issue

Version

3.2.3

Environment

Latest chrome, OS: High-Siera, latest react

Reproduction link

https://codesandbox.io/s/n3rnmmrm50

Steps to reproduce

Select some option from select input, then turn switch on and click Submit button. In console.log, you’ll see the right output. Then, use allowClear button on Select and click Submit. You will receive empty formValues in console, which is right, but the switch will still be on.

What is expected?

Switch should be turned off by using resetFields function from this.props.form

What is actually happening?

Switch UI is remaining the same, not respecting the value set inside getFieldDecorator

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
afc163commented, Mar 10, 2018
image image

Switch don’t have value prop so you have to tell form what prop control its state.

1reaction
developdeezcommented, Oct 28, 2018

Not sure why but that didnt work for me:

getFieldDecorator("emailNotify", {
                        initialValue: settings.emailNotify,
                        valuePropName: "checked"
                      })
Read more comments on GitHub >

github_iconTop Results From Across the Web

antd Switch UI doesn't update after submit - Stack Overflow
If Switch is inside a form, you can reset the form using the form hook method resetForm const [form] = Form.useForm(); const handleChange ......
Read more >
useForm - reset - React Hook Form
dirtyFields will be updated again if values are provided: it is set to be result of the comparison between the new values provided...
Read more >
Form - Ant Design
High performance Form component with data scope management. ... Select a option and change input text above. Submit Reset Fill form. Form methods....
Read more >
Download of Software or Update Data is Stuck or Will Not ...
The information in this article can help you when downloading software on the Nintendo Switch console, the download progress does not begin, is...
Read more >
RoboForm Extension for Chrome Version News
Fixed setting "Turn off browser built-in PM" does not turns off autofill of addresses. ... Change design of AutoSave UI to be more...
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