Add onAfterClose prop to ReactModal

This commit is contained in:
paibamboo 2019-01-04 10:22:41 +07:00
parent 34b631c678
commit 305151cf2d
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for react-modal 3.6
// Type definitions for react-modal 3.8.1
// Project: https://github.com/reactjs/react-modal
// Definitions by: Rajab Shakirov <https://github.com/radziksh>,
// Drew Noakes <https://github.com/drewnoakes>,
@ -64,6 +64,9 @@ declare namespace ReactModal {
/* Function that will be run after the modal has opened. */
onAfterOpen?(): void;
/* Function that will be run after the modal has closed. */
onAfterClose?(): void;
/* Function that will be run when the modal is requested to be closed, prior to actually closing. */
onRequestClose?(event: (MouseEvent | KeyboardEvent)): void;

View File

@ -12,6 +12,7 @@ class ExampleOfUsingReactModal extends React.Component {
overlayRef: HTMLDivElement;
render() {
const onAfterOpenFn = () => { };
const onAfterCloseFn = () => { };
const onRequestCloseFn = () => { };
const customStyle = {
overlay: {
@ -59,6 +60,7 @@ class ExampleOfUsingReactModal extends React.Component {
<ReactModal
isOpen={true}
onAfterOpen={onAfterOpenFn}
onAfterClose={onAfterCloseFn}
onRequestClose={onRequestCloseFn}
contentLabel="demo label"
closeTimeoutMS={1000}