0

I am working with "React native", And right now i am trying to validate "password and confirm password", I just want to pass "password" parameter to console instead of both(password and confirm password),For this i am using "formik" library, Here is my current code

<Formik
            initialValues={{
                name: '',
                email: '',
                phone: '',
                password: '',
                confirmPassword: '',
            }}
            validationSchema={SignupSchema}
            onSubmit={values => console.warn(values)}
        >

password: Yup.string()
        .min(8)
        .required('Please enter your password.')
        .matches(
            /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/,
            'Must contain minimum 8 characters, at least one uppercase letter,'
        ),
    confirmPassword: Yup.string()
        .min(8)
        .oneOf([Yup.ref('password')], 'Your Password do not match')
        .required('Confirm password is required'), 
  • can you please check this link ? https://stackoverflow.com/questions/61862252/yup-schema-validation-password-and-confirmpassword-doesnt-work – inkredusk Apr 19 '23 at 09:17

0 Answers0