feat: 모바일 일정 날짜 변경 시 스크롤 맨 위로 초기화

- contentRef 추가하여 mobile-content 요소 참조
- selectedDate 변경 시 useEffect로 scrollTop = 0 설정
This commit is contained in:
caadiq 2026-01-09 15:04:27 +09:00
parent d0b78f0b5d
commit 578ab25568

View file

@ -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() {
</AnimatePresence>
{/* 컨텐츠 영역 */}
<div className="mobile-content">
<div className="mobile-content" ref={contentRef}>
<div className="px-4 pt-4 pb-4">
{isSearchMode && searchTerm ? (
//