@@ -13,6 +13,7 @@ import {
1313 FieldHelperProps ,
1414 FieldInputProps ,
1515 FormikHelpers ,
16+ FormikContextType ,
1617} from './types' ;
1718import {
1819 isFunction ,
@@ -28,6 +29,7 @@ import {
2829import { FormikProvider } from './FormikContext' ;
2930import invariant from 'tiny-warning' ;
3031import { LowPriority , unstable_runWithPriority } from 'scheduler' ;
32+ import { FormikBag } from './withFormik' ;
3133
3234type FormikMessage < Values > =
3335 | { type : 'SUBMIT_ATTEMPT' }
@@ -994,15 +996,15 @@ export function useFormik<Values extends FormikValues = FormikValues>({
994996 return ctx ;
995997}
996998
997- export function Formik <
999+ export const Formik = React . forwardRef ( <
9981000 Values extends FormikValues = FormikValues ,
9991001 ExtraProps = { }
1000- > ( props : FormikConfig < Values > & ExtraProps ) {
1002+ > ( props : FormikConfig < Values > & ExtraProps , ref : React . Ref < FormikContextType < Values > > ) => {
10011003 const formikbag = useFormik < Values > ( props ) ;
1002- const { component, children, render, innerRef } = props ;
1004+ const { component, children, render } = props ;
10031005
10041006 // This allows folks to pass a ref to <Formik />
1005- React . useImperativeHandle ( innerRef , ( ) => formikbag ) ;
1007+ React . useImperativeHandle ( ref , ( ) => formikbag ) ;
10061008
10071009 React . useEffect ( ( ) => {
10081010 if ( __DEV__ ) {
@@ -1030,7 +1032,10 @@ export function Formik<
10301032 : null }
10311033 </ FormikProvider >
10321034 ) ;
1033- }
1035+ } ) as <
1036+ Values extends FormikValues = FormikValues ,
1037+ ExtraProps = { }
1038+ > ( props : FormikConfig < Values > & ExtraProps & React . RefAttributes < FormikContextType < Values > > ) => JSX . Element ;
10341039
10351040function warnAboutMissingIdentifier ( {
10361041 htmlContent,
0 commit comments