From 6a15decadd174665d2ac79637f2f263fb45f3381 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 15 May 2024 10:12:49 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E3=83=87?= =?UTF-8?q?=E3=83=95=E3=82=A9=E3=83=AB=E3=83=88=E8=A1=A8=E7=A4=BA=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 2 ++ .../EachTrainInfo/TrainDataView.js | 6 ++-- .../EachTrainInfoCore.js | 35 +++++++------------ stateBox/useCurrentTrain.js | 6 +++- 4 files changed, 22 insertions(+), 27 deletions(-) diff --git a/App.js b/App.js index 6ba4a20..f8e7f4b 100644 --- a/App.js +++ b/App.js @@ -63,6 +63,8 @@ export function AppContainer() { { const { width, height } = useWindowDimensions(); const { isLandscape } = useDeviceOrientationChange(); - const { webview, getCurrentTrain } = useCurrentTrain(); + const { webview, getCurrentTrain, inject } = useCurrentTrain(); const [mapsStationData, setMapsStationData] = useState(undefined); useEffect(() => { getStationList2().then(setMapsStationData); @@ -51,10 +51,10 @@ export const TrainDataView = ({ } }); if (!test.length) return; - webview.current?.injectJavaScript( + navigate("Apps"); + inject( `MoveDisplayStation('${test[0].line}_${test[0].station.MyStation}_${test[0].station.Station_JP}');setStrings();` ); - navigate("Apps"); SheetManager.hide("EachTrainInfo"); }} > diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 0b99ec1..7b693a6 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -235,12 +235,17 @@ export const EachTrainInfoCore = ({ } else { SheetManager.hide("EachTrainInfo").then(() => { //0.1秒待機してから開く - setTimeout(() => { - SheetManager.show("EachTrainInfo", { payload }); - }, 2); + setTimeout(() => SheetManager.show("EachTrainInfo", { payload }), 2); }); } }; + const headerItem = { + currentTrainData, + currentPosition, + nearTrainIDList, + openTrainInfo, + navigate, + }; return ( - } - longHeader={ - - } + shortHeader={} + longHeader={} topStickyContent={ } @@ -376,11 +365,11 @@ export const EachTrainInfoCore = ({ ) )} {tailStation.length != 0 && - tailStation.map((i, index) => + tailStation.map(({ station, dia }, index) => showTailStation.findIndex((d) => d == index) == -1 ? ( { - const array = openBackTrainInfo(i.station, trainData, i.dia); + const array = openBackTrainInfo(station, trainData, dia); if (!array) return; setTrainData(array); diff --git a/stateBox/useCurrentTrain.js b/stateBox/useCurrentTrain.js index 7a96cfb..73e91ac 100644 --- a/stateBox/useCurrentTrain.js +++ b/stateBox/useCurrentTrain.js @@ -38,7 +38,7 @@ export const CurrentTrainProvider = ({ children }) => { setCurrentTrainLoading("success"); }) .catch(() => { - alert("現在の全在線列車取得エラー/再取得します"); + //alert("現在の全在線列車取得エラー/再取得します"); fetch( "https://script.google.com/macros/s/AKfycby9Y2-Bm75J_WkbZimi7iS8v5r9wMa9wtzpdwES9sOGF4i6HIYEJOM60W6gM1gXzt1o/exec", HeaderConfig @@ -57,6 +57,9 @@ export const CurrentTrainProvider = ({ children }) => { }); }); }; + const inject = (i) => { + webview.current?.injectJavaScript(i); + }; useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得 @@ -72,6 +75,7 @@ export const CurrentTrainProvider = ({ children }) => { currentTrainLoading, setCurrentTrainLoading, getCurrentTrain, + inject, }} > {children}