import React, { useEffect, useState } from "react"; import { View, Linking } from "react-native"; import { FontAwesome, Foundation, Ionicons } from "@expo/vector-icons"; import ActionSheet from "react-native-actions-sheet"; import Sign from "../../components/駅名表/Sign"; import { TicketBox } from "../atom/TicketBox"; import { widthPercentageToDP as wp, heightPercentageToDP as hp, } from "react-native-responsive-screen"; export const StationDeteilView = (props) => { const { StationBoardAcSR, currentStation, originalStationList, favoriteStation, setFavoriteStation, busAndTrainData, } = props; const [trainBus, setTrainBus] = useState(); useEffect(() => { if (!currentStation) return () => {}; const data = busAndTrainData.filter((d) => { return d.name === currentStation[0].Station_JP; }); if (data.length == 0) { setTrainBus(); return () => {}; } setTrainBus(data[0]); }, [currentStation]); return ( } > {currentStation && ( Linking.openURL(currentStation[0].StationTimeTable)} /> )} {currentStation && ( {!currentStation[0].JrHpUrl || ( } flex={1} onPressButton={() => Linking.openURL(currentStation[0].JrHpUrl) } > web )} {!currentStation[0].StationTimeTable || ( } flex={1} onPressButton={() => Linking.openURL(currentStation[0].StationTimeTable) } > 時刻表 )} {!currentStation[0].StationMap || ( } flex={1} onPressButton={() => Linking.openURL(currentStation[0].StationMap) } > Map )} {!trainBus || ( } flex={1} onPressButton={() => Linking.openURL(trainBus.address)} > 平行バス )} )} ); };