From a9dddfca2c0d1087bf17d2836aa7efb67b71a3f7 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Sat, 19 Oct 2024 12:54:32 +0000 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E9=81=8E=E8=A1=A8=E7=A4=BA=E3=81=AE?= =?UTF-8?q?=E3=82=AA=E3=83=B3=E3=82=AA=E3=83=95=E3=82=92=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/EachStopList.js | 14 ++++++-- .../EachTrainInfo/ScrollStickyContent.js | 27 ++++++++++++-- .../EachTrainInfoCore.js | 36 +++++++++++-------- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index dbfd194..66decaf 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -10,7 +10,9 @@ export const EachStopList = ({ points, currentTrainData, openStationACFromEachTrainInfo, + showThrew, }) => { + if (!showThrew && i.split(",")[1] == "通過") return null; const [station, se, time] = i.split(","); // 阿波池田,発,6:21 const Stations = stationList .map((a) => a.filter((d) => d.StationName == station)) @@ -43,7 +45,7 @@ export const EachStopList = ({ .set("hour", parseInt(time.split(":")[0])) .set("minute", parseInt(time.split(":")[1])) .add(isNaN(currentTrainData?.delay) ? 0 : currentTrainData.delay, "minute"); - const timeString = se == "通過"? "" :dates.format("HH:mm").split(":"); + const timeString = se == "通過" ? "" : dates.format("HH:mm").split(":"); return ( ( - {station} + + {station} + {points && points.findIndex((d) => d == index) >= 0 ? ( 🚊 diff --git a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js index 3881b36..6496b4e 100644 --- a/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js +++ b/components/ActionSheetComponents/EachTrainInfo/ScrollStickyContent.js @@ -1,7 +1,8 @@ import React from "react"; -import { View, Text } from "react-native"; +import { View, Text, LayoutAnimation } from "react-native"; -export const ScrollStickyContent = ({ currentTrainData }) => { +export const ScrollStickyContent = (props) => { + const { currentTrainData, showThrew, setShowThrew, haveThrough } = props; return ( { > 見込 - + { + if (!haveThrough) return; + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(!showThrew); + }} + > + (通過{showThrew ? "▼" : "▶"}) + diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index a0107bc..0ef42bb 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -82,6 +82,8 @@ export const EachTrainInfoCore = ({ const [currentPosition, setCurrentPosition] = useState([]); const [trainData, setTrainData] = useState([]); const [trainDataWidhThrough, setTrainDataWithThrough] = useState([]); + const [showThrew, setShowThrew] = useState(false); + const [haveThrough, setHaveThrough] = useState(false); const stationList = originalStationList && @@ -136,13 +138,13 @@ export const EachTrainInfoCore = ({ originalStationList[ lineListPair[stationIDPair[betweenStationLine]] ].forEach((d) => { - console.log(d.StationNumber, baseStationNumberFirst, baseStationNumberSecond); if ( d.StationNumber > baseStationNumberFirst && d.StationNumber < baseStationNumberSecond ) { console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); + setHaveThrough(true); reverse = false; } else { if ( @@ -151,6 +153,7 @@ export const EachTrainInfoCore = ({ ) { console.log(d.Station_JP); allThroughStation.push(`${d.Station_JP},通過,`); + setHaveThrough(true); reverse = true; } } @@ -161,11 +164,11 @@ export const EachTrainInfoCore = ({ let mainArray = [...trainData]; let indexs = 0; trainData.forEach((d, index, array) => { - indexs = indexs+1; - if(!allThroughStationList[index]) return; - if(allThroughStationList[index].length == 0) return; + indexs = indexs + 1; + if (!allThroughStationList[index]) return; + if (allThroughStationList[index].length == 0) return; mainArray.splice(indexs, 0, ...allThroughStationList[index]); - indexs = indexs+allThroughStationList[index].length; + indexs = indexs + allThroughStationList[index].length; }); setTrainDataWithThrough(mainArray); }, [trainData]); @@ -366,7 +369,9 @@ export const EachTrainInfoCore = ({ shortHeader={} longHeader={} topStickyContent={ - + } > {headStation.length != 0 && @@ -429,14 +434,17 @@ export const EachTrainInfoCore = ({ i.split(",")[1] == "提" ? ( ) : ( - + ) )} {tailStation.length != 0 &&