詳細な型設定の変更
This commit is contained in:
@@ -4,8 +4,6 @@ import { useCurrentTrain } from "@/stateBox/useCurrentTrain";
|
|||||||
import { useStationList, StationProps } from "@/stateBox/useStationList";
|
import { useStationList, StationProps } from "@/stateBox/useStationList";
|
||||||
import { FC, useEffect, useState } from "react";
|
import { FC, useEffect, useState } from "react";
|
||||||
import { Text, TouchableOpacity, View, Image } from "react-native";
|
import { Text, TouchableOpacity, View, Image } from "react-native";
|
||||||
import { customTrainDataDetector } from "../../custom-train-data";
|
|
||||||
import { getStringConfig } from "@/lib/getStringConfig";
|
|
||||||
import { getTrainType } from "@/lib/getTrainType";
|
import { getTrainType } from "@/lib/getTrainType";
|
||||||
import { trainPosition } from "@/lib/trainPositionTextArray";
|
import { trainPosition } from "@/lib/trainPositionTextArray";
|
||||||
import { StationNumberMaker } from "../../駅名表/StationNumberMaker";
|
import { StationNumberMaker } from "../../駅名表/StationNumberMaker";
|
||||||
@@ -184,11 +182,6 @@ export const FixedTrain: FC<props> = ({ trainID }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [customData, trainDataWidhThrough]);
|
}, [customData, trainDataWidhThrough]);
|
||||||
const [stringConfig, setStringConfig] = useState([, ,]);
|
|
||||||
useEffect(() => {
|
|
||||||
const x = getStringConfig(customData.type, customData.TrainNumber);
|
|
||||||
setStringConfig(x);
|
|
||||||
}, [customData]);
|
|
||||||
|
|
||||||
const [station, setStation] = useState<StationProps[]>([]);
|
const [station, setStation] = useState<StationProps[]>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -236,15 +229,15 @@ export const FixedTrain: FC<props> = ({ trainID }) => {
|
|||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontFamily: stringConfig[1] ? "JR-Nishi" : undefined,
|
fontFamily: customTrainType.fontAvailable ? "JR-Nishi" : undefined,
|
||||||
fontWeight: !stringConfig[1] ? "bold" : undefined,
|
fontWeight: !customTrainType.fontAvailable ? "bold" : undefined,
|
||||||
marginTop: stringConfig[1] ? 3 : 0,
|
marginTop: customTrainType.fontAvailable ? 3 : 0,
|
||||||
color: "white",
|
color: "white",
|
||||||
textAlignVertical: "center",
|
textAlignVertical: "center",
|
||||||
textAlign: "center",
|
textAlign: "center",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{stringConfig[0]}
|
{customTrainType.shortName}
|
||||||
</Text>
|
</Text>
|
||||||
{customData.trainName && (
|
{customData.trainName && (
|
||||||
<Text
|
<Text
|
||||||
|
@@ -28,6 +28,7 @@ export type CustomTrainData = {
|
|||||||
type?: trainTypeID;
|
type?: trainTypeID;
|
||||||
viaData?: string;
|
viaData?: string;
|
||||||
info?: string;
|
info?: string;
|
||||||
|
infoUrl?: string;
|
||||||
infogram?: string;
|
infogram?: string;
|
||||||
uwasa?: string;
|
uwasa?: string;
|
||||||
isEdit?: boolean;
|
isEdit?: boolean;
|
||||||
|
@@ -36,7 +36,7 @@ type getTrainType = (e: {
|
|||||||
}) => {
|
}) => {
|
||||||
color: colorString;
|
color: colorString;
|
||||||
name: trainTypeString;
|
name: trainTypeString;
|
||||||
shortName?: string;
|
shortName: string;
|
||||||
fontAvailable: boolean;
|
fontAvailable: boolean;
|
||||||
isOneMan: boolean;
|
isOneMan: boolean;
|
||||||
data: trainTypeDataString;
|
data: trainTypeDataString;
|
||||||
@@ -163,7 +163,7 @@ export const getTrainType: getTrainType = ({ type, id, whiteMode }) => {
|
|||||||
};
|
};
|
||||||
case "Other":
|
case "Other":
|
||||||
default:
|
default:
|
||||||
if(id){
|
if (id) {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case !!id.includes("T"):
|
case !!id.includes("T"):
|
||||||
return {
|
return {
|
||||||
@@ -197,7 +197,6 @@ export const getTrainType: getTrainType = ({ type, id, whiteMode }) => {
|
|||||||
data: "notService",
|
data: "notService",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
color: whiteMode ? "black" : "white",
|
color: whiteMode ? "black" : "white",
|
||||||
|
Reference in New Issue
Block a user