文字表示スタイル変更
This commit is contained in:
parent
f504497bdf
commit
92b9a4a044
@ -81,65 +81,11 @@ export const EachTrainInfo = ({
|
||||
return StationNumbers[0];
|
||||
});
|
||||
function findReversalPoints(array) {
|
||||
let reversalPoints = [];
|
||||
|
||||
for (let i = 0; i < stopStationIDList.length; i++) {
|
||||
if (array.length == 1) {
|
||||
console.log(stopStationIDList[i], array[0]);
|
||||
if (stopStationIDList[i] == array[0]) {
|
||||
reversalPoints.push(i);
|
||||
} else if (
|
||||
stopStationIDList[i] > array[0] &&
|
||||
stopStationIDList[i + 1] < array[0]
|
||||
) {
|
||||
reversalPoints.push(i + 1);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
stopStationIDList[i] == array[0] &&
|
||||
stopStationIDList[i + 1] == array[1]
|
||||
) {
|
||||
reversalPoints.push(i + 1);
|
||||
} else if (
|
||||
stopStationIDList[i] == array[1] &&
|
||||
stopStationIDList[i + 1] == array[0]
|
||||
) {
|
||||
reversalPoints.push(i + 1);
|
||||
} else if (
|
||||
array[0] < stopStationIDList[i] &&
|
||||
stopStationIDList[i] < array[1]
|
||||
) {
|
||||
reversalPoints.push(i);
|
||||
} else if (
|
||||
array[1] < stopStationIDList[i] &&
|
||||
stopStationIDList[i] < array[0]
|
||||
) {
|
||||
reversalPoints.push(i);
|
||||
} else if (
|
||||
stopStationIDList[i + 1] < array[0] &&
|
||||
stopStationIDList[i + 1] < array[1] &&
|
||||
stopStationIDList[i] > array[0] &&
|
||||
stopStationIDList[i] > array[1]
|
||||
) {
|
||||
reversalPoints.push(i + 1);
|
||||
} else if (
|
||||
stopStationIDList[i + 1] > array[0] &&
|
||||
stopStationIDList[i + 1] > array[1] &&
|
||||
stopStationIDList[i] < array[0] &&
|
||||
stopStationIDList[i] < array[1]
|
||||
) {
|
||||
reversalPoints.push(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return reversalPoints;
|
||||
return null;
|
||||
}
|
||||
|
||||
// 使用例
|
||||
const points = findReversalPoints(currentPosition);
|
||||
console.log(currentPosition, points);
|
||||
console.log(currentPosition.length, points.length);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(data);
|
||||
@ -448,6 +394,51 @@ export const EachTrainInfo = ({
|
||||
source={require("../../assets/51690-loading-diamonds.json")}
|
||||
/>
|
||||
<Text>ほげほげふがふが</Text> */}
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
<View
|
||||
style={{
|
||||
padding: 8,
|
||||
flexDirection: "row",
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: "#f0f0f0",
|
||||
flex: 1,
|
||||
}}
|
||||
>
|
||||
<Text style={{ fontSize: 20 }}>停車駅</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ flexDirection: "row" }}>
|
||||
{!isNaN(data.trainData?.delay) &&
|
||||
data.trainData?.delay != 0 && (
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 15,
|
||||
color: "black",
|
||||
position: "absolute",
|
||||
right: 110,
|
||||
textAlign: "right",
|
||||
textDecorationLine: "line-through",
|
||||
}}
|
||||
>
|
||||
(定刻)
|
||||
</Text>
|
||||
)}
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
color: isNaN(data.trainData?.delay)
|
||||
? "black"
|
||||
: data.trainData?.delay == 0
|
||||
? "black"
|
||||
: "red",
|
||||
width: 60,
|
||||
}}
|
||||
>
|
||||
見込
|
||||
</Text>
|
||||
<Text style={{ fontSize: 20, width: 50 }}>着発</Text>
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
{trainData.map((i, index) => {
|
||||
const [station, se, time] = i.split(",");
|
||||
const Stations = stationList.map((a) =>
|
||||
@ -546,6 +537,22 @@ export const EachTrainInfo = ({
|
||||
>
|
||||
<Text style={{ fontSize: 20 }}>{station}</Text>
|
||||
<View style={{ flex: 1 }} />
|
||||
{!isNaN(data.trainData?.delay) &&
|
||||
data.trainData?.delay != 0 && (
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 15,
|
||||
color: "black",
|
||||
width: 60,
|
||||
position: "absolute",
|
||||
right: 120,
|
||||
textAlign: "right",
|
||||
textDecorationLine: "line-through",
|
||||
}}
|
||||
>
|
||||
{time}
|
||||
</Text>
|
||||
)}
|
||||
<Text
|
||||
style={{
|
||||
fontSize: 20,
|
||||
@ -554,22 +561,12 @@ export const EachTrainInfo = ({
|
||||
: data.trainData?.delay == 0
|
||||
? "black"
|
||||
: "red",
|
||||
width: 60,
|
||||
}}
|
||||
>
|
||||
{/* {StationNumbers.length != 0 &&
|
||||
(StationNumbers.includes(currentPosition[0])
|
||||
? "にゃーん"
|
||||
: "ほげ")}
|
||||
{currentPosition} */}
|
||||
{points.includes(index) ? "🚉" : ""}
|
||||
{timeString[0]}:{timeString[1]}
|
||||
{se}
|
||||
{isNaN(data.trainData?.delay)
|
||||
? ""
|
||||
: data.trainData?.delay == 0
|
||||
? ""
|
||||
: " 見込み"}
|
||||
</Text>
|
||||
<Text style={{ fontSize: 18, width: 50 }}>({se})</Text>
|
||||
</View>
|
||||
</View>
|
||||
</TouchableWithoutFeedback>
|
||||
|
Loading…
Reference in New Issue
Block a user