diff --git a/menu.js b/menu.js
index 390e858..0ccfaf4 100644
--- a/menu.js
+++ b/menu.js
@@ -34,6 +34,7 @@ import { TicketBox } from "./components/atom/TicketBox";
import { TextBox } from "./components/atom/TextBox";
import { getStationList, lineList } from "./lib/getStationList";
import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo";
+import { EachTrainInfo } from "./components/ActionSheetComponents/EachTrainInfo";
import useInterval from "./lib/useInterval";
export default function Menu(props) {
@@ -55,6 +56,13 @@ export default function Menu(props) {
});
}, []);
+ //列車情報表示関連
+ const EachTrainInfoAsSR = useRef(null);
+ const [trainInfo, setTrainInfo] = useState({
+ trainNum: undefined,
+ limited: undefined,
+ });
+
const getCurrentPosition = () => {
if (locationStatus !== "granted") return () => {};
Location.getCurrentPositionAsync({}).then((location) =>
@@ -124,13 +132,11 @@ export default function Menu(props) {
const allStationData = [currentStation, ...favoriteStation].filter(
(d) => d != undefined
);
- console.log(allStationData);
useEffect(() => {
if (allStationData.length == 0) {
setSelectedCurrentStation(0);
return;
}
- console.log(allStationData[selectedCurrentStation]);
if (allStationData[selectedCurrentStation] == undefined) {
const count = selectedCurrentStation - 1;
setSelectedCurrentStation(count);
@@ -138,12 +144,35 @@ export default function Menu(props) {
}, [selectedCurrentStation, currentStation, favoriteStation]);
useEffect(() => {
if (!carouselRef.current) return;
- console.log(carouselRef.current);
if (carouselRef.current?._itemToSnapTo != selectedCurrentStation) {
carouselRef.current.snapToItem(0);
carouselRef.current.snapToItem(selectedCurrentStation);
}
}, [selectedCurrentStation]);
+
+ const openStationACFromEachTrainInfo = (stationName) => {
+ EachTrainInfoAsSR.current?.hide();
+ const findStationEachLine = (selectLine) => {
+ let NearStation = selectLine.filter((d) => d.Station_JP == stationName);
+ return NearStation;
+ };
+ let returnDataBase = lineList
+ .map((d) => findStationEachLine(originalStationList[d]))
+ .filter((d) => d.length > 0)
+ .reduce((pre, current) => {
+ pre.push(...current);
+ return pre;
+ }, []);
+ if (returnDataBase.length) {
+ setStationBoardData(returnDataBase);
+ sleep(30, function () {
+ StationBoardAcSR.current?.show();
+ });
+ } else {
+ setStationBoardData(undefined);
+ StationBoardAcSR.current?.hide();
+ }
+ };
return (
+
);
}