Skip to content

Commit

Permalink
fix: mutation observer 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoleee authored Jan 31, 2024
1 parent c7fa0d1 commit c6f51a5
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,6 +20,11 @@ export default function BottonSheetShowContent({
const showStatusChildrenRef = useRef<HTMLDivElement>(null);
const { status, setShowStatusChildrenHeight } = useBottomSheet();

useMutationObserver(showStatusChildrenRef, () => {
showStatusChildrenRef.current &&
setShowStatusChildrenHeight(showStatusChildrenRef.current.offsetHeight);
});

const onResize = useCallback(
(target: HTMLDivElement) => {
setShowStatusChildrenHeight(target.offsetHeight);
Expand Down

0 comments on commit c6f51a5

Please sign in to comment.