@@ -35,12 +35,10 @@ export const createOverlayComponent = <
3535 forwardedRef ?: React . ForwardedRef < OverlayType > ;
3636 } ;
3737
38- let isDismissing = false ;
39-
4038 class Overlay extends React . Component < Props > {
4139 overlay ?: OverlayType ;
4240 el ! : HTMLDivElement ;
43-
41+ isDismissing = false ;
4442 constructor ( props : Props ) {
4543 super ( props ) ;
4644 if ( typeof document !== 'undefined' ) {
@@ -75,7 +73,7 @@ export const createOverlayComponent = <
7573 shouldComponentUpdate ( nextProps : Props ) {
7674 // Check if the overlay component is about to dismiss
7775 if ( this . overlay && nextProps . isOpen !== this . props . isOpen && nextProps . isOpen === false ) {
78- isDismissing = true ;
76+ this . isDismissing = true ;
7977 }
8078
8179 return true ;
@@ -91,7 +89,7 @@ export const createOverlayComponent = <
9189 }
9290 if ( this . overlay && prevProps . isOpen !== this . props . isOpen && this . props . isOpen === false ) {
9391 await this . overlay . dismiss ( ) ;
94- isDismissing = false ;
92+ this . isDismissing = false ;
9593
9694 /**
9795 * Now that the overlay is dismissed
@@ -142,7 +140,7 @@ export const createOverlayComponent = <
142140 * overlay is dismissing otherwise component
143141 * will be hidden before animation is done.
144142 */
145- return ReactDOM . createPortal ( this . props . isOpen || isDismissing ? this . props . children : null , this . el ) ;
143+ return ReactDOM . createPortal ( this . props . isOpen || this . isDismissing ? this . props . children : null , this . el ) ;
146144 }
147145 }
148146
0 commit comments