LEDの動作条件修正

This commit is contained in:
harukin-DeskMini 2023-01-29 08:38:40 +09:00
parent 9eaa32a0f2
commit 7595dd845a

View File

@ -346,7 +346,10 @@ const EachData = ({
return { color: "white", name: "普通列車" }; return { color: "white", name: "普通列車" };
} }
}; };
const train = customTrainDataDetector(d.train); const [train, setTrain] = useState(customTrainDataDetector(d.train));
useEffect(() => {
setTrain(customTrainDataDetector(d.train));
}, [currentTrain, d.train, trainDescriptionSwitch]);
return ( return (
<> <>
<TouchableOpacity <TouchableOpacity
@ -376,7 +379,12 @@ const EachData = ({
/> />
<LastStation d={d} /> <LastStation d={d} />
<DependTime d={d} /> <DependTime d={d} />
<StatusAndDelay currentTrain={currentTrain} d={d} props={props} /> <StatusAndDelay
currentTrain={currentTrain}
d={d}
props={props}
trainDescriptionSwitch={trainDescriptionSwitch}
/>
</TouchableOpacity> </TouchableOpacity>
{trainDescriptionSwitch && !!train.info && <Description train={train} />} {trainDescriptionSwitch && !!train.info && <Description train={train} />}
</> </>
@ -439,7 +447,7 @@ const DependTime = ({ d }) => {
); );
}; };
const StatusAndDelay = ({ currentTrain, d, props }) => { const StatusAndDelay = ({ currentTrain, d, props, trainDescriptionSwitch }) => {
const [status, setStatus] = useState(""); const [status, setStatus] = useState("");
useEffect(() => { useEffect(() => {
const current = currentTrain.filter((a) => a.num == d.train)[0]; const current = currentTrain.filter((a) => a.num == d.train)[0];
@ -463,7 +471,7 @@ const StatusAndDelay = ({ currentTrain, d, props }) => {
setStatus(delay + "分遅れ"); setStatus(delay + "分遅れ");
break; break;
} }
}, []); }, [currentTrain, d.train, trainDescriptionSwitch]);
return ( return (
<View style={{ flex: 4 }}> <View style={{ flex: 4 }}>
<Text <Text