From 320a94565dca4fd358368cbe6701bcf9017b6def Mon Sep 17 00:00:00 2001 From: harukin-OneMix4 Date: Sat, 17 Jun 2023 23:40:11 +0900 Subject: [PATCH 1/2] =?UTF-8?q?PDF=E8=A1=A8=E7=A4=BA=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=82=92=E9=83=A8=E5=88=86=E5=AE=9F=E9=A8=93=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 9 +++++- Apps.js | 7 ++++- .../StationDeteilView.js | 23 ++++++++++++-- components/trainMenu.js | 6 +++- howto.js | 31 ++++++++++--------- menu.js | 5 +++ 6 files changed, 61 insertions(+), 20 deletions(-) diff --git a/App.js b/App.js index 028e4cf..0c5f388 100644 --- a/App.js +++ b/App.js @@ -194,7 +194,6 @@ const Top = ({ @@ -284,6 +283,14 @@ function MenuPage({ > {(props) => } + + {(props) => } + ); } diff --git a/Apps.js b/Apps.js index fc05805..df1dd6b 100644 --- a/Apps.js +++ b/Apps.js @@ -148,7 +148,7 @@ export default function Apps({ urlcache = event.url; if (event.url.includes("https://train.jr-shikoku.co.jp/usage.htm")) { - if (Platform.OS === "android") navigate("howto"); + if (Platform.OS === "android") navigate("howto", { info: event.url }); webview?.current.goBack(); //Actions.howto(); } else if ( @@ -224,6 +224,11 @@ export default function Apps({ favoriteStation={favoriteStation} setFavoriteStation={setFavoriteStation} busAndTrainData={busAndTrainData} + navigate={navigate} + onExit={() => { + StationBoardAcSR.current?.setModalVisible(); + navigate("Apps"); + }} /> ); diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index fbc4d17..876bdca 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -29,6 +29,8 @@ export const StationDeteilView = (props) => { favoriteStation, setFavoriteStation, busAndTrainData, + navigate, + onExit, } = props; const [trainBus, setTrainBus] = useState(); useEffect(() => { @@ -82,7 +84,15 @@ export const StationDeteilView = (props) => { originalStationList={originalStationList} favoriteStation={favoriteStation} setFavoriteStation={setFavoriteStation} - oP={() => Linking.openURL(currentStation[0].StationTimeTable)} + oP={() => { + navigate("howto", { + info: `https://docs.google.com/viewer?url=${encodeURI( + currentStation[0].StationTimeTable + )}&embedded=true`, + onExit, + }); + StationBoardAcSR.current?.hide(); + }} /> )} @@ -99,6 +109,15 @@ export const StationDeteilView = (props) => { currentStation[0].JrHpUrl && currentStation[0].StationNumber != "M12" && ( <駅構内図 //高松/阿波池田&後免&須崎kounai.png児島例外/ + oP={() => { + navigate("howto", { + info: + currentStation[0].JrHpUrl.replace("/index.html", "/") + + "/kounai_map.html", + onExit, + }); + StationBoardAcSR.current?.hide(); + }} uri={currentStation[0].JrHpUrl.replace("/index.html", "/")} /> )} @@ -312,7 +331,7 @@ const 駅構内図 = (props) => { alignItems: "center", margin: 2, }} - onPress={() => Linking.openURL(props.uri + "/kounai_map.html")} + onPress={props.oP} //onPress={() => setOpen(!open)} > diff --git a/components/trainMenu.js b/components/trainMenu.js index ed6af21..3069e1d 100644 --- a/components/trainMenu.js +++ b/components/trainMenu.js @@ -58,7 +58,11 @@ export default function TrainMenu({ backgroundColor={"#F89038"} icon="train-car" flex={1} - onPressButton={() => navigate("howto")} + onPressButton={() => + navigate("howto", { + info: "https://train.jr-shikoku.co.jp/usage.htm", + }) + } > 使い方 diff --git a/howto.js b/howto.js index feb5211..57f0475 100644 --- a/howto.js +++ b/howto.js @@ -2,21 +2,22 @@ const WEBVIEW = "WEBVIEW"; import React, { Component } from "react"; import { StatusBar, View, TouchableOpacity, Text } from "react-native"; import { WebView } from "react-native-webview"; -export default ({ navigation: { navigate } }) => ( - - - navigate("Apps")}> - - - 閉じる - - - - -); +export default ({ navigation: { navigate }, route }) => { + const { info, onExit = () => navigate("Apps") } = route.params; + + return ( + + + + + + 閉じる + + + + + ); +}; const styles = { View: { height: "100%", backgroundColor: "#0099CC" }, touch: { diff --git a/menu.js b/menu.js index 6653032..ff2b52d 100644 --- a/menu.js +++ b/menu.js @@ -218,6 +218,11 @@ export default function Menu(props) { favoriteStation={favoriteStation} setFavoriteStation={setFavoriteStation} busAndTrainData={busAndTrainData} + navigate={navigate} + onExit={() => { + StationBoardAcSR.current?.setModalVisible(); + navigate("menu"); + }} /> Date: Sun, 18 Jun 2023 03:08:13 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=81=BB=E3=81=BC=E3=81=99=E3=81=B9?= =?UTF-8?q?=E3=81=A6=E3=81=AE=E9=A7=85=E5=90=8D=E6=A8=99=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=81=A7=E5=86=85=E9=83=A8=E3=83=96=E3=83=A9=E3=82=A6=E3=82=B6?= =?UTF-8?q?=E3=82=92=E5=88=A9=E7=94=A8=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StationDeteilView.js | 47 ++++++++++++++++--- components/atom/TicketBox.js | 10 +++- components/駅名表/Sign.js | 3 +- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index 876bdca..b9dcc6e 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -43,7 +43,13 @@ export const StationDeteilView = (props) => { } setTrainBus(data[0]); }, [currentStation]); - + const info = + currentStation && + (currentStation[0].StationTimeTable.match(".pdf") + ? `https://docs.google.com/viewer?url=${encodeURI( + currentStation[0].StationTimeTable + )}&embedded=true` + : currentStation[0].StationTimeTable); return ( { setFavoriteStation={setFavoriteStation} oP={() => { navigate("howto", { - info: `https://docs.google.com/viewer?url=${encodeURI( - currentStation[0].StationTimeTable - )}&embedded=true`, + info, onExit, }); StationBoardAcSR.current?.hide(); }} + oLP={() => Linking.openURL(currentStation[0].StationTimeTable)} /> )} @@ -118,6 +123,12 @@ export const StationDeteilView = (props) => { }); StationBoardAcSR.current?.hide(); }} + oLP={() => { + Linking.openURL( + currentStation[0].JrHpUrl.replace("/index.html", "/") + + "/kounai_map.html" + ); + }} uri={currentStation[0].JrHpUrl.replace("/index.html", "/")} /> )} @@ -128,7 +139,14 @@ export const StationDeteilView = (props) => { backgroundColor={"#AD7FA8"} icon={} flex={1} - onPressButton={() => + onPressButton={() => { + navigate("howto", { + info: currentStation[0].JrHpUrl, + onExit, + }); + StationBoardAcSR.current?.hide(); + }} + onLongPressButton={() => Linking.openURL(currentStation[0].JrHpUrl) } > @@ -140,7 +158,14 @@ export const StationDeteilView = (props) => { backgroundColor={"#8F5902"} icon={} flex={1} - onPressButton={() => + onPressButton={() => { + navigate("howto", { + info, + onExit, + }); + StationBoardAcSR.current?.hide(); + }} + onLongPressButton={() => Linking.openURL(currentStation[0].StationTimeTable) } > @@ -164,7 +189,14 @@ export const StationDeteilView = (props) => { backgroundColor={"#CE5C00"} icon={} flex={1} - onPressButton={() => Linking.openURL(trainBus.address)} + onPressButton={() => { + navigate("howto", { + info: trainBus.address, + onExit, + }); + StationBoardAcSR.current?.hide(); + }} + onLongPressButton={() => Linking.openURL(trainBus.address)} > 並行バス @@ -332,6 +364,7 @@ const 駅構内図 = (props) => { margin: 2, }} onPress={props.oP} + onLongPress={props.oLP} //onPress={() => setOpen(!open)} > diff --git a/components/atom/TicketBox.js b/components/atom/TicketBox.js index 6d34b95..8fc3a33 100644 --- a/components/atom/TicketBox.js +++ b/components/atom/TicketBox.js @@ -1,7 +1,14 @@ import { TouchableOpacity, Text } from "react-native"; export const TicketBox = (props) => { - const { icon, backgroundColor, flex, onPressButton, children } = props; + const { + icon, + backgroundColor, + flex, + onPressButton, + children, + onLongPressButton, + } = props; return ( { alignItems: "center", }} onPress={onPressButton} + onLongPress={onLongPressButton} > {children} diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js index 7316205..943226a 100644 --- a/components/駅名表/Sign.js +++ b/components/駅名表/Sign.js @@ -21,6 +21,7 @@ export default function Sign(props) { currentStation, originalStationList, oP, + oLP, favoriteStation, setFavoriteStation, } = props; @@ -91,7 +92,7 @@ export default function Sign(props) { }; const lottieRef = useRef(); return ( - +