diff --git a/App.js b/App.js index 4041b6e..b7cbed9 100644 --- a/App.js +++ b/App.js @@ -72,9 +72,8 @@ export function AppContainer() { gestureEnabled: true, tabBarIcon: initIcon("barchart", "AntDesign"), }} - > - {(props) => } - + component={Top} + /> - {(props) => } - + component={MenuPage} + /> + diff --git a/MenuPage.js b/MenuPage.js index a7b01f0..f37b537 100644 --- a/MenuPage.js +++ b/MenuPage.js @@ -13,13 +13,16 @@ import { optionData } from "./lib/stackOption.js"; import CurrentTrainListView from "./components/CurrentTrainListView.js"; import AllTrainDiagramView from "./components/AllTrainDiagramView.js"; import { useCurrentTrain } from "./stateBox/useCurrentTrain.js"; +import { useNavigation } from "@react-navigation/native"; const Stack = createStackNavigator(); -export function MenuPage({ navigation }) { +export function MenuPage() { const { favoriteStation, setFavoriteStation } = useFavoriteStation(); const { getCurrentTrain } = useCurrentTrain(); + const navigation = useNavigation(); + const { addListener } = navigation; useEffect(() => { - const unsubscribe = navigation.addListener("tabPress", (e) => { + const unsubscribe = addListener("tabPress", (e) => { AS.getItem("favoriteStation") .then((d) => { const returnData = JSON.parse(d); @@ -41,57 +44,29 @@ export function MenuPage({ navigation }) { gestureEnabled: true, headerTransparent: true, }} - > - {(props) => } - - - {(props) => } - + children={() => } + /> + - {(props) => } - + options={{ ...optionData, gestureResponseDistance: { vertical: 300 } }} + children={(props) => } + /> - {(props) => } - + options={{ ...optionData, gestureResponseDistance: { vertical: 300 } }} + component={CurrentTrainListView} + /> - {(props) => } - + options={{ ...optionData, gestureEnabled: false }} + component={AllTrainDiagramView} + /> - {(props) => } - + options={optionData} + children={(props) => } + /> ); } diff --git a/Top.js b/Top.js index 1d36df5..631d139 100644 --- a/Top.js +++ b/Top.js @@ -10,14 +10,12 @@ import HowTo from "./howto"; import News from "./components/news.js"; import TrainMenu from "./components/trainMenu.js"; import FavoriteList from "./components/FavoriteList.js"; -import { useFavoriteStation } from "./stateBox/useFavoriteStation"; import { optionData } from "./lib/stackOption.js"; -import { useCurrentTrain } from "./stateBox/useCurrentTrain.js"; +import { useNavigation } from "@react-navigation/native"; const Stack = createStackNavigator(); -export const Top = ({ navigation }) => { - const { favoriteStation, setFavoriteStation } = useFavoriteStation(); - const { webview, getCurrentTrain } = useCurrentTrain(); - +export const Top = () => { + const navigation = useNavigation(); + const { navigate, addListener } = navigation; //地図用 const [mapsStationData, setMapsStationData] = useState(undefined); @@ -26,9 +24,9 @@ export const Top = ({ navigation }) => { }, []); useEffect(() => { - const unsubscribe = navigation.addListener("tabLongPress", (e) => { - navigation.navigate("favoriteList"); - }); + const unsubscribe = addListener("tabLongPress", (e) => + navigate("favoriteList") + ); return unsubscribe; }, [navigation]); @@ -42,16 +40,8 @@ export const Top = ({ navigation }) => { gestureEnabled: true, headerTransparent: true, }} - > - {(props) => ( - - )} - + children={() => } + /> { gestureEnabled: true, ...TransitionPresets.SlideFromRightIOS, }} - > - {(props) => } - + component={TrainBase} + /> + + + + - {(props) => } - - - {(props) => } - - - {(props) => ( - - )} - + name="trainMenu" + options={optionData} + children={() => } + /> + - {(props) => ( - - )} - + children={() => } + /> ); }; diff --git a/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js b/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js new file mode 100644 index 0000000..c0a82f7 --- /dev/null +++ b/components/ActionSheetComponents/EachTrainInfo/ShowSpecialTrain.js @@ -0,0 +1,36 @@ +import { Text, TouchableOpacity } from "react-native"; +import React, { useState } from "react"; +export const ShowSpecialTrain = ({ + isTrainDataNothing, + setTrainData, + trainList, + trueTrainID, +}) => { + const replaceSpecialTrainDetail = (trainNum) => { + let TD = trainList[trainNum]; + if (!TD) return; + setTrainData(TD.split("#").filter((d) => d != "")); + }; + return ( + <> + {isTrainDataNothing && trueTrainID && ( + replaceSpecialTrainDetail(trueTrainID)} + style={{ + padding: 10, + flexDirection: "row", + borderColor: "blue", + borderWidth: 1, + margin: 10, + borderRadius: 5, + alignItems: "center", + }} + > + + 本来の列車情報を表示 + + + )} + + ); +}; diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 1f22c43..05b2662 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -5,6 +5,7 @@ import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientati import { getStationList2 } from "../../../lib/getStationList2"; import { useCurrentTrain } from "../../../stateBox/useCurrentTrain"; import { SheetManager } from "react-native-actions-sheet"; +import { useNavigation } from "@react-navigation/native"; export const TrainDataView = ({ currentTrainData, @@ -42,8 +43,11 @@ 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; diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 0752178..4275a4a 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useMemo, useState } from "react"; import { View, LayoutAnimation, @@ -9,7 +9,7 @@ import { BackHandler, } from "react-native"; import { Ionicons } from "@expo/vector-icons"; -import { SheetManager, useScrollHandlers } from "react-native-actions-sheet"; +import { SheetManager } from "react-native-actions-sheet"; import { AS } from "../../storageControl"; import trainList from "../../assets/originData/trainList"; import { lineList } from "../../lib/getStationList"; @@ -31,25 +31,25 @@ import { migrateTrainName } from "../../lib/eachTrainInfoCoreLib/migrateTrainNam import { getType } from "../../lib/eachTrainInfoCoreLib/getType"; import { searchSpecialTrain } from "../../lib/eachTrainInfoCoreLib/searchSpecialTrain"; import { openBackTrainInfo } from "../../lib/eachTrainInfoCoreLib/openBackTrainInfo"; +import { ShowSpecialTrain } from "./EachTrainInfo/ShowSpecialTrain"; +import { useNavigation } from "@react-navigation/native"; export const EachTrainInfoCore = ({ actionSheetRef, data, - navigate, originalStationList, openStationACFromEachTrainInfo, from, setTrainInfo, + navigate, }) => { // const [actionSheetHorizonalScroll, setActionSheetHorizonalScroll] = useState(false); - const { currentTrain } = useCurrentTrain(); const [currentTrainData, setCurrentTrainData] = useState(); // const [actionSheetHorizonalScroll, setActionSheetHorizonalScroll] = useState(false); useEffect(() => { - console.log(currentTrain.length); if (!currentTrain.length) return; setCurrentTrainData( checkDuplicateTrainData( @@ -69,7 +69,6 @@ export const EachTrainInfoCore = ({ ); return () => backHandler.remove(); }, []); - //bconst insets = useSafeAreaInsets(); const [headStation, setHeadStation] = useState([]); const [tailStation, setTailStation] = useState([]); @@ -80,9 +79,6 @@ export const EachTrainInfoCore = ({ const [trainPositionSwitch, setTrainPositionSwitch] = useState("false"); const [currentPosition, setCurrentPosition] = useState([]); const [trainData, setTrainData] = useState([]); - const scrollHandlers = actionSheetRef - ? useScrollHandlers("scrollview-1", actionSheetRef) - : null; const stationList = originalStationList && @@ -112,6 +108,28 @@ export const EachTrainInfoCore = ({ trainPositionSwitch == "true" ? findReversalPoints(currentPosition, stopStationIDList) : []; + const trainName = useMemo(() => { + if (!data.limited) return ""; + const limitedArray = data.limited.split(":"); + const type = getType(limitedArray[0]); + + switch (true) { + case limitedArray[1]: + // 特急の場合は、列車名を取得 + return type + migrateTrainName(limitedArray[1]); + case trainData.length == 0: + // 特急以外の場合は、列車番号を取得 + return type; + default: + // 行先がある場合は、行先を取得 + return ( + type + + migrateTrainName( + trainData[trainData.length - 1].split(",")[0] + "行き" + ) + ); + } + }, [data.limited, trainData]); const { height, width } = useWindowDimensions(); const { isLandscape } = useDeviceOrientationChange(); @@ -184,12 +202,6 @@ export const EachTrainInfoCore = ({ } }, [currentTrainData]); - const replaceSpecialTrainDetail = (trainNum) => { - let TD = trainList[trainNum]; - if (!TD) return; - setTrainData(TD.split("#").filter((d) => d != "")); - }; - useEffect(() => { //列車現在地アイコン表示スイッチ AS.getItem("trainPositionSwitch") @@ -254,15 +266,7 @@ export const EachTrainInfoCore = ({ )} - {data.limited - ? getType(data.limited.split(":")[0]) + - migrateTrainName( - data.limited.split(":")[1] || - (trainData.length > 0 - ? trainData[trainData.length - 1].split(",")[0] + "行き" - : " ") - ) - : ""} + {trainName} @@ -291,54 +295,31 @@ export const EachTrainInfoCore = ({ )} - ) : ( - - ) + } longHeader={ - from == "AllTrainDiagramView" || from == "NearTrainDiagramView" ? ( - <> - ) : ( - - ) + } topStickyContent={ @@ -374,31 +355,12 @@ export const EachTrainInfoCore = ({ <> ) )} - {/* - ほげほげふがふが */} - {trainData.length == 0 && trueTrainID && ( - replaceSpecialTrainDetail(trueTrainID)} - style={{ - padding: 10, - flexDirection: "row", - borderColor: "blue", - borderWidth: 1, - margin: 10, - borderRadius: 5, - alignItems: "center", - }} - > - - 本来の列車情報を表示 - - - )} + {trainData.map((i, index) => i.split(",")[1] == "提" ? ( diff --git a/components/AllTrainDiagramView.js b/components/AllTrainDiagramView.js index 9b122d2..8c2583d 100644 --- a/components/AllTrainDiagramView.js +++ b/components/AllTrainDiagramView.js @@ -1,30 +1,23 @@ -import React, { useRef, useState, useEffect } from "react"; +import React, { useState, useEffect } from "react"; import { View, Text, TouchableOpacity, - Linking, - ScrollView, FlatList, KeyboardAvoidingView, TextInput, Platform, Keyboard, } from "react-native"; -import MapView, { Marker } from "react-native-maps"; -import { MaterialCommunityIcons } from "@expo/vector-icons"; -import { useCurrentTrain } from "../stateBox/useCurrentTrain"; -import { useAreaInfo } from "../stateBox/useAreaInfo"; import { useAllTrainDiagram } from "../stateBox/useAllTrainDiagram"; import { customTrainDataDetector } from "./custom-train-data"; -import { getStationList, lineList } from "../lib/getStationList"; +import { getStationList } from "../lib/getStationList"; import { getTrainType } from "../lib/getTrainType"; -import { checkDuplicateTrainData } from "../lib/checkDuplicateTrainData"; import { SheetManager } from "react-native-actions-sheet"; -export default function AllTrainDiagramView({ navigation: { navigate } }) { - const { currentTrain } = useCurrentTrain(); - const { areaInfo } = useAreaInfo(); +import { useNavigation } from "@react-navigation/native"; +export default function AllTrainDiagramView() { + const { navigate } = useNavigation(); const { allTrainDiagram } = useAllTrainDiagram(); const [originalStationList, setOriginalStationList] = useState(); // 第一要素 const [keyList, setKeyList] = useState(); // 第二要素 diff --git a/components/CurrentTrainListView.js b/components/CurrentTrainListView.js index cc5f880..72a6a1d 100644 --- a/components/CurrentTrainListView.js +++ b/components/CurrentTrainListView.js @@ -3,7 +3,9 @@ import { View, Text, TouchableOpacity, Linking } from "react-native"; import MapView, { Marker } from "react-native-maps"; import { MaterialCommunityIcons } from "@expo/vector-icons"; import { useCurrentTrain } from "../stateBox/useCurrentTrain"; -export default function CurrentTrainListView({ navigation: { navigate } }) { +import { useNavigation } from "@react-navigation/native"; +export default function CurrentTrainListView() { + const { navigate } = useNavigation(); const { currentTrain } = useCurrentTrain(); return ( diff --git a/components/DynamicHeaderScrollView.js b/components/DynamicHeaderScrollView.js index 82b9353..e6f652b 100644 --- a/components/DynamicHeaderScrollView.js +++ b/components/DynamicHeaderScrollView.js @@ -1,22 +1,39 @@ import { ScrollView, View, Animated, LayoutAnimation } from "react-native"; -import React, { useState } from "react"; +import React, { useMemo, useState } from "react"; +import { useScrollHandlers } from "react-native-actions-sheet"; export const DynamicHeaderScrollView = (props) => { const { - Max_Header_Height = 200, - Min_Header_Height = 80, children, - scrollViewProps = {}, + actionSheetRef = {}, containerProps = {}, shortHeader = <>, longHeader = <>, topStickyContent, styles, + from, } = props; + const viewHeader = useMemo(() => { + switch (from) { + case "AllTrainDiagramView": + case "NearTrainDiagramView": + case "LED2": + return true; + default: + return false; + } + }, [from]); + + const Max_Header_Height = viewHeader ? 0 : 200; + const Min_Header_Height = viewHeader ? 0 : 80; + const Scroll_Distance = Max_Header_Height - Min_Header_Height; - const [headerVisible, setHeaderVisible] = useState(false); + const scrollHandlers = actionSheetRef + ? useScrollHandlers("scrollview-1", actionSheetRef) + : null; + const shotHeaderStyle = { on: { height: Min_Header_Height, @@ -67,6 +84,18 @@ export const DynamicHeaderScrollView = (props) => { }, }; + const [headerVisible, setHeaderVisible] = useState(false); + + const onScroll = (event) => { + const scrollY = event.nativeEvent.contentOffset.y; + if (Scroll_Distance < scrollY == headerVisible) return; + LayoutAnimation.configureNext({ + duration: 100, + update: { type: "easeOut" }, + }); + setHeaderVisible(Scroll_Distance < scrollY); + }; + return ( @@ -76,7 +105,7 @@ export const DynamicHeaderScrollView = (props) => { headerVisible ? shotHeaderStyle.on : shotHeaderStyle.off, ]} > - {shortHeader} + {viewHeader ? <> : shortHeader} { headerVisible ? longHeaderStyle.off : longHeaderStyle.on, ]} > - {longHeader} + {viewHeader ? <> : longHeader} {topStickyContent} { - const scrollY = event.nativeEvent.contentOffset.y; - LayoutAnimation.configureNext({ - duration: 100, - update: { type: "easeOut" }, - }); - setHeaderVisible(Scroll_Distance < scrollY); - }} + onScroll={onScroll} > - + {topStickyContent && ( diff --git a/components/Menu/FixedContentBottom.js b/components/Menu/FixedContentBottom.js new file mode 100644 index 0000000..f7c2bc0 --- /dev/null +++ b/components/Menu/FixedContentBottom.js @@ -0,0 +1,314 @@ +import { Linking, Text, View, TouchableOpacity } from "react-native"; +import { + Foundation, + FontAwesome, + Ionicons, + MaterialCommunityIcons, +} from "@expo/vector-icons"; +import Icon from "react-native-vector-icons/Entypo"; +import { TextBox } from "../atom/TextBox"; +import { TicketBox } from "../atom/TicketBox"; +import { ListItem } from "native-base"; + +export const FixedContentBottom = (props) => { + return ( + <> + {props.children} + + + } + flex={1} + onPressButton={() => + Linking.openURL("https://www.jr-eki.com/ticket/brand") + } + > + トクトク切符 + + } + flex={1} + onPressButton={() => + Linking.openURL( + "https://www.jr-shikoku.co.jp/01_trainbus/event_train/sp/" + ) + } + > + 観光列車 + + } + flex={1} + onPressButton={() => + Linking.openURL("https://www.jr-eki.com/tour/brand") + } + > + 旅行ツアー + + + + Linking.openURL("https://www.jr-eki.com/smart-eki/index.html") + } + > + + スマートえきちゃん + + + JR四国のチケットレススマホアプリです。 + + + + Linking.openURL("https://www.jr-shikoku.co.jp/sp/index.html#menu-box") + } + > + + 臨時列車などのお知らせ + + + 区間縮小・計画運休・イベント・季節臨時列車など + + + + Linking.openURL("https://www.jr-shikoku.co.jp/03_news/press/") + } + > + + ニュースリリース + + + 公式プレス記事はこちら + + + + Linking.openURL("https://www.jr-shikoku.co.jp/teiki/") + } + > + + 定期運賃計算 + + + 通常/学生/快て〜き等はこちら + + + + Linking.openURL("https://www.jr-shikoku.co.jp/04_company/group/sp/") + } + > + + JR四国のお店・サービス + + + JR四国グループの施設をご案内 + + + + Linking.openURL("https://www.jr-odekake.net/smt/")} + > + + 時刻・運賃計算 + + + (マイ・ダイヤ) + + + + マイ・ダイヤはJR西日本提供のサービスです。 + + + Linking.openURL("tel:0570-00-4592")} + > + + JR四国案内センター + + + 0570-00-4592 + (8:00~20:00 年中無休) + (通話料がかかります) + + + + + + + JR四国公式Twitter一族 + + + + {[ + { + url: "https://twitter.com/jr_shikoku_info", + name: "JR四国列車運行情報", + }, + + { + url: "https://twitter.com/JRshikoku_eigyo", + name: "JR四国営業部【公式】", + }, + { + url: "https://twitter.com/JRshikoku_tokyo", + name: "JR四国 東京営業情報【公式】", + }, + { + url: "https://twitter.com/JRshikoku_osaka", + name: "JR四国 大阪営業部【公式】", + }, + { + url: "https://twitter.com/jrs_matsuyama", + name: "JR四国 松山駅 【公式】", + }, + { + url: "https://twitter.com/jrshikoku_kochi", + name: "JR四国 高知駅【公式】", + }, + { + url: "https://twitter.com/jr_tokust", + name: "JR四国 徳島駅【公式】", + }, + { + url: "https://twitter.com/jrshikoku_uwjm", + name: "JR四国 宇和島駅【公式】", + }, + { + url: "https://twitter.com/jrshikoku_wkama", + name: "JR四国 ワープ高松支店【公式】", + }, + { + url: "https://twitter.com/JRshikoku_wkoch", + name: "JR四国 ワープ高知支店【公式】", + }, + { + url: "https://twitter.com/Yoakemonogatari", + name: "志国土佐 時代の夜明けのものがたり【公式】", + }, + { + url: "https://twitter.com/Smile_Eki_Chan", + name: "すまいるえきちゃん♡JR四国【公式】", + }, + { + url: "https://twitter.com/sper_ponchan", + name: "しこくたぬきのぽんちゃん 【四国家サポーターズクラブ】", + }, + ].map((d) => ( + Linking.openURL(d.url)}> + {d.name} + + + + ))} + + + 上級者向け機能 + props.navigate("AllTrainIDList")} + > + + 列番探索 + + + データベースに存在する全列車のダイヤを探索 + + + + このアプリについて + + + このアプリはXprocess(HARUKIN)が製作しているJR四国の完全非公式アシストアプリケーションです。このアプリに関することでのJR四国公式へ問合せすることはお控えください。以下のTwitterよりお願いします。 + + + + Linking.openURL("https://twitter.com/Xprocess_main") + } + > + + XprocessのTwitter + + + 制作運営のTwitterです。 + + + props.navigate("setting")} + > + + アプリの設定 + + + アプリの設定画面を表示します。 + + + {/* + */} + + ); +}; diff --git a/components/Menu/TitleBar.js b/components/Menu/TitleBar.js new file mode 100644 index 0000000..e8672a6 --- /dev/null +++ b/components/Menu/TitleBar.js @@ -0,0 +1,19 @@ +import { View, TouchableOpacity, Linking } from "react-native"; +import AutoHeightImage from "react-native-auto-height-image"; +import { widthPercentageToDP as wp } from "react-native-responsive-screen"; + +export const TitleBar = () => { + return ( + + Linking.openURL("https://www.jr-shikoku.co.jp")} + > + + + + ); +}; diff --git a/components/news.js b/components/news.js index 0b95e3b..f0ac12c 100644 --- a/components/news.js +++ b/components/news.js @@ -4,11 +4,10 @@ import { WebView } from "react-native-webview"; import StatusbarDetect from "../StatusbarDetect"; import { AS } from "../storageControl"; import { news } from "../config/newsUpdate"; +import { useNavigation } from "@react-navigation/native"; var Status = StatusbarDetect(); -export default function News(props) { - const { - navigation: { navigate }, - } = props; +export default function News() { + const { navigate } = useNavigation(); return ( { - // EachTrainInfoAsSR.current?.hide(); - // const findStationEachLine = (selectLine) => { - // let NearStation = selectLine.filter((d) => d.Station_JP == stationName); - // return NearStation; - // }; - // let returnDataBase = lineList - // .map((d) => findStationEachLine(originalStationList[d])) - // .filter((d) => d.length > 0) - // .reduce((pre, current) => { - // pre.push(...current); - // return pre; - // }, []); - // if (returnDataBase.length) { - // setStationBoardData(returnDataBase); - // sleep(30, function () { - // StationBoardAcSR.current?.show(); - // }); - // } else { - // setStationBoardData(undefined); - // StationBoardAcSR.current?.hide(); - // } - }; return ( - + {originalStationList.length != 0 && allStationData.length != 0 && ( {}} /> )} @@ -254,22 +220,6 @@ export default function Menu(props) { ); } -const TitleBar = () => { - return ( - - Linking.openURL("https://www.jr-shikoku.co.jp")} - > - - - - ); -}; - const TopMenuButton = () => { const buttonList = [ { @@ -418,313 +368,3 @@ const JRSTraInfoBox = () => { ); }; - -const FixedContentTop = () => { - return ( - <> - - - ); -}; -const FixedContentBottom = (props) => { - return ( - <> - {props.children} - - - } - flex={1} - onPressButton={() => - Linking.openURL("https://www.jr-eki.com/ticket/brand") - } - > - トクトク切符 - - } - flex={1} - onPressButton={() => - Linking.openURL( - "https://www.jr-shikoku.co.jp/01_trainbus/event_train/sp/" - ) - } - > - 観光列車 - - } - flex={1} - onPressButton={() => - Linking.openURL("https://www.jr-eki.com/tour/brand") - } - > - 旅行ツアー - - - - Linking.openURL("https://www.jr-eki.com/smart-eki/index.html") - } - > - - スマートえきちゃん - - - JR四国のチケットレススマホアプリです。 - - - - Linking.openURL("https://www.jr-shikoku.co.jp/sp/index.html#menu-box") - } - > - - 臨時列車などのお知らせ - - - 区間縮小・計画運休・イベント・季節臨時列車など - - - - Linking.openURL("https://www.jr-shikoku.co.jp/03_news/press/") - } - > - - ニュースリリース - - - 公式プレス記事はこちら - - - - Linking.openURL("https://www.jr-shikoku.co.jp/teiki/") - } - > - - 定期運賃計算 - - - 通常/学生/快て〜き等はこちら - - - - Linking.openURL("https://www.jr-shikoku.co.jp/04_company/group/sp/") - } - > - - JR四国のお店・サービス - - - JR四国グループの施設をご案内 - - - - Linking.openURL("https://www.jr-odekake.net/smt/")} - > - - 時刻・運賃計算 - - - (マイ・ダイヤ) - - - - マイ・ダイヤはJR西日本提供のサービスです。 - - - Linking.openURL("tel:0570-00-4592")} - > - - JR四国案内センター - - - 0570-00-4592 - (8:00~20:00 年中無休) - (通話料がかかります) - - - - - - - JR四国公式Twitter一族 - - - - {[ - { - url: "https://twitter.com/jr_shikoku_info", - name: "JR四国列車運行情報", - }, - - { - url: "https://twitter.com/JRshikoku_eigyo", - name: "JR四国営業部【公式】", - }, - { - url: "https://twitter.com/JRshikoku_tokyo", - name: "JR四国 東京営業情報【公式】", - }, - { - url: "https://twitter.com/JRshikoku_osaka", - name: "JR四国 大阪営業部【公式】", - }, - { - url: "https://twitter.com/jrs_matsuyama", - name: "JR四国 松山駅 【公式】", - }, - { - url: "https://twitter.com/jrshikoku_kochi", - name: "JR四国 高知駅【公式】", - }, - { - url: "https://twitter.com/jr_tokust", - name: "JR四国 徳島駅【公式】", - }, - { - url: "https://twitter.com/jrshikoku_uwjm", - name: "JR四国 宇和島駅【公式】", - }, - { - url: "https://twitter.com/jrshikoku_wkama", - name: "JR四国 ワープ高松支店【公式】", - }, - { - url: "https://twitter.com/JRshikoku_wkoch", - name: "JR四国 ワープ高知支店【公式】", - }, - { - url: "https://twitter.com/Yoakemonogatari", - name: "志国土佐 時代の夜明けのものがたり【公式】", - }, - { - url: "https://twitter.com/Smile_Eki_Chan", - name: "すまいるえきちゃん♡JR四国【公式】", - }, - { - url: "https://twitter.com/sper_ponchan", - name: "しこくたぬきのぽんちゃん 【四国家サポーターズクラブ】", - }, - ].map((d) => ( - Linking.openURL(d.url)}> - {d.name} - - - - ))} - - - 上級者向け機能 - props.navigate("AllTrainIDList")} - > - - 列番探索 - - - データベースに存在する全列車のダイヤを探索 - - - - このアプリについて - - - このアプリはXprocess(HARUKIN)が製作しているJR四国の完全非公式アシストアプリケーションです。このアプリに関することでのJR四国公式へ問合せすることはお控えください。以下のTwitterよりお願いします。 - - - - Linking.openURL("https://twitter.com/Xprocess_main") - } - > - - XprocessのTwitter - - - 制作運営のTwitterです。 - - - props.navigate("setting")} - > - - アプリの設定 - - - アプリの設定画面を表示します。 - - - {/* - */} - - ); -}; diff --git a/ndView.js b/ndView.js index 0010ba7..a492387 100644 --- a/ndView.js +++ b/ndView.js @@ -5,7 +5,10 @@ import Constants from "expo-constants"; import { Ionicons } from "@expo/vector-icons"; export default function tndView() { const webview = useRef(); - const [LoadError, setLoadError] = useState(false); + const jsa = ` + document.querySelector('.sitettl').style.display = 'none'; + document.querySelector('.attention').style.display = 'none'; + `; return ( { - //webViewの再読み込みを行う - this.webView.reload(); - }} + onError={() => this.webView?.reload()} /> webview.current.reload()} + onPress={() => webview.current?.reload()} top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} - LoadError={LoadError} /> ); } -const jsa = ` -document.querySelector('.sitettl').style.display = 'none'; -document.querySelector('.attention').style.display = 'none'; -`; const ReloadButton = ({ onPress, top, mapSwitch, LoadError = false }) => { const styles = { - touch: { - position: "absolute", - top, - right: 10, - width: 50, - height: 50, - backgroundColor: LoadError ? "red" : "#0099CC", - borderColor: "white", - borderStyle: "solid", - borderWidth: 1, - borderRadius: 50, - alignContent: "center", - alignSelf: "center", - alignItems: "center", - display: mapSwitch, - }, - text: { - textAlign: "center", - width: "auto", - height: "auto", - textAlignVertical: "center", - fontWeight: "bold", - color: "white", - }, + position: "absolute", + top, + right: 10, + width: 50, + height: 50, + backgroundColor: LoadError ? "red" : "#0099CC", + borderColor: "white", + borderStyle: "solid", + borderWidth: 1, + borderRadius: 50, + alignContent: "center", + alignSelf: "center", + alignItems: "center", + display: mapSwitch, }; return ( - + diff --git a/trainbaseview.js b/trainbaseview.js index d024ee3..8b85031 100644 --- a/trainbaseview.js +++ b/trainbaseview.js @@ -8,10 +8,11 @@ import { } from "react-native"; import { WebView } from "react-native-webview"; import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; +import { useNavigation } from "@react-navigation/native"; -export default function TrainBase({ route, navigation }) { +export default function TrainBase({ route }) { const { info, from } = route.params; - const { navigate } = navigation; + const { navigate } = useNavigation(); const webview = useRef(); const jss = `document.getElementById('Footer').style.display = 'none'; ${