From 139ce0ed7b08b2a56a65d8b76b1963c37e0637bd Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 6 Dec 2024 09:48:26 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=81=AE=E6=95=B4?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/StateBox.tsx | 56 ++++++++++++------- .../EachTrainInfo/TrainDataView.js | 11 ++-- 2 files changed, 43 insertions(+), 24 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx b/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx index 41cf9cb..fa5f65c 100644 --- a/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx +++ b/components/ActionSheetComponents/EachTrainInfo/StateBox.tsx @@ -6,30 +6,46 @@ type stateBox = { title: string; style?: ViewStyle; mode?: number; + endText?: string; }; -export const StateBox: FC = ({ text, title, style, mode }) => ( - - {title} - - - {text?.match("~") ? ( - <> - - {text.split("~")[0]} +export const StateBox: FC = (props) => { + const { text, title, style, mode, endText } = props; + return ( + + {title} + + + {text?.match("~") ? ( + <> + + {text.split("~")[0]} + + + {mode == 2 ? "→" : "↓"} + + + {text.split("~")[1]} + + + ) : ( + {text} + )} + + {endText && ( + + + {endText} - - {mode == 2 ? "→" : "↓"} - - - {text.split("~")[1]} - - - ) : ( - {text} + )} - -); + ); +}; const boxStyle: ViewStyle = { flex: 1, backgroundColor: "white", diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index c649ab6..0996076 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -19,7 +19,7 @@ export const TrainDataView = ({ const { isLandscape } = useDeviceOrientationChange(); const { inject } = useCurrentTrain(); const [mapsStationData, setMapsStationData] = useState(undefined); - + const [platformNumber, setPlatformNumber] = useState(); const [platformDescription, setPlatformDescription] = useState(); useEffect(() => { @@ -41,9 +41,11 @@ export const TrainDataView = ({ }, []); const onLine = !!currentPosition?.toString().length; const trainPositionText = (trainData) => { - const { isBetween, Pos } = trainPosition(trainData); - if (isBetween === true) return `${Pos.from}~${Pos.to}`; - else return Pos.Pos == "" ? "" : `${Pos.Pos}${platformNumber ? ` ${platformNumber}番線`:""}${platformDescription ? `\n${platformNumber}番線`:""}`; + const { isBetween, Pos: PosData } = trainPosition(trainData); + const { from, to, Pos } = PosData; + if (isBetween === true) return `${from}~${to}`; + if (Pos == "") return ""; + return `${Pos}${platformNumber ? ` ${platformNumber}番線` : ""}`; }; return (