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 ( - +