diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f8753040..9b40d19b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ should change the heading of the (upcoming) version to include a major version b ## @rjsf/core - Removed `dateElementProps` function implementation, and replaced it with `getDateElementProps` from `@rjsf/utils`. +- Modify submit method to make it a public method, fixing [#4015](https://github.com/rjsf-team/react-jsonschema-form/issues/4015) ## @rjsf/antd diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 101287edcf..e4d771c8ec 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -742,7 +742,7 @@ export default class Form< } /** Provides a function that can be used to programmatically submit the `Form` */ - submit() { + submit = () => { if (this.formElement.current) { this.formElement.current.dispatchEvent( new CustomEvent('submit', { @@ -751,7 +751,7 @@ export default class Form< ); this.formElement.current.requestSubmit(); } - } + }; /** Attempts to focus on the field associated with the `error`. Uses the `property` field to compute path of the error * field, then, using the `idPrefix` and `idSeparator` converts that path into an id. Then the input element with that