From 29716dece33a406bc87ce2495ca4605a4bce09d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Sat, 17 Aug 2024 12:39:10 +0200 Subject: [PATCH] Fix modal position MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- src/components/ui/modal/modal.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/ui/modal/modal.tsx b/src/components/ui/modal/modal.tsx index 9ec812662..9b7a131c5 100644 --- a/src/components/ui/modal/modal.tsx +++ b/src/components/ui/modal/modal.tsx @@ -84,12 +84,10 @@ const Modal = React.forwardRef(({ }, ref) => { const intl = useIntl(); const buttonRef = React.useRef(null); - const firstRender = React.useRef(true); + const [firstRender, setFirstRender] = React.useState(true); React.useEffect(() => { - if (firstRender.current) { - firstRender.current = false; - } + setFirstRender(false); }, []); React.useEffect(() => { @@ -103,8 +101,8 @@ const Modal = React.forwardRef(({ ref={ref} data-testid='modal' className={clsx(className, 'pointer-events-auto relative mx-auto block w-full rounded-2xl bg-white p-6 text-start align-middle text-gray-900 shadow-xl transition-all ease-in-out black:bg-black dark:bg-primary-900 dark:text-gray-100', widths[width], { - 'bottom-0': !firstRender.current, - '-bottom-32': firstRender.current, + 'bottom-0': !firstRender, + '-bottom-32': firstRender, })} >