43 lines
1.2 KiB
JavaScript
43 lines
1.2 KiB
JavaScript
import { Text, TouchableOpacity } from "react-native";
|
|
import React, { useState } from "react";
|
|
import { useAllTrainDiagram } from "@/stateBox/useAllTrainDiagram";
|
|
export const ShowSpecialTrain = ({
|
|
isTrainDataNothing,
|
|
setTrainData,
|
|
trueTrainID,
|
|
}) => {
|
|
const { allTrainDiagram } = useAllTrainDiagram();
|
|
const replaceSpecialTrainDetail = (trainNum) => {
|
|
let TD = allTrainDiagram[trainNum];
|
|
if (!TD) return;
|
|
setTrainData(TD.split("#").filter((d) => d != ""));
|
|
};
|
|
return (
|
|
<>
|
|
{isTrainDataNothing &&
|
|
trueTrainID?.map((ids) => {
|
|
return (
|
|
<TouchableOpacity
|
|
onPress={() => replaceSpecialTrainDetail(ids)}
|
|
style={{
|
|
padding: 10,
|
|
flexDirection: "row",
|
|
borderColor: "blue",
|
|
borderWidth: 1,
|
|
margin: 10,
|
|
borderRadius: 5,
|
|
alignItems: "center",
|
|
}}
|
|
>
|
|
<Text
|
|
style={{ fontSize: 18, fontWeight: "bold", color: "black" }}
|
|
>
|
|
本来の列車情報候補を表示:({ids})
|
|
</Text>
|
|
</TouchableOpacity>
|
|
);
|
|
})}
|
|
</>
|
|
);
|
|
};
|