mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add submit method to Form (#37979)
This commit is contained in:
parent
83e5c8c944
commit
c2541878ec
4
types/react-jsonschema-form/index.d.ts
vendored
4
types/react-jsonschema-form/index.d.ts
vendored
@ -56,7 +56,9 @@ declare module 'react-jsonschema-form' {
|
||||
acceptcharset?: string;
|
||||
}
|
||||
|
||||
export default class Form<T> extends React.Component<FormProps<T>> {}
|
||||
export default class Form<T> extends React.Component<FormProps<T>> {
|
||||
submit: () => void;
|
||||
}
|
||||
|
||||
export type UiSchema = {
|
||||
'ui:field'?: Field | string;
|
||||
|
||||
@ -173,3 +173,15 @@ export const withThemeExample = () => {
|
||||
export const additionalPropertyFlagExample = () => {
|
||||
return ADDITIONAL_PROPERTY_FLAG;
|
||||
};
|
||||
|
||||
export const ExternalFormSubmissionExample = () => {
|
||||
const formRef = React.useRef<Form<any>>(null);
|
||||
|
||||
return (
|
||||
<Form schema={schema} ref={formRef}>
|
||||
<button onClick={formRef.current ? formRef.current.submit : undefined}>
|
||||
FancySubmitButton
|
||||
</button>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user