diff --git a/frontend/src/pages/mobile/Schedule.jsx b/frontend/src/pages/mobile/Schedule.jsx index f1c6348..a9f08ba 100644 --- a/frontend/src/pages/mobile/Schedule.jsx +++ b/frontend/src/pages/mobile/Schedule.jsx @@ -15,6 +15,7 @@ function MobileSchedule() { const [showCalendar, setShowCalendar] = useState(false); const [calendarViewDate, setCalendarViewDate] = useState(() => new Date(selectedDate)); // 달력 뷰 날짜 const [calendarShowYearMonth, setCalendarShowYearMonth] = useState(false); // 달력 년월 선택 모드 + const contentRef = useRef(null); // 스크롤 초기화용 // 달력 월 변경 함수 const changeCalendarMonth = (delta) => { @@ -97,6 +98,13 @@ function MobileSchedule() { setCalendarViewDate(newDate); }; + // 날짜 변경 시 스크롤 맨 위로 초기화 + useEffect(() => { + if (contentRef.current) { + contentRef.current.scrollTop = 0; + } + }, [selectedDate]); + // 캘린더가 열릴 때 배경 스크롤 방지 useEffect(() => { @@ -422,7 +430,7 @@ function MobileSchedule() { {/* 컨텐츠 영역 */} -
+
{isSearchMode && searchTerm ? ( // 검색 결과