ほぼすべての駅名標機能で内部ブラウザを利用できるように変更

This commit is contained in:
harukin-OneMix4 2023-06-18 03:08:13 +09:00
parent 320a94565d
commit a83bb27f60
3 changed files with 51 additions and 9 deletions

View File

@ -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 (
<ActionSheet
ref={StationBoardAcSR}
@ -86,13 +92,12 @@ export const StationDeteilView = (props) => {
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)}
/>
</View>
)}
@ -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={<Foundation name="web" color="white" size={50} />}
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={<FontAwesome name="table" color="white" size={50} />}
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={<Ionicons name="bus" color="white" size={50} />}
flex={1}
onPressButton={() => Linking.openURL(trainBus.address)}
onPressButton={() => {
navigate("howto", {
info: trainBus.address,
onExit,
});
StationBoardAcSR.current?.hide();
}}
onLongPressButton={() => Linking.openURL(trainBus.address)}
>
並行バス
</TicketBox>
@ -332,6 +364,7 @@ const 駅構内図 = (props) => {
margin: 2,
}}
onPress={props.oP}
onLongPress={props.oLP}
//onPress={() => setOpen(!open)}
>
<View style={{ flex: 1 }} />

View File

@ -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 (
<TouchableOpacity
style={{
@ -14,6 +21,7 @@ export const TicketBox = (props) => {
alignItems: "center",
}}
onPress={onPressButton}
onLongPress={onLongPressButton}
>
<Text style={{ color: "white", fontWeight: "bold", fontSize: 18 }}>
{children}

View File

@ -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 (
<TouchableOpacity style={styleSheet.外枠} onPress={oP}>
<TouchableOpacity style={styleSheet.外枠} onPress={oP} onLongPress={oLP}>
<StationNumberMaker currentStation={currentStation} />
<StationNameArea currentStation={currentStation} />
<TouchableOpacity