File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const getInputs = children =>
1818 return partialInputs ;
1919 } , [ ] ) ;
2020
21- export const withNextInputAutoFocusForm = WrappedComponent => {
21+ export const withNextInputAutoFocusForm = ( WrappedComponent , { submitAfterLastInput } = { submitAfterLastInput : true } ) => {
2222 class WithNextInputAutoFocusForm extends React . PureComponent {
2323 static childContextTypes = withNextInputAutoFocusContextType ;
2424
@@ -43,7 +43,7 @@ export const withNextInputAutoFocusForm = WrappedComponent => {
4343 const isLastInput = inputPosition === this . inputs . length - 1 ;
4444
4545 if ( isLastInput ) {
46- this . props . formik . submitForm ( ) ;
46+ if ( submitAfterLastInput ) this . props . formik . submitForm ( ) ;
4747 } else {
4848 const nextInputs = this . inputs . slice ( inputPosition + 1 ) ;
4949 const nextFocusableInput = nextInputs . find (
You can’t perform that action at this time.
0 commit comments