I'm trying to write a react native application using Formik + Yup for schema validation and I'm having some trouble trying to extract the constants passed in max validation.
Let's imagine the following schema:
const message = string()
.max(30)
.default(1)
In my React Native component, let's say a custom TextInput
, I wanted to get the constants 30
so that I can pass it to the maxLength
prop:
<TextInput maxLength={max} {...otherProps} />
(of course the schema is simplified)
Does anybody know if it's feasible? How I can dig into a yup schema to access that constant and pass it to my TextInput
?