From 1a1e9c417bcbeb20baacb2bd8ffa80e69dc38377 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 4 Feb 2025 12:49:07 +0000 Subject: [PATCH] =?UTF-8?q?=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TrainMenuLineSelector.js | 22 ++++++++++++++++++- components/trainMenu.js | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/components/ActionSheetComponents/TrainMenuLineSelector.js b/components/ActionSheetComponents/TrainMenuLineSelector.js index 758c4df..5b45c5b 100644 --- a/components/ActionSheetComponents/TrainMenuLineSelector.js +++ b/components/ActionSheetComponents/TrainMenuLineSelector.js @@ -9,6 +9,7 @@ import { import ActionSheet, { SheetManager } from "react-native-actions-sheet"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useTrainMenu } from "../../stateBox/useTrainMenu"; +import { useCurrentTrain } from "../../stateBox/useCurrentTrain"; import lineColorList from "../../assets/originData/lineColorList"; import { stationIDPair } from "../../lib/getStationList2"; import { lineListPair } from "../../lib/getStationList"; @@ -19,6 +20,7 @@ export const TrainMenuLineSelector = () => { setSelectedLine, mapsStationData: stationData, } = useTrainMenu(); + const { webview } = useCurrentTrain(); const actionSheetRef = useRef(null); const insets = useSafeAreaInsets(); const platformIs = Platform.OS == "android"; @@ -52,7 +54,25 @@ export const TrainMenuLineSelector = () => { }} onPress={() => { SheetManager.hide("TrainMenuLineSelector"); - setSelectedLine(selectedLine == d ? undefined : d); + const s = selectedLine == d ? undefined : d; + if(!s) return; + setSelectedLine(s); + Object.keys(stationData).forEach((data, indexBase) => { + stationData[data].forEach((D, index) => { + if (!D.StationMap) return null; + if (s && s != data) return; + const latlng = D.StationMap.replace( + "https://www.google.co.jp/maps/place/", + "" + ).split(","); + if (latlng.length == 0) return null; + if (index == 0 ) { + webview.current + ?.injectJavaScript(`MoveDisplayStation('${data}_${D.MyStation}_${D.Station_JP}'); + document.getElementById("disp").insertAdjacentHTML("afterbegin", "
");`); + } + }); + }); }} > { const s = selectedLine == d ? undefined : d; + if(!s) return; setSelectedLine(s); Object.keys(stationData).forEach((data, indexBase) => { stationData[data].forEach((D, index) => {