停車駅情報等をsticky-headerに

This commit is contained in:
harukin-OneMix4 2024-02-06 16:02:23 +09:00
parent 80f4913f89
commit b551c75061

View File

@ -67,9 +67,6 @@ export const EachTrainInfo = (props) => {
showNearTrain.forEach((d) => {
const [station, se, time] = d.split(",");
console.log(trainData); //trainDataは現在の列車の停車駅リスト
console.log(station); //showNearTrainは裏列車の停車駅リスト
console.log(trainData[0]);
if (station == trainData[0].split(",")[0])
setHeadStation(trainData[0].split(",")[0]);
if (station == trainData[trainData.length - 1].split(",")[0])
@ -556,57 +553,6 @@ export const EachTrainInfo = (props) => {
</View> */}
</ScrollView>
)}
<View
style={{
alignItems: "center",
backgroundColor: "white",
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(currentTrainData?.delay) &&
currentTrainData?.delay != 0 && (
<Text
style={{
fontSize: 15,
color: "black",
position: "absolute",
right: 110,
textAlign: "right",
textDecorationLine: "line-through",
}}
>
(定刻)
</Text>
)}
<Text
style={{
fontSize: 20,
color: isNaN(currentTrainData?.delay)
? "black"
: currentTrainData?.delay == 0
? "black"
: "red",
width: 60,
}}
>
見込
</Text>
<Text style={{ fontSize: 20, width: 50 }}></Text>
</View>
</View>
</View>
<ScrollView
{...scrollHandlers}
style={{
@ -615,7 +561,60 @@ export const EachTrainInfo = (props) => {
),
backgroundColor: "white",
}}
stickyHeaderIndices={[0]}
>
<View
style={{
alignItems: "center",
backgroundColor: "white",
flexDirection: "row",
}}
index={0}
>
<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(currentTrainData?.delay) &&
currentTrainData?.delay != 0 && (
<Text
style={{
fontSize: 15,
color: "black",
position: "absolute",
right: 110,
textAlign: "right",
textDecorationLine: "line-through",
}}
>
(定刻)
</Text>
)}
<Text
style={{
fontSize: 20,
color: isNaN(currentTrainData?.delay)
? "black"
: currentTrainData?.delay == 0
? "black"
: "red",
width: 60,
}}
>
見込
</Text>
<Text style={{ fontSize: 20, width: 50 }}></Text>
</View>
</View>
</View>
{headStation && !isConcatNear && (
<TouchableOpacity
onPress={() => openBackTrainInfo(headStation)}