Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

how do I add a custom function to work with Yup?

$
0
0

sup?

I'm trying to create a form validation using formik and yup. One of the fields needs attention when validating, so I use a lib that has an value.isValid(valueThatNeedsAttention) function. how could I validate a field using it?

ci: Yup.string()    .required('CI is a required field')    .min(13, 'Provie a valid CI')    .max(14, 'Provide a valid CI')    .oneOf([Yup.ref('ci'), [Yup.ref('ci')].isValid(ci)], 'Provide a valid CI'),

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>