diff --git a/Top.js b/Top.js index 184dd2a..bde8d8d 100644 --- a/Top.js +++ b/Top.js @@ -21,12 +21,8 @@ export const Top = ({ navigationRef }) => { const { navigate, addListener } = useNavigation(); //地図用 - const { setMapsStationData, injectJavaScript, setInjectJavaScript } = - useTrainMenu(); + const { injectJavaScript, setInjectJavaScript } = useTrainMenu(); - useEffect(() => { - getStationList2().then(setMapsStationData); - }, []); const [mapSwitch, setMapSwitch] = React.useState("false"); useEffect(() => { @@ -34,7 +30,6 @@ export const Top = ({ navigationRef }) => { ASCore({ k: "mapSwitch", s: setMapSwitch, d: "false" }); }, []); - const goToFavoriteList = () => navigate("favoriteList"); useEffect(() => { @@ -42,7 +37,6 @@ export const Top = ({ navigationRef }) => { return unsubscribe; }, [{ navigate, addListener }]); - const goToTrainMenu = () => { if (navigationRef.current?.getCurrentRoute().name == "Apps") { if (mapSwitch == "true") { diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 5c334dc..645fac0 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -34,6 +34,7 @@ import { searchSpecialTrain } from "../../lib/eachTrainInfoCoreLib/searchSpecial import { openBackTrainInfo } from "../../lib/eachTrainInfoCoreLib/openBackTrainInfo"; import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain"; import { useStationList } from "../../stateBox/useStationList"; +import { HeaderText } from "./EachTrainInfoCore/HeaderText"; export const EachTrainInfoCore = ({ actionSheetRef, @@ -278,36 +279,16 @@ export const EachTrainInfoCore = ({ /> )} - - - {trainName} - - - - {showHeadStation.map((d) => `${headStation[d].id} + `)} - {data.trainNum} - {showTailStation.map((d) => ` + ${tailStation[d].id}`)} - - - {data.limited != undefined && - getType(data.limited.split(":")[0]) && - !data.limited.split(":")[1].match("サンポート") && ( - { - LayoutAnimation.easeInEaseOut(); //setLoadingDelayData(true); - navigate("trainbase", { - info: "train.html?tn=" + data.trainNum, - from, - }); - SheetManager.hide("EachTrainInfo"); - }} - /> - )} - + ); } -const NewMenu = ({ LoadError }) => { - const { webview } = useCurrentTrain(); - const { width } = useWindowDimensions(); - return ( - - { - webview.current?.injectJavaScript(`AccordionClassEvent()`); - }} - > - <> - - - - - - - メニュー - - - - - Updates.reloadAsync()} - style={{ - width: 54, - height: 54, - backgroundColor: LoadError ? "red" : "#0099CC", - borderColor: "white", - borderStyle: "solid", - borderWidth: 1, - alignContent: "center", - alignSelf: "center", - alignItems: "center", - }} - > - - - - - - ); -}; -const MapsButton = ({ onPress, mapSwitch }) => { - const styles = { - touch: { - position: "absolute", - top, - left: 10, - width: 50, - height: 50, - backgroundColor: "#0099CC", - borderColor: "white", - borderStyle: "solid", - borderWidth: 1, - borderRadius: 50, - alignContent: "center", - alignSelf: "center", - alignItems: "center", - display: mapSwitch, - }, - text: { - textAlign: "center", - width: "auto", - height: "auto", - textAlignVertical: "center", - fontWeight: "bold", - color: "white", - fontSize: 20, - }, - }; - return ( - - - - - - ); -}; - -const LandscapeBackButton = ({ onPress }) => { - const styles = { - touch: { - position: "absolute", - left: 10, - width: 50, - height: 50, - backgroundColor: "#0099CC", - borderColor: "white", - borderStyle: "solid", - borderWidth: 1, - borderRadius: 50, - alignContent: "center", - alignSelf: "center", - alignItems: "center", - display: "flex", - }, - text: { - textAlign: "center", - width: "auto", - height: "auto", - textAlignVertical: "center", - fontWeight: "bold", - color: "white", - }, - }; - return ( - - - - - - ); -}; - -const ReloadButton = ({ onPress, mapSwitch, LoadError = false, right }) => { - const styles = { - touch: { - position: "absolute", - top, - right: 10 + right, - width: 50, - height: 50, - backgroundColor: LoadError ? "red" : "#0099CC", - borderColor: "white", - borderStyle: "solid", - borderWidth: 1, - borderRadius: 50, - alignContent: "center", - alignSelf: "center", - alignItems: "center", - display: mapSwitch, - }, - text: { - textAlign: "center", - width: "auto", - height: "auto", - textAlignVertical: "center", - fontWeight: "bold", - color: "white", - }, - }; - return ( - - - - - - ); -}; diff --git a/stateBox/useTrainMenu.js b/stateBox/useTrainMenu.js index efbc979..ca42c26 100644 --- a/stateBox/useTrainMenu.js +++ b/stateBox/useTrainMenu.js @@ -1,4 +1,5 @@ -import React, { createContext, useContext, useState } from "react"; +import React, { createContext, useContext, useState, useEffect } from "react"; +import { getStationList2 } from "../lib/getStationList2"; const initialState = { selectedLine: undefined, setSelectedLine: () => {}, @@ -18,6 +19,10 @@ export const TrainMenuProvider = ({ children }) => { const [selectedLine, setSelectedLine] = useState(undefined); const [mapsStationData, setMapsStationData] = useState(undefined); const [injectJavaScript, setInjectJavaScript] = useState(); + + useEffect(() => { + getStationList2().then(setMapsStationData); + }, []); return (