From 58340bb608aca83f50ea018fcbdd4f7e4043952c Mon Sep 17 00:00:00 2001 From: harukin-DeskMini Date: Wed, 1 Feb 2023 20:46:03 +0900 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=8F=B3=E7=AB=AF=E3=81=AE=E3=83=87?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=82=92=E6=B6=88=E5=8E=BB=E3=81=97=E3=81=9F?= =?UTF-8?q?=E5=A0=B4=E5=90=88=E3=81=AB=E3=82=AF=E3=83=A9=E3=83=83=E3=82=B7?= =?UTF-8?q?=E3=83=A5=E3=81=99=E3=82=8B=E3=83=90=E3=82=B0=E3=81=AE=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/menu.js b/menu.js index 5a30294..8e7c7f8 100644 --- a/menu.js +++ b/menu.js @@ -74,6 +74,7 @@ export default function Menu(props) { useEffect(() => { getStationList().then(setOriginalStationList); }, []); + const [locationAndFavorite, setLocationAndFavorite] = useState([]); useEffect(() => { if (!favoriteStation) return () => {}; @@ -83,6 +84,13 @@ export default function Menu(props) { setLocationAndFavorite(data); }, [currentStation, favoriteStation]); + useEffect(() => { + if (!(selectedCurrentStation < favoriteStation.length)) { + setSelectedCurrentStation(favoriteStation.length - 1); + carouselRef.current.snapToItem(favoriteStation.length - 1); + } + }, [favoriteStation]); + const [stationName, setStationName] = useState(undefined); const [currentStation, setCurrentStation] = useState(undefined); useEffect(() => {