mobx-react-form
mobx-react-form copied to clipboard
Yup validation "branch is not a function" also "yup.ref" not working correctly
Hello, how can I replicate this issue branch is not a function
?
The yup.ref
could not be available currently. Use related
prop correctly.
The field related
prop cannot be a boolean, it accepts an array of the paths of the related fields.
There is a comment on how to replicate it. Here line 744-785.
The property related
doesn't make any sense in this issue. That was different experiments within that Sandbox.
"The yup.ref
could not be available currently" - means this YUP integration is useless because no way to validate related fields using yup
.
That's sad to know 😭
branch is not a function
should be related to yup package, the version 1 has changes.
Try to use a function on then
and otherwise
props:
password: yup.string().when("email", {
is: true,
then: () => yup.string().required(),
otherwise: () => yup.string()
}),
about the yup.ref
function, I have to figure out how to implement it in the driver.
I also checked the driver code and I cant' find a solution to the yup.ref
function.
I think this should already work and could be an issue of yup
itself.
Seems weird. That solution was taken from the another project with another technologies and work fine there. At any case thank you, for your investigation. Feel free to close the issue due to absent solutions or improvements around it.
At any cases the relations between fields not working as expected with "yup" it's too sad.
.when
and .ref
- implement ability to change validation rules based on current form values of other fields. Means they can't work if you trying to check fields values separated or partially.