diff --git a/frontend/src/pages/mobile/public/Schedule.jsx b/frontend/src/pages/mobile/public/Schedule.jsx index 33016fd..7b3c820 100644 --- a/frontend/src/pages/mobile/public/Schedule.jsx +++ b/frontend/src/pages/mobile/public/Schedule.jsx @@ -27,6 +27,32 @@ function MobileSchedule() { const [calendarViewDate, setCalendarViewDate] = useState(() => new Date(selectedDate)); // 달력 뷰 날짜 const [calendarShowYearMonth, setCalendarShowYearMonth] = useState(false); // 달력 년월 선택 모드 const contentRef = useRef(null); // 스크롤 초기화용 + + // 검색 모드 진입 함수 (history 상태 추가) + const enterSearchMode = () => { + setIsSearchMode(true); + window.history.pushState({ searchMode: true }, ''); + }; + + // 검색 모드 종료 함수 + const exitSearchMode = () => { + setIsSearchMode(false); + setSearchInput(''); + setSearchTerm(''); + }; + + // 뒤로가기 버튼 처리 + useEffect(() => { + const handlePopState = (e) => { + if (isSearchMode) { + // 검색 모드에서 뒤로가기 시 검색 모드 종료 + exitSearchMode(); + } + }; + + window.addEventListener('popstate', handlePopState); + return () => window.removeEventListener('popstate', handlePopState); + }, [isSearchMode]); // 달력 월 변경 함수 const changeCalendarMonth = (delta) => { @@ -257,7 +283,7 @@ function MobileSchedule() { )} - @@ -340,7 +366,7 @@ function MobileSchedule() { -