diff --git a/components/Apps/FixedPositionBox/FixedStationBox.tsx b/components/Apps/FixedPositionBox/FixedStationBox.tsx index a7ec302..7f2269b 100644 --- a/components/Apps/FixedPositionBox/FixedStationBox.tsx +++ b/components/Apps/FixedPositionBox/FixedStationBox.tsx @@ -230,6 +230,7 @@ export const FixedStation: FC = ({ alignItems: "center", backgroundColor: lineColor, paddingHorizontal: 5, + height: 26, }} > @@ -253,11 +254,11 @@ export const FixedStation: FC = ({ borderTopColor: lineColor, borderBottomColor: "#0000", borderRightColor: "#0000", - borderBottomWidth: 22, + borderBottomWidth: 26, borderLeftWidth: 10, borderRightWidth: 0, borderTopWidth: 0, - height: 20, + height: 26, }} /> @@ -270,7 +271,10 @@ export const FixedStation: FC = ({ alignItems: "center", }} onPress={() => { - LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); + LayoutAnimation.configureNext({ + duration: 500, + update: { type: "spring", springDamping: 0.7 }, + }); if (displaySize === 50) { setDisplaySize(200); } else { @@ -286,11 +290,11 @@ export const FixedStation: FC = ({ borderTopColor: lineColor, borderBottomColor: "#0000", borderRightColor: lineColor, - borderBottomWidth: 22, + borderBottomWidth: 26, borderLeftWidth: 0, borderRightWidth: 10, borderTopWidth: 0, - height: 20, + height: 26, }} /> = ({ alignItems: "center", backgroundColor: lineColor, paddingHorizontal: 5, + height: 26, }} pointerEvents="none" > diff --git a/components/Apps/FixedPositionBox/FixedTrainBox.tsx b/components/Apps/FixedPositionBox/FixedTrainBox.tsx index 0655711..50a99e7 100644 --- a/components/Apps/FixedPositionBox/FixedTrainBox.tsx +++ b/components/Apps/FixedPositionBox/FixedTrainBox.tsx @@ -10,6 +10,7 @@ import { View, Image, LayoutAnimation, + ScrollView, } from "react-native"; import { getTrainType } from "@/lib/getTrainType"; import { trainPosition } from "@/lib/trainPositionTextArray"; @@ -216,8 +217,13 @@ export const FixedTrain: FC = ({ type: customData.type, whiteMode: true, }); + const trainNameText = `${customData.trainName}${ + customData.trainNumDistance !== null + ? ` ${parseInt(customData.TrainNumber) - customData.trainNumDistance}号` + : "" + }`; return ( - = ({ borderBottomWidth: 2, position: "relative", }} - activeOpacity={1} - onPress={() => { - //setFixedPosition({ type: null, value: null }); - }} > = ({ > = ({ flexDirection: displaySize === 50 ? "row" : "column", alignContent: "center", alignSelf: "center", + alignItems: "center", + maxWidth: displaySize === 50 ? 100 : 60, }} > = ({ {customData.trainName && ( 6 ? 9 : 14, + fontSize: trainNameText.length > 6 ? 8 : 14, color: "white", - maxWidth: displaySize === 50 ? 65 : 200, + maxWidth: displaySize === 50 ? 60 : 200, textAlignVertical: "center", }} > - {customData.trainName} + {trainNameText} )} @@ -332,12 +336,12 @@ export const FixedTrain: FC = ({ > 4 ? 9 : 12, color: "white", fontWeight: "bold", textAlignVertical: "center", @@ -536,7 +540,7 @@ export const FixedTrain: FC = ({ - + ); }; @@ -603,7 +607,11 @@ const CurrentPositionBox = ({ > )} - + {trainDataWithThrough.length > 0 && trainDataWithThrough.map((d, index, array) => { if (!d) return null; @@ -612,10 +620,16 @@ const CurrentPositionBox = ({ let distanceMinute = 0; if (time != "") { const now = dayjs(); + const hour = parseInt(time.split(":")[0]); const distanceTime = now - .hour(time.split(":")[0]) + .hour(hour < 4 ? hour + 24 : hour) .minute(time.split(":")[1]); distanceMinute = distanceTime.diff(now, "minute") + delayTime; + if (now.hour() < 4) { + if (hour < 4) { + distanceMinute = distanceMinute - 1440; + } + } } return ( <> @@ -654,7 +668,7 @@ const CurrentPositionBox = ({ (time != "" && ( {se.includes("通") @@ -702,7 +722,7 @@ const CurrentPositionBox = ({ ); })} - + ); }; diff --git a/lib/getCurrentTrainData.ts b/lib/getCurrentTrainData.ts index 35ba0c1..3a4d7a3 100644 --- a/lib/getCurrentTrainData.ts +++ b/lib/getCurrentTrainData.ts @@ -13,8 +13,8 @@ export const getCurrentTrainData = ( case "OneMan": const currentTrainData = currentTrain.filter((a) => a.num == trainNum); if (currentTrainData.length == 0) return customTrainData; - else if (currentTrainData[0].Type.includes("rapid:")) { - const typeText = currentTrainData[0].Type.split(":"); + else if (currentTrainData[0].Type?.includes("rapid:")) { + const typeText = currentTrainData[0].Type?.split(":"); const returnData = { type: "Rapid" as trainTypeID, trainName: typeText[1].replace("\r", ""),