フィルタリング項目での駅名検索での前後関係を見るように変更
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
|||||||
ScrollView,
|
ScrollView,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import { getTrainType } from "@/lib/getTrainType";
|
import { getTrainType } from "@/lib/getTrainType";
|
||||||
import { trainPosition } from "@/lib/trainPositionTextArray";
|
import { trainDataType, trainPosition } from "@/lib/trainPositionTextArray";
|
||||||
import { StationNumberMaker } from "@/components/駅名表/StationNumberMaker";
|
import { StationNumberMaker } from "@/components/駅名表/StationNumberMaker";
|
||||||
import { lineListPair, stationIDPair } from "@/lib/getStationList";
|
import { lineListPair, stationIDPair } from "@/lib/getStationList";
|
||||||
import { findReversalPoints } from "@/lib/eachTrainInfoCoreLib/findReversalPoints";
|
import { findReversalPoints } from "@/lib/eachTrainInfoCoreLib/findReversalPoints";
|
||||||
@@ -42,16 +42,7 @@ export const FixedTrain: FC<props> = ({
|
|||||||
} = useCurrentTrain();
|
} = useCurrentTrain();
|
||||||
const { allCustomTrainData, allTrainDiagram } = useAllTrainDiagram();
|
const { allCustomTrainData, allTrainDiagram } = useAllTrainDiagram();
|
||||||
|
|
||||||
const [train, setTrain] = useState<{
|
const [train, setTrain] = useState<trainDataType>(null);
|
||||||
Pos?: string;
|
|
||||||
Direction?: number;
|
|
||||||
Index?: number;
|
|
||||||
Line?: string;
|
|
||||||
PosNum?: number;
|
|
||||||
Type?: string;
|
|
||||||
delay?: string | number;
|
|
||||||
num?: string;
|
|
||||||
}>(null);
|
|
||||||
const [customData, setCustomData] = useState<CustomTrainData>(
|
const [customData, setCustomData] = useState<CustomTrainData>(
|
||||||
getCurrentTrainData(trainID, currentTrain, allCustomTrainData)
|
getCurrentTrainData(trainID, currentTrain, allCustomTrainData)
|
||||||
);
|
);
|
||||||
|
@@ -82,16 +82,26 @@ export const StationDiagramView: FC<props> = ({ route }) => {
|
|||||||
.filter((s) => {
|
.filter((s) => {
|
||||||
const boolData = allTrainDiagram[s];
|
const boolData = allTrainDiagram[s];
|
||||||
let isStop = false;
|
let isStop = false;
|
||||||
|
let isStopPos = -1;
|
||||||
let isInput = false;
|
let isInput = false;
|
||||||
|
let isInputPos = -1;
|
||||||
|
|
||||||
boolData.split("#").forEach((d) => {
|
boolData.split("#").forEach((d, index, array) => {
|
||||||
const [station, type, time] = d.split(",");
|
const [station, type, time] = d.split(",");
|
||||||
if (station === stationName) isStop = true;
|
if (station === stationName) {
|
||||||
if (station === input && type && !type.includes("通"))
|
isStop = true;
|
||||||
|
isStopPos = index;
|
||||||
|
}
|
||||||
|
if (station === input && type && !type.includes("通")) {
|
||||||
isInput = true;
|
isInput = true;
|
||||||
|
isInputPos = index;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (input && input.length > 0) {
|
if (input && input.length > 0) {
|
||||||
return isInput && isStop;
|
if (isInput && isStop) {
|
||||||
|
return isInputPos > isStopPos;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return isStop;
|
return isStop;
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user