From 39b78018d3fea8592ed79d40577d9782d2484cfd Mon Sep 17 00:00:00 2001 From: Cuong Vu Date: Sat, 24 Dec 2022 23:25:48 +0700 Subject: [PATCH] fix: dialog reappear after closed --- src/Dialog/Content/index.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Dialog/Content/index.tsx b/src/Dialog/Content/index.tsx index 7d98fc32..7e6fc208 100644 --- a/src/Dialog/Content/index.tsx +++ b/src/Dialog/Content/index.tsx @@ -37,7 +37,8 @@ const Content = React.forwardRef((props, ref) => { contentStyle.transformOrigin = transformOrigin; } - function onPrepare() { + function onPrepare(dialog) { + dialog.style.display = null; const elementOffset = offset(dialogRef.current); setTransformOrigin( @@ -47,6 +48,10 @@ const Content = React.forwardRef((props, ref) => { ); } + function onLeave(dialog) { + dialog.style.display = 'none'; + } + // ============================= Render ============================= return ( ((props, ref) => { forceRender={forceRender} motionName={motionName} removeOnLeave={destroyOnClose} + onLeaveEnd={onLeave} ref={dialogRef} > {({ className: motionClassName, style: motionStyle }, motionRef) => (