各種調整

This commit is contained in:
harukin-expo-dev-env
2025-09-19 04:34:26 +00:00
parent 85fd66b728
commit c8119e2373
3 changed files with 50 additions and 25 deletions

View File

@@ -230,6 +230,7 @@ export const FixedStation: FC<props> = ({
alignItems: "center", alignItems: "center",
backgroundColor: lineColor, backgroundColor: lineColor,
paddingHorizontal: 5, paddingHorizontal: 5,
height: 26,
}} }}
> >
<Ionicons name="lock-closed" size={15} color="white" /> <Ionicons name="lock-closed" size={15} color="white" />
@@ -253,11 +254,11 @@ export const FixedStation: FC<props> = ({
borderTopColor: lineColor, borderTopColor: lineColor,
borderBottomColor: "#0000", borderBottomColor: "#0000",
borderRightColor: "#0000", borderRightColor: "#0000",
borderBottomWidth: 22, borderBottomWidth: 26,
borderLeftWidth: 10, borderLeftWidth: 10,
borderRightWidth: 0, borderRightWidth: 0,
borderTopWidth: 0, borderTopWidth: 0,
height: 20, height: 26,
}} }}
/> />
</TouchableOpacity> </TouchableOpacity>
@@ -270,7 +271,10 @@ export const FixedStation: FC<props> = ({
alignItems: "center", alignItems: "center",
}} }}
onPress={() => { onPress={() => {
LayoutAnimation.configureNext(LayoutAnimation.Presets.spring); LayoutAnimation.configureNext({
duration: 500,
update: { type: "spring", springDamping: 0.7 },
});
if (displaySize === 50) { if (displaySize === 50) {
setDisplaySize(200); setDisplaySize(200);
} else { } else {
@@ -286,11 +290,11 @@ export const FixedStation: FC<props> = ({
borderTopColor: lineColor, borderTopColor: lineColor,
borderBottomColor: "#0000", borderBottomColor: "#0000",
borderRightColor: lineColor, borderRightColor: lineColor,
borderBottomWidth: 22, borderBottomWidth: 26,
borderLeftWidth: 0, borderLeftWidth: 0,
borderRightWidth: 10, borderRightWidth: 10,
borderTopWidth: 0, borderTopWidth: 0,
height: 20, height: 26,
}} }}
/> />
<View <View
@@ -299,6 +303,7 @@ export const FixedStation: FC<props> = ({
alignItems: "center", alignItems: "center",
backgroundColor: lineColor, backgroundColor: lineColor,
paddingHorizontal: 5, paddingHorizontal: 5,
height: 26,
}} }}
pointerEvents="none" pointerEvents="none"
> >

View File

@@ -10,6 +10,7 @@ import {
View, View,
Image, Image,
LayoutAnimation, LayoutAnimation,
ScrollView,
} from "react-native"; } from "react-native";
import { getTrainType } from "@/lib/getTrainType"; import { getTrainType } from "@/lib/getTrainType";
import { trainPosition } from "@/lib/trainPositionTextArray"; import { trainPosition } from "@/lib/trainPositionTextArray";
@@ -216,8 +217,13 @@ export const FixedTrain: FC<props> = ({
type: customData.type, type: customData.type,
whiteMode: true, whiteMode: true,
}); });
const trainNameText = `${customData.trainName}${
customData.trainNumDistance !== null
? ` ${parseInt(customData.TrainNumber) - customData.trainNumDistance}`
: ""
}`;
return ( return (
<TouchableOpacity <View
style={{ style={{
flex: 1, flex: 1,
flexDirection: displaySize === 50 ? "row" : "column", flexDirection: displaySize === 50 ? "row" : "column",
@@ -226,10 +232,6 @@ export const FixedTrain: FC<props> = ({
borderBottomWidth: 2, borderBottomWidth: 2,
position: "relative", position: "relative",
}} }}
activeOpacity={1}
onPress={() => {
//setFixedPosition({ type: null, value: null });
}}
> >
<View <View
style={{ style={{
@@ -255,8 +257,8 @@ export const FixedTrain: FC<props> = ({
> >
<Image <Image
source={{ uri: customData.img }} source={{ uri: customData.img }}
width={displaySize === 50 ? 14 : 22} width={displaySize === 50 ? 14 : 23}
height={displaySize === 50 ? 17 : 25} height={displaySize === 50 ? 17 : 26}
style={{ margin: 5 }} style={{ margin: 5 }}
/> />
<View <View
@@ -264,6 +266,8 @@ export const FixedTrain: FC<props> = ({
flexDirection: displaySize === 50 ? "row" : "column", flexDirection: displaySize === 50 ? "row" : "column",
alignContent: "center", alignContent: "center",
alignSelf: "center", alignSelf: "center",
alignItems: "center",
maxWidth: displaySize === 50 ? 100 : 60,
}} }}
> >
<Text <Text
@@ -286,13 +290,13 @@ export const FixedTrain: FC<props> = ({
{customData.trainName && ( {customData.trainName && (
<Text <Text
style={{ style={{
fontSize: customData?.trainName?.length > 6 ? 9 : 14, fontSize: trainNameText.length > 6 ? 8 : 14,
color: "white", color: "white",
maxWidth: displaySize === 50 ? 65 : 200, maxWidth: displaySize === 50 ? 60 : 200,
textAlignVertical: "center", textAlignVertical: "center",
}} }}
> >
{customData.trainName} {trainNameText}
</Text> </Text>
)} )}
</View> </View>
@@ -332,12 +336,12 @@ export const FixedTrain: FC<props> = ({
> >
<StationNumberMaker <StationNumberMaker
currentStation={station} currentStation={station}
singleSize={20} singleSize={18}
useEach={true} useEach={true}
/> />
<Text <Text
style={{ style={{
fontSize: 12, fontSize: customData?.ToData?.length > 4 ? 9 : 12,
color: "white", color: "white",
fontWeight: "bold", fontWeight: "bold",
textAlignVertical: "center", textAlignVertical: "center",
@@ -536,7 +540,7 @@ export const FixedTrain: FC<props> = ({
</Text> </Text>
</View> </View>
</TouchableOpacity> </TouchableOpacity>
</TouchableOpacity> </View>
); );
}; };
@@ -603,7 +607,11 @@ const CurrentPositionBox = ({
></View> ></View>
</View> </View>
)} )}
<View style={{ flex: 1, flexDirection: "row", overflow: "hidden" }}> <ScrollView
style={{ flex: 1, flexDirection: "row" }}
horizontal
overScrollMode="always"
>
{trainDataWithThrough.length > 0 && {trainDataWithThrough.length > 0 &&
trainDataWithThrough.map((d, index, array) => { trainDataWithThrough.map((d, index, array) => {
if (!d) return null; if (!d) return null;
@@ -612,10 +620,16 @@ const CurrentPositionBox = ({
let distanceMinute = 0; let distanceMinute = 0;
if (time != "") { if (time != "") {
const now = dayjs(); const now = dayjs();
const hour = parseInt(time.split(":")[0]);
const distanceTime = now const distanceTime = now
.hour(time.split(":")[0]) .hour(hour < 4 ? hour + 24 : hour)
.minute(time.split(":")[1]); .minute(time.split(":")[1]);
distanceMinute = distanceTime.diff(now, "minute") + delayTime; distanceMinute = distanceTime.diff(now, "minute") + delayTime;
if (now.hour() < 4) {
if (hour < 4) {
distanceMinute = distanceMinute - 1440;
}
}
} }
return ( return (
<> <>
@@ -654,7 +668,7 @@ const CurrentPositionBox = ({
(time != "" && ( (time != "" && (
<Text <Text
style={{ style={{
fontSize: isSmall ? 8 : 14, fontSize: isSmall ? 8 : 12,
color: "black", color: "black",
backgroundColor: "white", backgroundColor: "white",
fontWeight: "bold", fontWeight: "bold",
@@ -666,8 +680,14 @@ const CurrentPositionBox = ({
<Text <Text
style={{ style={{
fontSize: isSmall ? 8 : 14, fontSize: isSmall ? 8 : 14,
color: se.includes("通") ? "#020202ff" : "white", color: se.includes("通")
? "#020202ff"
: index == 1 && secondText == ""
? "#ffe852ff"
: "white",
marginTop: isSmall ? 0 : 3, marginTop: isSmall ? 0 : 3,
height: isSmall ? "auto" : 17,
fontWeight: "bold",
}} }}
> >
{se.includes("通") {se.includes("通")
@@ -702,7 +722,7 @@ const CurrentPositionBox = ({
</> </>
); );
})} })}
</View> </ScrollView>
</View> </View>
); );
}; };

View File

@@ -13,8 +13,8 @@ export const getCurrentTrainData = (
case "OneMan": case "OneMan":
const currentTrainData = currentTrain.filter((a) => a.num == trainNum); const currentTrainData = currentTrain.filter((a) => a.num == trainNum);
if (currentTrainData.length == 0) return customTrainData; if (currentTrainData.length == 0) return customTrainData;
else if (currentTrainData[0].Type.includes("rapid:")) { else if (currentTrainData[0].Type?.includes("rapid:")) {
const typeText = currentTrainData[0].Type.split(":"); const typeText = currentTrainData[0].Type?.split(":");
const returnData = { const returnData = {
type: "Rapid" as trainTypeID, type: "Rapid" as trainTypeID,
trainName: typeText[1].replace("\r", ""), trainName: typeText[1].replace("\r", ""),