Merge commit '29ea98e29b034a9784493d8e00459ae26ac67748' into develop
This commit is contained in:
commit
8691f81598
@ -4,6 +4,7 @@ import { Ionicons } from "@expo/vector-icons";
|
|||||||
import { SheetManager } from "react-native-actions-sheet";
|
import { SheetManager } from "react-native-actions-sheet";
|
||||||
import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
|
import { getType } from "../../../lib/eachTrainInfoCoreLib/getType";
|
||||||
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
|
import { migrateTrainName } from "../../../lib/eachTrainInfoCoreLib/migrateTrainName";
|
||||||
|
import { TrainIconStatus } from "./trainIconStatus";
|
||||||
import { TrainViewIcon } from "./trainViewIcon";
|
import { TrainViewIcon } from "./trainViewIcon";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
@ -57,6 +58,7 @@ export const HeaderText: FC<Props> = ({
|
|||||||
}, [data.limited, trainData]);
|
}, [data.limited, trainData]);
|
||||||
return (
|
return (
|
||||||
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
<View style={{ padding: 10, flexDirection: "row", alignItems: "center" }}>
|
||||||
|
<TrainIconStatus {...{ data, navigate, from }}/>
|
||||||
<Text style={textConfig}>{trainName}</Text>
|
<Text style={textConfig}>{trainName}</Text>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
<Text style={textConfig}>
|
<Text style={textConfig}>
|
||||||
|
@ -0,0 +1,93 @@
|
|||||||
|
import React, { ComponentProps, FC, useEffect, useState } from "react";
|
||||||
|
import { View, Image, TouchableOpacity } from "react-native";
|
||||||
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { useInterval } from "../../../lib/useInterval";
|
||||||
|
import { Icon } from "@expo/vector-icons/build/createIconSet";
|
||||||
|
import { SheetManager } from "react-native-actions-sheet";
|
||||||
|
|
||||||
|
type GlyphNames = ComponentProps<typeof Ionicons>["name"];
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
data: { trainNum: string; limited: string };
|
||||||
|
navigate: any;
|
||||||
|
from: string;
|
||||||
|
};
|
||||||
|
type apt = {
|
||||||
|
name: GlyphNames;
|
||||||
|
color: string;
|
||||||
|
};
|
||||||
|
export const TrainIconStatus: FC<Props> = ({ data, navigate, from }) => {
|
||||||
|
const [trainIcon, setTrainIcon] = useState(null);
|
||||||
|
const [anpanmanStatus, setAnpanmanStatus] = useState<apt>();
|
||||||
|
useEffect(() => {
|
||||||
|
if (!data.trainNum) return;
|
||||||
|
switch (data.trainNum) {
|
||||||
|
case "32D":
|
||||||
|
case "36D":
|
||||||
|
case "44D":
|
||||||
|
case "48D":
|
||||||
|
case "56D":
|
||||||
|
case "33D":
|
||||||
|
case "37D":
|
||||||
|
case "45D":
|
||||||
|
case "49D":
|
||||||
|
case "57D":
|
||||||
|
setTrainIcon(
|
||||||
|
`https://n8n.haruk.in/webhook/dosan-anpanman-pictures.png?trainNum=${
|
||||||
|
data.trainNum
|
||||||
|
}&day=${dayjs().format("D")}`
|
||||||
|
);
|
||||||
|
fetch(
|
||||||
|
`https://n8n.haruk.in/webhook/dosan-anpanman?trainNum=${
|
||||||
|
data.trainNum
|
||||||
|
}&month=${dayjs().format("M")}&day=${dayjs().format("D")}`
|
||||||
|
)
|
||||||
|
.then((d) => d.json())
|
||||||
|
.then((d) => {
|
||||||
|
if (d.trainStatus == "〇") {
|
||||||
|
//setAnpanmanStatus({name:"checkmark-circle-outline",color:"blue"});
|
||||||
|
} else if (d.trainStatus == "△") {
|
||||||
|
setAnpanmanStatus({ name: "warning-outline", color: "yellow" });
|
||||||
|
} else if (d.trainStatus == "×") {
|
||||||
|
setAnpanmanStatus({ name: "close-circle-outline", color: "red" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, [data.trainNum]);
|
||||||
|
const [move, setMove] = useState(true);
|
||||||
|
useInterval(
|
||||||
|
() => {
|
||||||
|
// anpanmanStatusがデータを持っているなら実行
|
||||||
|
if (anpanmanStatus) setMove(!move);
|
||||||
|
},
|
||||||
|
1000,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{trainIcon && (
|
||||||
|
<TouchableOpacity
|
||||||
|
onPress={() => {
|
||||||
|
navigate("howto", {
|
||||||
|
info: "https://www.jr-eki.com/aptrain/index.html",
|
||||||
|
goTo: from,
|
||||||
|
});
|
||||||
|
SheetManager.hide("EachTrainInfo");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{move ? (
|
||||||
|
<Image
|
||||||
|
source={{ uri: trainIcon }}
|
||||||
|
style={{ height: 30, width: 30, margin: 5 }}
|
||||||
|
resizeMethod="resize"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<Ionicons {...anpanmanStatus} size={30} style={{ margin: 5 }} />
|
||||||
|
)}
|
||||||
|
</TouchableOpacity>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
@ -58,7 +58,7 @@ export default function AllTrainDiagramView() {
|
|||||||
}${TrainNumber}`,
|
}${TrainNumber}`,
|
||||||
},
|
},
|
||||||
navigate,
|
navigate,
|
||||||
from: "AllTrainDiagramView",
|
from: "AllTrainIDList",
|
||||||
};
|
};
|
||||||
SheetManager.show("EachTrainInfo", {
|
SheetManager.show("EachTrainInfo", {
|
||||||
payload,
|
payload,
|
||||||
|
@ -40,7 +40,7 @@ export const DynamicHeaderScrollView = (props) => {
|
|||||||
}, [headerSize]);
|
}, [headerSize]);
|
||||||
const viewHeader = useMemo(() => {
|
const viewHeader = useMemo(() => {
|
||||||
switch (from) {
|
switch (from) {
|
||||||
case "AllTrainDiagramView":
|
case "AllTrainIDList":
|
||||||
case "NearTrainDiagramView":
|
case "NearTrainDiagramView":
|
||||||
case "LED2":
|
case "LED2":
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,7 +37,7 @@ export default function TrainBase({ route }) {
|
|||||||
setSupportMultipleWindows={false}
|
setSupportMultipleWindows={false}
|
||||||
onMessage={(event) => {}}
|
onMessage={(event) => {}}
|
||||||
/>
|
/>
|
||||||
{(from == "LED" || from == "LED2" || from == "AllTrainDiagramView") && (
|
{(from == "LED" || from == "LED2" || from == "AllTrainIDList") && (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={{
|
style={{
|
||||||
padding: 10,
|
padding: 10,
|
||||||
@ -49,7 +49,7 @@ export default function TrainBase({ route }) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}
|
}}
|
||||||
onPress={() =>
|
onPress={() =>
|
||||||
navigate(from == "AllTrainDiagramView" ? "AllTrainIDList" : "menu")
|
navigate(from == "AllTrainIDList" ? "AllTrainIDList" : "menu")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<View style={{ flex: 1 }} />
|
<View style={{ flex: 1 }} />
|
||||||
|
@ -73,10 +73,6 @@ export const TrainMenuProvider = ({ children }) => {
|
|||||||
trainMenu
|
trainMenu
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getStationList2().then(setMapsStationData);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
//ニュース表示
|
//ニュース表示
|
||||||
AS.getItem("status")
|
AS.getItem("status")
|
||||||
|
Loading…
Reference in New Issue
Block a user