-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field props onChange accepts event or value, but onChange callback only accepts events (not plain values) #3446
Comments
i have same question |
The same for me. I'm using react-select and its onChange prop returns an object So I hot fixed it, as adding a new custom prop
However, it will be great if |
I had to do the same hotfix, not very convenient... |
Is this already fixed? I have the same problem where the |
Published fix in |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
According to the docs, it's valid to call
onChange
with either a synthetic event or a value. My form component calls it with a simple value (like a string or number).However, if an
onChange
callback is defined on the givenField
, then redux-form assumes the value is an event object and tries to extend it with apreventDefault
key. This doesn't work for values like strings and numbers.This is the code I'm referring to: https://github.com/erikras/redux-form/blob/6e262c2945fd93c6f0b06441487deaba27e8cef0/src/ConnectedField.js#L113-L119
I'm not sure if the code needs to be updated or the docs need to be updated. I'd be happy to work on a PR, if you let me know what the correct resolution is. Thank you.
The text was updated successfully, but these errors were encountered: