From c6f51a565cd3207752d74d84a88078f5e4c19750 Mon Sep 17 00:00:00 2001 From: Sangjo LEE Date: Wed, 31 Jan 2024 13:45:47 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20mutation=20observer=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/BottomSheet/components/BottomSheetShowContent.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/components/main/BottomSheet/components/BottomSheetShowContent.tsx b/src/components/main/BottomSheet/components/BottomSheetShowContent.tsx index 182d6a15..1dddb3ee 100644 --- a/src/components/main/BottomSheet/components/BottomSheetShowContent.tsx +++ b/src/components/main/BottomSheet/components/BottomSheetShowContent.tsx @@ -7,6 +7,7 @@ import CurrentLocationButton from '@components/main/CurrentLocationButton'; import { currentLocationButtonFadeInOutVariants } from '@constants/motions'; import useResizeObserver from '@hooks/useResizeObserver'; import mergeRefs from '@utils/mergeRefs'; +import useMutationObserver from '@hooks/useMutationObserver'; interface BottonSheetShowContent { onCurrentLocationButtonClick: () => void; @@ -19,6 +20,11 @@ export default function BottonSheetShowContent({ const showStatusChildrenRef = useRef(null); const { status, setShowStatusChildrenHeight } = useBottomSheet(); + useMutationObserver(showStatusChildrenRef, () => { + showStatusChildrenRef.current && + setShowStatusChildrenHeight(showStatusChildrenRef.current.offsetHeight); + }); + const onResize = useCallback( (target: HTMLDivElement) => { setShowStatusChildrenHeight(target.offsetHeight);