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