From aa0daeb791e34485a091cdc2ba93a156240b1ed1 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 26 Mar 2024 05:21:16 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E3=83=9E=E3=83=83=E3=83=97=E3=81=AE?= =?UTF-8?q?=E3=83=A1=E3=83=A2=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/trainMenu.js | 58 ++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/components/trainMenu.js b/components/trainMenu.js index 3702c6f..f1b7abc 100644 --- a/components/trainMenu.js +++ b/components/trainMenu.js @@ -1,4 +1,4 @@ -import React, { useRef } from "react"; +import React, { useRef, useMemo } from "react"; import { View, Text, TouchableOpacity, Linking } from "react-native"; import MapView, { Marker } from "react-native-maps"; import { MaterialCommunityIcons } from "@expo/vector-icons"; @@ -9,6 +9,35 @@ export default function TrainMenu({ style, }) { const mapRef = useRef(); + const stationPin = useMemo( + () => + Object.keys(stationData).map((d, indexBase) => + stationData[d].map((D, index) => { + if (!D.StationMap) return null; + const latlng = D.StationMap.replace( + "https://www.google.co.jp/maps/place/", + "" + ).split(","); + if (latlng.length == 0) return null; + return ( + { + webview.current?.injectJavaScript( + `MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')` + ); + if (navigate) navigate("Apps"); + }} + > + ); + }) + ), + [stationData] + ); return ( - {stationData && - Object.keys(stationData).map((d) => - stationData[d].map((D, index) => { - if (!D.StationMap) return null; - const latlng = D.StationMap.replace( - "https://www.google.co.jp/maps/place/", - "" - ).split(","); - if (latlng.length == 0) return null; - return ( - { - webview.current?.injectJavaScript( - `MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')` - ); - if (navigate) navigate("Apps"); - }} - > - ); - }) - )} + {stationPin} {navigate && ( From 07345755c7f5e3ecfebdaa57c6a8b74a364e4390 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 26 Mar 2024 05:21:32 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E8=A1=A8=E7=A4=BA=E6=A9=9F=E8=83=BD=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 8 ++++---- Top.js | 30 ++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/App.js b/App.js index 4041b6e..b7becd9 100644 --- a/App.js +++ b/App.js @@ -57,10 +57,10 @@ export default function App() { ); } export function AppContainer() { - const { areaInfo, setAreaInfo } = useAreaInfo(); - + const { areaInfo } = useAreaInfo(); + const navigationRef = React.useRef(); return ( - + @@ -73,7 +73,7 @@ export function AppContainer() { tabBarIcon: initIcon("barchart", "AntDesign"), }} > - {(props) => } + {(props) => } { - const { favoriteStation, setFavoriteStation } = useFavoriteStation(); +export const Top = ({ navigation, navigationRef }) => { const { webview, getCurrentTrain } = useCurrentTrain(); //地図用 @@ -24,14 +24,36 @@ export const Top = ({ navigation }) => { useEffect(() => { getStationList2().then(setMapsStationData); }, []); + const [mapSwitch, setMapSwitch] = React.useState("false"); + const ASCore = ({ k, s, d }) => + AS.getItem(k) + .then((d) => (d ? s(d) : AS.setItem(k, d))) + .catch(() => AS.setItem(k, d)); + useEffect(() => { + //地図スイッチ + ASCore({ k: "mapSwitch", s: setMapSwitch, d: "false" }); + }, []); useEffect(() => { - const unsubscribe = navigation.addListener("tabLongPress", (e) => { + const unsubscribe = navigation.addListener("tabLongPress", () => { navigation.navigate("favoriteList"); }); - return unsubscribe; }, [navigation]); + useEffect(() => { + const unsubscribe = navigation.addListener("tabPress", () => { + if (navigationRef.current?.getCurrentRoute().name == "Apps") { + if (mapSwitch == "true") { + navigation.navigate("trainMenu"); + } else { + webview.current?.injectJavaScript(`AccordionClassEvent()`); + } + } else { + navigation.navigate("Apps"); + } + }); + return unsubscribe; + }, [navigation, mapSwitch]); return ( From b12f4a4fbbf7a10ac5fcd1be6ca8bf14e0c7a54b Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 26 Mar 2024 12:44:00 +0000 Subject: [PATCH 3/3] =?UTF-8?q?iOS=E3=81=A0=E3=81=91=E3=83=87=E3=83=BC?= =?UTF-8?q?=E3=82=BF=E3=81=AE=E6=9B=B4=E6=96=B0=E3=82=92=E5=8D=B3=E6=99=82?= =?UTF-8?q?=E3=81=AB=E5=AE=9F=E8=A1=8C=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActionSheetComponents/EachTrainInfo/TrainDataView.js | 9 ++++++--- components/FavoriteList.js | 3 ++- components/trainMenu.js | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 1f22c43..85c65ec 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -42,13 +42,16 @@ export const TrainDataView = ({ if (x.StationNumber == currentPosition[0]) test.push({ line: d, station: x }); }); - if(currentPosition[0]== "M12"){ - test.push({ line: "seto", station: {Station_JP: "児島", MyStation: "0"}}); + if (currentPosition[0] == "M12") { + test.push({ + line: "seto", + station: { Station_JP: "児島", MyStation: "0" }, + }); } }); if (!test.length) return; webview.current?.injectJavaScript( - `MoveDisplayStation('${test[0].line}_${test[0].station.MyStation}_${test[0].station.Station_JP}')` + `MoveDisplayStation('${test[0].line}_${test[0].station.MyStation}_${test[0].station.Station_JP}');setStrings();` ); navigate("Apps"); SheetManager.hide("EachTrainInfo"); diff --git a/components/FavoriteList.js b/components/FavoriteList.js index 4888e48..548119f 100644 --- a/components/FavoriteList.js +++ b/components/FavoriteList.js @@ -39,7 +39,8 @@ export default function FavoriteList({ navigation, webview, stationData }) { const lineName = getStationLine(currentStation[0]); webview.current?.injectJavaScript( - `MoveDisplayStation('${lineName}_${currentStation[0].MyStation}_${currentStation[0].Station_JP}')` + `MoveDisplayStation('${lineName}_${currentStation[0].MyStation}_${currentStation[0].Station_JP}'); + setStrings();` ); navigate("Apps"); }} diff --git a/components/trainMenu.js b/components/trainMenu.js index f1b7abc..fbc4982 100644 --- a/components/trainMenu.js +++ b/components/trainMenu.js @@ -28,7 +28,8 @@ export default function TrainMenu({ }} onPress={() => { webview.current?.injectJavaScript( - `MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}')` + `MoveDisplayStation('${d}_${D.MyStation}_${D.Station_JP}'); + setStrings();` ); if (navigate) navigate("Apps"); }}