perscrew / react-native-form-validator

React native library to validate form fields
127 stars 55 forks source link

how to add custom validators #18

Open iamhaaamed opened 6 years ago

iamhaaamed commented 6 years ago

Hi, How can I add custom validators to react-native-form-validator?

vocampos commented 5 years ago

[2] How can I add custom validators to react-native-form-validator?

wodka commented 5 years ago

Easy way it to extend the validate function and add the checks yourself and then add the errors:

this.messages['en']['my_error_name'] = 'field {0} had my error with {1}'
this._addError('some_field', 'my_error','data')
wodka commented 4 years ago

first of - don't ping people to provide you with examples for your work. second - go through the code and look at the validator function