最右端のデータを消去した場合にクラッシュするバグの修正
This commit is contained in:
parent
32fb402126
commit
58340bb608
8
menu.js
8
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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user