有効化忘れを修正、TraInfoをProviderに移動
This commit is contained in:
55
menu.js
55
menu.js
@@ -22,7 +22,6 @@ import {
|
||||
MaterialCommunityIcons,
|
||||
} from "@expo/vector-icons";
|
||||
import LottieView from "lottie-react-native";
|
||||
import { StationDeteilView } from "./components/ActionSheetComponents/StationDeteilView";
|
||||
import { parseAllTrainDiagram } from "./lib/parseAllTrainDiagram";
|
||||
import trainList from "./assets/originData/trainList";
|
||||
|
||||
@@ -33,12 +32,11 @@ import { UsefulBox } from "./components/atom/UsefulBox";
|
||||
import { TicketBox } from "./components/atom/TicketBox";
|
||||
import { TextBox } from "./components/atom/TextBox";
|
||||
import { getStationList, lineList } from "./lib/getStationList";
|
||||
import { JRSTraInfo } from "./components/ActionSheetComponents/JRSTraInfo";
|
||||
import { EachTrainInfo } from "./components/ActionSheetComponents/EachTrainInfo";
|
||||
import useInterval from "./lib/useInterval";
|
||||
import { HeaderConfig } from "./lib/HeaderConfig";
|
||||
import { useFavoriteStation } from "./stateBox/useFavoriteStation";
|
||||
import { SheetManager } from "react-native-actions-sheet";
|
||||
import { useTrainDelayData } from "./stateBox/useTrainDelayData";
|
||||
|
||||
export default function Menu(props) {
|
||||
const {
|
||||
@@ -105,22 +103,9 @@ export default function Menu(props) {
|
||||
const [originalStationList, setOriginalStationList] = useState(); // 第一要素
|
||||
useEffect(() => getStationList().then(setOriginalStationList), []);
|
||||
|
||||
const [count, setCount] = useState(0);
|
||||
const [delayData, setDelayData] = useState(undefined);
|
||||
const [getTime, setGetTime] = useState(new Date());
|
||||
const [loadingDelayData, setLoadingDelayData] = useState(true);
|
||||
const carouselRef = useRef();
|
||||
const [selectedCurrentStation, setSelectedCurrentStation] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
fetch(
|
||||
"https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec"
|
||||
)
|
||||
.then((response) => response.text())
|
||||
.then((data) => setDelayData(data !== "" ? data.split("^") : null))
|
||||
.then(() => setGetTime(new Date()))
|
||||
.finally(() => setLoadingDelayData(false));
|
||||
}, [loadingDelayData]);
|
||||
const [allStationData, setAllStationData] = useState([]);
|
||||
useEffect(() => {
|
||||
setAllStationData(
|
||||
@@ -262,12 +247,7 @@ export default function Menu(props) {
|
||||
openStationACFromEachTrainInfo={openStationACFromEachTrainInfo}
|
||||
/>
|
||||
)}
|
||||
<JRSTraInfoBox
|
||||
getTime={getTime}
|
||||
setLoadingDelayData={setLoadingDelayData}
|
||||
loadingDelayData={loadingDelayData}
|
||||
delayData={delayData}
|
||||
/>
|
||||
<JRSTraInfoBox />
|
||||
<FixedContentBottom navigate={navigate} />
|
||||
</ScrollView>
|
||||
</View>
|
||||
@@ -332,8 +312,15 @@ const TopMenuButton = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const JRSTraInfoBox = (props) => {
|
||||
const { getTime, setLoadingDelayData, loadingDelayData, delayData } = props;
|
||||
const JRSTraInfoBox = () => {
|
||||
const {
|
||||
getTime,
|
||||
setGetTime,
|
||||
delayData,
|
||||
setDelayData,
|
||||
loadingDelayData,
|
||||
setLoadingDelayData,
|
||||
} = useTrainDelayData();
|
||||
const styles = {
|
||||
touch: {
|
||||
backgroundColor: "#0099CC",
|
||||
@@ -365,17 +352,7 @@ const JRSTraInfoBox = (props) => {
|
||||
};
|
||||
return (
|
||||
<TouchableOpacity
|
||||
onPress={() => {
|
||||
const payload = {
|
||||
getTime,
|
||||
setLoadingDelayData,
|
||||
loadingDelayData,
|
||||
delayData,
|
||||
};
|
||||
SheetManager.show("JRSTraInfo", {
|
||||
payload,
|
||||
});
|
||||
}}
|
||||
onPress={() => SheetManager.show("JRSTraInfo")}
|
||||
style={styles.touch}
|
||||
>
|
||||
<ScrollView scrollEnabled={false} style={styles.scroll}>
|
||||
@@ -558,18 +535,18 @@ const FixedContentBottom = (props) => {
|
||||
JR四国グループの施設をご案内
|
||||
</Text>
|
||||
</TextBox>
|
||||
{/* <TextBox
|
||||
<TextBox
|
||||
backgroundColor="#0099CC"
|
||||
flex={1}
|
||||
onPressButton={() => props.navigate("AllTrainIDList")}
|
||||
>
|
||||
<Text style={{ color: "white", fontWeight: "bold", fontSize: 20 }}>
|
||||
JR四国のお店・サービス
|
||||
列番検索
|
||||
</Text>
|
||||
<Text style={{ color: "white", fontSize: 18 }}>
|
||||
JR四国グループの施設をご案内
|
||||
全列車のダイヤを確認できる機能です。
|
||||
</Text>
|
||||
</TextBox> */}
|
||||
</TextBox>
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<TouchableOpacity
|
||||
style={{
|
||||
|
Reference in New Issue
Block a user