메뉴 페이지 오픈 시 초기 상태로 리셋
- 메뉴가 열릴 때마다 스크롤 위치와 선택 상태 초기화 - 메뉴 리스트 스크롤을 맨 위로 이동 - 카테고리 버튼 스크롤을 맨 왼쪽으로 이동 - 선택된 버튼 인덱스를 0으로 초기화 (거래조회 선택) - 이전 상태가 아닌 항상 초기화된 상태로 표시 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -203,6 +203,23 @@ export const Menu = ({
|
||||
setEditMode(favoriteEdit)
|
||||
}
|
||||
},[favoriteEdit]);
|
||||
|
||||
// 메뉴가 열릴 때 초기화
|
||||
useEffect(() => {
|
||||
if (menuOn) {
|
||||
// 스크롤 위치 초기화
|
||||
if (scrollRef.current) {
|
||||
scrollRef.current.scrollTop = 0;
|
||||
}
|
||||
if (shortBtnScrollRef.current) {
|
||||
shortBtnScrollRef.current.scrollLeft = 0;
|
||||
}
|
||||
// 선택된 버튼 인덱스 초기화
|
||||
setShortBtnIdx(0);
|
||||
// lastScrollTop 초기화
|
||||
lastScrollTop.current = 0;
|
||||
}
|
||||
}, [menuOn]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user