-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Description
Are you submitting a bug report or a feature request?
Bug
What is the current behavior?
When using field level validators, I am unable to use a higher order function to produce the validation function
This works:
const required = value => (value ? undefined : 'Required')
<Field
label="Email"
name="email"
component={InputField}
validate={required}
placeholder="email"
type="text"
/>
This DOES NOT work:
const required = (msg = 'Default Message') => value => (value ? undefined : msg)
<Field
label="Email"
name="email"
component={InputField}
validate={required('Message Override')}
placeholder="email"
type="text"
/>
What is the expected behavior?
I would expect to pass into the field validator a returned function that matches the validator interface even if it was produced by a higher order function
Sandbox Link
https://codesandbox.io/s/G6ARklAMr
What's your environment?
Redux Form: 7.0.3
OS: macOS
Browser: Chrome 60
Other information
piya23300, sarzijan, kolpav, Kison, vibragiel and 4 more