インデックスがズレて表示が崩れていたので修正
This commit is contained in:
parent
28c58ce83f
commit
3f8a753abb
9
menu.js
9
menu.js
@ -87,8 +87,13 @@ export default function Menu(props) {
|
||||
|
||||
useEffect(() => {
|
||||
if (!(selectedCurrentStation < favoriteStation.length)) {
|
||||
setSelectedCurrentStation(favoriteStation.length - 1);
|
||||
carouselRef.current.snapToItem(favoriteStation.length - 1);
|
||||
if (favoriteStation.length == 0) {
|
||||
setSelectedCurrentStation(0);
|
||||
carouselRef.current.snapToItem(0);
|
||||
} else {
|
||||
setSelectedCurrentStation(favoriteStation.length - 1);
|
||||
carouselRef.current.snapToItem(favoriteStation.length - 1);
|
||||
}
|
||||
}
|
||||
}, [favoriteStation]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user