From 8102680ba79a22dbf0ebd533790b4928e3dc459c Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 12 Aug 2025 18:27:06 +0000 Subject: [PATCH] =?UTF-8?q?=E6=AE=B5=E9=9A=8E=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/PositionBox.tsx | 76 +++++++++++-------- .../EachTrainInfo/TrainDataView.js | 2 +- 2 files changed, 45 insertions(+), 33 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx index 187d0ff..9a41c1e 100644 --- a/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx +++ b/components/ActionSheetComponents/EachTrainInfo/PositionBox.tsx @@ -1,6 +1,6 @@ import { trainPosition } from "@/lib/trainPositionTextArray"; -import React, { CSSProperties, FC } from "react"; -import { View, Text, StyleProp, TextStyle, ViewStyle } from "react-native"; +import React, { FC } from "react"; +import { View, Text, TextStyle, ViewStyle } from "react-native"; type stateBox = { currentTrainData: any; @@ -8,7 +8,7 @@ type stateBox = { title: string; style?: ViewStyle; mode?: number; - endText?: string; + platformDescription: string; lineNumber: string; }; export const PositionBox: FC = (props) => { @@ -18,44 +18,55 @@ export const PositionBox: FC = (props) => { title, style, mode, - endText, + platformDescription, lineNumber, } = props; - const trainPositionText = (trainData) => { - const { isBetween, Pos: PosData } = trainPosition(trainData); - if (isBetween === true) { - const { from, to } = PosData; - return `${from}~${to}`; - } else { - const { Pos } = PosData; - if (Pos == "") return ""; - if (platformNumber) return `${Pos} ${platformNumber}番乗り場`; - if (lineNumber) return `${Pos} ${lineNumber}番線`; + let firstText = ""; + let secondText = ""; + let marginText = ""; + let externalText = ""; + const { isBetween, Pos: PosData } = trainPosition(currentTrainData); + if (isBetween === true) { + const { from, to } = PosData; + firstText = from; + secondText = to; + marginText = mode == 2 ? "→" : "↓"; + } else { + const { Pos } = PosData; + if (Pos !== "") { + firstText = Pos; + if (platformNumber) { + secondText = `${platformNumber}番乗り場`; + if (lineNumber) { + externalText = `${lineNumber}番線`; + } + } else if (lineNumber) { + secondText = `${lineNumber}番線`; + } } - }; - const text = trainPositionText(currentTrainData); + } return ( {title} - {text?.match("~") ? ( - <> - - {text.split("~")[0]} - - - {mode == 2 ? "→" : "↓"} - - - {text.split("~")[1]} - - - ) : ( - {text} + {firstText && ( + + {firstText} + + )} + {marginText && ( + + {marginText} + + )} + {secondText && ( + + {secondText} + )} - {endText && ( + {(platformDescription || externalText) && ( = (props) => { fontSize: 10, }} > - {endText} + {" " + externalText} + {" " + platformDescription} )} diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 4e89aec..75ca93b 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -147,7 +147,7 @@ export const TrainDataView = ({ currentTrainData={currentTrainData} platformNumber={platformNumber} lineNumber={lineNumber} - endText={platformDescription ? `${platformDescription}` : ""} + platformDescription={platformDescription ? `${platformDescription}` : ""} style={ onLine ? { borderWidth: 1, borderColor: "red", borderStyle: "solid" }