-
Notifications
You must be signed in to change notification settings - Fork 734
Checkbox - add validation state invoked by validate() #2672
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
If I add the following code and press it before doing anything I'll receive a
|
Why? The component is valid by default until it moves to the validation state, which means the user invoked the validate() method and it passed/failed the validation check. If the user doesn't invoke the validate() I will not show error colors if the component is unchecked and the component will keep acting as valid (as it always did) |
onValidityChange - invoke if required, but only if validate invoked
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
…/Checkbox_error_state # Conflicts: # demo/src/screens/componentScreens/CheckboxScreen.tsx
…/Checkbox_error_state
//eslint-disable-next-line | ||
new CheckboxDriver({component, testID}); | ||
|
||
checkboxRef.current?.validate(); |
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.
If you add a ?
you don't know that validate
was actually called (what if current
is undefined
?
@@ -86,8 +94,17 @@ export interface CheckboxProps extends TouchableOpacityProps { | |||
indeterminate?: boolean; | |||
} | |||
|
|||
interface CheckboxMethods { | |||
validate: () => void; |
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.
I see in TextField
there's a onValidationFailed
method that is called when the validation fails, WDYT about adding it? Unlike onChangeValidity
it is called if validate
fails.
It can be another PR...
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.
I'll keep it simple until we'll get such a request
@Inbal-Tish |
Description
Checkbox - add validation state invoked by validate() - see example in screen
Changelog
Checkbox - add validation state invoked by validate()
Additional info
#3662