From d586bc562fe805e236d5b13e8c20a3d9974b7632 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 8 Jul 2025 12:23:29 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=AB=E3=83=AB=E3=83=BC=E3=82=BB=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E6=8C=99=E5=8B=95=E3=82=92=E4=BF=AE=E6=AD=A3=E3=80=81?= =?UTF-8?q?=E3=83=90=E3=83=83=E3=82=B8=E3=81=AE=E3=82=B5=E3=82=A4=E3=82=BA?= =?UTF-8?q?=E3=81=A8=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E3=81=AE?= =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Menu/Carousel/CarouselBox.tsx | 13 ++--- menu.js | 66 +++++++++++++----------- 2 files changed, 41 insertions(+), 38 deletions(-) diff --git a/components/Menu/Carousel/CarouselBox.tsx b/components/Menu/Carousel/CarouselBox.tsx index d093f8e..680addf 100644 --- a/components/Menu/Carousel/CarouselBox.tsx +++ b/components/Menu/Carousel/CarouselBox.tsx @@ -29,7 +29,8 @@ export const CarouselBox = ({ useEffect(() => { if (!carouselBadgeScrollViewRef.current) return; - const scrollToIndex = (dotButton ? 28 : 22) * listIndex - (width / 2) + (dotButton ? 28 : 22) - 5; + const dotSize = dotButton ? 28 : 24; + const scrollToIndex = dotSize * listIndex - width / 2 + dotSize - 5; carouselBadgeScrollViewRef.current.scrollTo({ x: scrollToIndex, animated: true, @@ -64,13 +65,6 @@ export const CarouselBox = ({ setDotButton(data === "true"); }); }, []); - useEffect(() => { - if (!carouselRef.current) return; - carouselRef?.current.scrollTo({ - count: listIndex - carouselRef.current.getCurrentIndex(), - animated: true, - }); - }, [listIndex]); const RenderItem = ({ item, index }) => { return ( = listUpStation.length ? 0 : listIndex} /> { + useLayoutEffect(() => { if (!!isSearchMode) { const returnData = []; Object.keys(lineList_LineWebID).forEach((d, indexBase) => { @@ -191,20 +191,16 @@ export default function Menu(props) { returnData.push([D]); }); }); - if (mapMode) { - mapsRef?.current.fitToCoordinates( - listUpStation.map((d) => ({ - latitude: parseFloat(d[0].lat), - longitude: parseFloat(d[0].lng), - })), - { edgePadding: { top: 80, bottom: 120, left: 50, right: 50 } } // Add margin values here - ); - } + if (JSON.stringify(returnData) == JSON.stringify(listUpStation)) return; setListUpStation(returnData); } else if (stationListMode == "position") { - setListUpStation(nearPositionStation.filter((d) => d != undefined)); + const returnData = nearPositionStation.filter((d) => d != undefined); + if (JSON.stringify(returnData) == JSON.stringify(listUpStation)) return; + setListUpStation(returnData); } else { - setListUpStation(favoriteStation.filter((d) => d != undefined)); + const returnData = favoriteStation.filter((d) => d != undefined); + if (JSON.stringify(returnData) == JSON.stringify(listUpStation)) return; + setListUpStation(returnData); } }, [nearPositionStation, favoriteStation, stationListMode, isSearchMode]); useEffect(() => { @@ -221,7 +217,7 @@ export default function Menu(props) { setMapMode(false); setListIndex(count); } - }, [listIndex, nearPositionStation, listUpStation, isSearchMode]); + }, [listIndex, listUpStation, isSearchMode]); useEffect(() => { if (originalStationList == undefined) return; if (listUpStation.length == 0) return; @@ -233,9 +229,18 @@ export default function Menu(props) { latitudeDelta: 0.05, longitudeDelta: 0.05, }; - if (mapMode) return; - mapsRef.current.animateToRegion(mapRegion, 1000); - }, [listIndex, nearPositionStation, listUpStation, mapsRef]); + if (mapMode) { + mapsRef?.current.fitToCoordinates( + listUpStation.map((d) => ({ + latitude: parseFloat(d[0].lat), + longitude: parseFloat(d[0].lng), + })), + { edgePadding: { top: 80, bottom: 120, left: 50, right: 50 } } // Add margin values here + ); + } else { + mapsRef.current.animateToRegion(mapRegion, 1000); + } + }, [listIndex, listUpStation]); return ( ) : ( - - JRShikoku RailScope - + <> + // + // JRShikoku RailScope + // )}