diff --git a/Apps.js b/Apps.js index 3310aed..fbb2fec 100644 --- a/Apps.js +++ b/Apps.js @@ -8,6 +8,7 @@ import { } from "react-native"; import { WebView } from "react-native-webview"; import Constants from "expo-constants"; +import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; import { AS } from "./storageControl"; import { news } from "./config/newsUpdate"; import { getStationList, lineList } from "./lib/getStationList"; @@ -192,6 +193,10 @@ export default function Apps(props) { top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} mapSwitch={mapSwitch == "true" ? "flex" : "none"} /> + webview.current.reload()} + top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} + /> { ); }; + +const ReloadButton = ({ onPress, top, mapSwitch }) => { + const styles = { + touch: { + position: "absolute", + top, + right: 10, + width: 50, + height: 50, + backgroundColor: "#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", + }, + }; + return ( + + + + + + ); +}; diff --git a/components/発車時刻表/LED_vidion.js b/components/発車時刻表/LED_vidion.js index ce30a62..26bbdb1 100644 --- a/components/発車時刻表/LED_vidion.js +++ b/components/発車時刻表/LED_vidion.js @@ -2,6 +2,8 @@ import React, { useState, useEffect } from "react"; import { View, Text, TouchableOpacity } from "react-native"; import { Switch } from "react-native-elements"; import { widthPercentageToDP as wp } from "react-native-responsive-screen"; +import LottieView from "lottie-react-native"; +import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; import { customTrainDataDetector } from "../custom-train-data"; import { useInterval } from "../../lib/useInterval"; import trainList from "../../assets/originData/trainList"; @@ -47,6 +49,7 @@ export default function LED_vision(props) { const [trainDiagram, setTrainDiagram] = useState(null); // 全列車のダイヤを列番ベースで整理 const [stationDiagram, setStationDiagram] = useState({}); //当該駅の全時刻表 const [currentTrain, setCurrentTrain] = useState(null); //現在在線中の全列車 + const [currentTrainLoading, setCurrentTrainLoading] = useState("loading"); const [finalSwitch, setFinalSwitch] = useState(false); const [trainIDSwitch, setTrainIDSwitch] = useState(false); const [trainDescriptionSwitch, setTrainDescriptionSwitch] = useState(false); @@ -104,9 +107,13 @@ export default function LED_vision(props) { .then((d) => d.map((x) => ({ num: x.TrainNum, delay: x.delay, Pos: x.Pos })) ) - .then(setCurrentTrain) + .then((d) => { + setCurrentTrain(d); + setCurrentTrainLoading("success"); + }) .catch((e) => { - console.log(e); + console.log("えらー"); + setCurrentTrainLoading("error"); }); useEffect(getCurrentTrain, []); //初回だけ現在の全在線列車取得 @@ -191,7 +198,11 @@ export default function LED_vision(props) { marginHorizontal: wp("1%"), }} > -
+
{selectedTrain.map((d, index) => ( ); } -const Header = () => ( +const Header = ({ + currentTrainLoading, + setCurrentTrainLoading, + getCurrentTrain, +}) => ( ( Next Train - + + {currentTrainLoading == "loading" ? ( + + ) : currentTrainLoading == "error" ? ( + { + setCurrentTrainLoading("loading"); + getCurrentTrain(); + }} + /> + ) : null} + ); diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js index 4cc7135..f5efd11 100644 --- a/components/駅名表/Sign.js +++ b/components/駅名表/Sign.js @@ -201,6 +201,7 @@ const styleSheet = { borderWidth: 1, margin: 10, marginHorizontal: wp("10%"), + backgroundColor: "white", }, 下帯: { position: "absolute",