The documentation says that the returned value from useFormikContext is the same as the formik props of connect, that includes validationSchema. Also the type definition asserts that useFormikContext return value includes validationSchema, but in effect it currently doesn`t.
useFormikContext return value does`t includs validationSchema
Iinclude the following test in the source code
````
import * as React from 'react';
import { render } from 'react-testing-library';
import { Formik } from '../src/Formik';
import { useFormikContext } from '../src/FormikContext';
describe('FormikContext', () => {
describe('useFormikContext', () => {
it('should return validationContext if set', () => {
const validationSchema = 'validationSchema';
const AComponenent: React.FC = () => {
const formikContext = useFormikContext();
expect(formikContext.validationSchema).toBe(validationSchema);
return null;
};
render(
<Formik
initialValues={{ test: '' }}
validationSchema={validationSchema}
onSubmit={() => {}}
>
<AComponenent />
</Formik>
);
});
});
});
````
The test fails
The test should pass.
PR https://github.com/jaredpalmer/formik/pull/2090 fixes the issue
| Software | Version(s) |
| ---------------- | ---------- |
| Formik | 2.06
| React | 16,9,2
| TypeScript | 3.7.2
| Browser | Firefox
| Operating System | Windows 10
+1 Same is for connect() - not returning validationSchema too! It was important for me to mark required fields with hint, depending on schema - now i can't find any way to get it!
+1 for connect() too, to put asterik on required fields
@jaredpalmer it appears as though resolving this would give back a very simple workaround for https://github.com/formium/formik/issues/1241 and https://github.com/formium/formik/issues/712
Would you accept a PR on this, or is it all hands on v3 for now?
Most helpful comment
+1 Same is for connect() - not returning validationSchema too! It was important for me to mark required fields with hint, depending on schema - now i can't find any way to get it!