From c2541878eca19bc49cd476edb442314d4befe0c7 Mon Sep 17 00:00:00 2001 From: Patrik Date: Thu, 5 Sep 2019 19:42:36 +0200 Subject: [PATCH] add submit method to Form (#37979) --- types/react-jsonschema-form/index.d.ts | 4 +++- .../react-jsonschema-form-tests.tsx | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts index 777a35d4ae..6d5251add9 100644 --- a/types/react-jsonschema-form/index.d.ts +++ b/types/react-jsonschema-form/index.d.ts @@ -56,7 +56,9 @@ declare module 'react-jsonschema-form' { acceptcharset?: string; } - export default class Form extends React.Component> {} + export default class Form extends React.Component> { + submit: () => void; + } export type UiSchema = { 'ui:field'?: Field | string; diff --git a/types/react-jsonschema-form/react-jsonschema-form-tests.tsx b/types/react-jsonschema-form/react-jsonschema-form-tests.tsx index 321832374f..bcbf2bac3d 100644 --- a/types/react-jsonschema-form/react-jsonschema-form-tests.tsx +++ b/types/react-jsonschema-form/react-jsonschema-form-tests.tsx @@ -173,3 +173,15 @@ export const withThemeExample = () => { export const additionalPropertyFlagExample = () => { return ADDITIONAL_PROPERTY_FLAG; }; + +export const ExternalFormSubmissionExample = () => { + const formRef = React.useRef>(null); + + return ( +
+ +
+ ); +};