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