react-native-form-validator icon indicating copy to clipboard operation
react-native-form-validator copied to clipboard

Dynamic rule validation require

Open fcostaprojects opened this issue 7 years ago • 0 comments

Hi @perscrew, how to use dynamic rule validation: Example:

values = { name: 'test', date: '', checkDate: false }
const validForm = this.validate({
      name: { required: !checkDate },
      date: { required: checkDate }
})

=> validForm = false

On validate, the variable name is pass ok, but variable date is require: false, bypass false value.

the variable checkDate is dynamic with Switch component in react native screen

fcostaprojects avatar Jul 17 '17 23:07 fcostaprojects