Open Vercjames opened 1 year ago
Confirmed on my react-native
app as well.
This code example from the docs works perfectly.
But as soon as I introduce a validationSchema
I can't handle submitting anymore.
@Vercjames What's your yup
version?
Mine was
"yup": "^0.32.11"
yup
maintainers recently reverted a change https://github.com/jquense/yup/commits/master
You probably pulled a broken version.
Edit I tried to bump dependencies to
"formik": "^2.4.3",
"yup": "^1.2.0"
I still experience this issue and I noticed I have a problem with some schema but not all of them.
// ā
works
export const gtinSchema = Yup.object().shape({
gtin: Yup.string()
.min(8, "error.gtinMinLength")
.max(14, "error.gtinMaxLength")
.required("error.required"),
});
// ā broken with `validationSchema` and `onSubmit`
export const priceSchema = Yup.object().shape({
price: Yup.number().min(0, "error.priceMinLength").required("error.required"),
});
@Vercjames could you confirm with the latest version? Thank you!
Bug report
using .cast({}) causes form validation to stop working
Current Behavior
the Yup cast method is not instantiating form validation
Expected behavior
Form validation should behave as normal.
Reproducible example
this code works:
this code does not:
Suggested solution(s)
fix issue where .default("ANY VALUE") breaks form validation.
Your environment