列車運行情報のstateを最高位に移動
This commit is contained in:
parent
946f669eb0
commit
dfe3c831bc
4
Apps.js
4
Apps.js
@ -47,7 +47,7 @@ export default function Apps({
|
|||||||
const [trainInfo, setTrainInfo] = useState({
|
const [trainInfo, setTrainInfo] = useState({
|
||||||
trainNum: undefined,
|
trainNum: undefined,
|
||||||
limited: undefined,
|
limited: undefined,
|
||||||
delay: undefined,
|
trainData: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
//駅情報画面用
|
//駅情報画面用
|
||||||
@ -160,7 +160,7 @@ export default function Apps({
|
|||||||
setTrainInfo({
|
setTrainInfo({
|
||||||
trainNum,
|
trainNum,
|
||||||
limited,
|
limited,
|
||||||
delay: currentTrain.filter((t) => t.num == trainNum)[0].delay,
|
trainData: currentTrain.filter((t) => t.num == trainNum)[0],
|
||||||
}); //遅延情報は未実装
|
}); //遅延情報は未実装
|
||||||
EachTrainInfoAsSR.current?.show();
|
EachTrainInfoAsSR.current?.show();
|
||||||
return;
|
return;
|
||||||
|
@ -38,6 +38,7 @@ export const EachTrainInfo = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
console.log(data);
|
||||||
setIsTop(true);
|
setIsTop(true);
|
||||||
if (!data.trainNum) return;
|
if (!data.trainNum) return;
|
||||||
const TD = trainList[data.trainNum];
|
const TD = trainList[data.trainNum];
|
||||||
@ -129,6 +130,64 @@ export const EachTrainInfo = ({
|
|||||||
setIsTop(e.nativeEvent.contentOffset.y < 0);
|
setIsTop(e.nativeEvent.contentOffset.y < 0);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<View style={{ flexDirection: "row" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "black",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 10, color: "white" }} t>
|
||||||
|
現在地
|
||||||
|
</Text>
|
||||||
|
<View style={{ flex: 1 }} />
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 30, color: "white", textAlign: "right" }}
|
||||||
|
>
|
||||||
|
{data.trainData?.Pos}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View style={{ flex: 1, flexDirection: "column" }}>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "black",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 10, color: "white" }}>
|
||||||
|
{isNaN(data.trainData?.delay) ? "状態" : "遅延時分"}
|
||||||
|
</Text>
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 30, color: "white", textAlign: "right" }}
|
||||||
|
>
|
||||||
|
{data.trainData?.delay}
|
||||||
|
{isNaN(data.trainData?.delay) ? "" : "分"}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
backgroundColor: "black",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
margin: 10,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Text style={{ fontSize: 10, color: "white" }}>列番</Text>
|
||||||
|
<Text
|
||||||
|
style={{ fontSize: 30, color: "white", textAlign: "right" }}
|
||||||
|
>
|
||||||
|
{data.trainData?.num}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
padding: 10,
|
padding: 10,
|
||||||
@ -138,7 +197,6 @@ export const EachTrainInfo = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<View style={{ alignItems: "center" }}>
|
<View style={{ alignItems: "center" }}>
|
||||||
<Text>{data.delay}</Text>
|
|
||||||
{/* <LottieView
|
{/* <LottieView
|
||||||
autoPlay
|
autoPlay
|
||||||
loop
|
loop
|
||||||
|
@ -289,7 +289,7 @@ const EachData = ({
|
|||||||
limited: `${getTrainType(train.type).data}:${
|
limited: `${getTrainType(train.type).data}:${
|
||||||
train.trainName
|
train.trainName
|
||||||
}${TrainNumber}`,
|
}${TrainNumber}`,
|
||||||
delay: currentTrain.filter((t) => t.num == d.train)[0].delay,
|
trainData: currentTrain.filter((t) => t.num == d.train)[0],
|
||||||
});
|
});
|
||||||
EachTrainInfoAsSR.current?.show();
|
EachTrainInfoAsSR.current?.show();
|
||||||
};
|
};
|
||||||
|
2
menu.js
2
menu.js
@ -67,7 +67,7 @@ export default function Menu(props) {
|
|||||||
const [trainInfo, setTrainInfo] = useState({
|
const [trainInfo, setTrainInfo] = useState({
|
||||||
trainNum: undefined,
|
trainNum: undefined,
|
||||||
limited: undefined,
|
limited: undefined,
|
||||||
delay: undefined,
|
trainData: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const getCurrentPosition = () => {
|
const getCurrentPosition = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user