-
Notifications
You must be signed in to change notification settings - Fork 737
ChipsInput - fix validation #3094
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
Conversation
src/components/chipsInput/index.tsx
Outdated
return inputValidators.includes('required'); | ||
}, [validate]); | ||
|
||
const validateChipsInput = useCallback(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only validity here is 'required' but the user might pass other validations, mainly a custom validation function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, can be tested by adding the following to the screen:
validate={['required', () => {
return this.state.chips2[0]?.label !== 'Bla';
}]}
validateOnChange
The code handling this is a little complicated, but I'm not sure it can be simplified.
Description
ChipsInput - fix validation
Changelog
ChipsInput - fix validation
Additional info
None