Skip to content

Commit 25ae4b9

Browse files
committed
fix: bottom sheet ref 타입 충돌 해결
1 parent b41182a commit 25ae4b9

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

apps/web/src/components/ui/BottomSheet/hooks/useHandleModal.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import { type MutableRefObject, type RefObject, useCallback, useEffect, useMemo, useRef, useState } from "react";
1+
import { type MutableRefObject, useCallback, useEffect, useMemo, useRef, useState } from "react";
22

33
// 드래그 핸들에서 제외해야 하는 인터랙티브 엘리먼트 판별
44
const isInteractiveElement = (el: EventTarget | null): boolean => {
55
return el instanceof HTMLElement && ["INPUT", "TEXTAREA", "SELECT", "BUTTON", "A", "LABEL"].includes(el.tagName);
66
};
77

88
interface UseHandleModalReturn {
9-
elementRef: RefObject<HTMLDivElement>;
109
isVisible: boolean;
1110
translateY: number;
1211
isDraggingRef: MutableRefObject<boolean>;
@@ -23,7 +22,6 @@ const useHandleModal = (onClose: () => void, snap: number[] = [0]): UseHandleMod
2322
const startYRef = useRef<number>(0); // 시작 Y좌표
2423
const currentYRef = useRef<number>(0); // 현재 Y좌표
2524
const isDraggingRef = useRef<boolean>(false); // 드래그 상태
26-
const elementRef = useRef<HTMLDivElement>(null);
2725

2826
const snapPoints = useMemo((): number[] => {
2927
if (typeof window === "undefined") return [0]; // SSR 대응
@@ -115,7 +113,6 @@ const useHandleModal = (onClose: () => void, snap: number[] = [0]): UseHandleMod
115113
}, [isVisible, translateY, snapPoints, handleClose]);
116114

117115
return {
118-
elementRef,
119116
isVisible,
120117
translateY,
121118
isDraggingRef,

apps/web/src/components/ui/BottomSheet/index.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,8 @@ interface BottomSheetProps {
1414
const DEFAULT_SNAP = [0];
1515

1616
const BottomSheet = ({ isOpen, onClose, children, titleChild, snap = DEFAULT_SNAP }: BottomSheetProps) => {
17-
const {
18-
elementRef,
19-
isVisible,
20-
translateY,
21-
isDraggingRef,
22-
handleClose,
23-
handleTouchStart,
24-
handleTouchMove,
25-
handleTouchEnd,
26-
} = useHandleModal(onClose, snap);
17+
const { isVisible, translateY, isDraggingRef, handleClose, handleTouchStart, handleTouchMove, handleTouchEnd } =
18+
useHandleModal(onClose, snap);
2719

2820
if (!isOpen) return null;
2921

@@ -45,7 +37,6 @@ const BottomSheet = ({ isOpen, onClose, children, titleChild, snap = DEFAULT_SNA
4537

4638
{/* 바텀 시트 */}
4739
<div
48-
ref={elementRef}
4940
className={clsx(
5041
"fixed bottom-0 left-0 z-50 flex h-[90vh] max-h-screen w-full flex-col rounded-t-2xl bg-white shadow-2xl",
5142
!isDraggingRef.current && "transition-transform duration-300 ease-out",

0 commit comments

Comments
 (0)