From 50c332979337871d9a955a8cb9197e455fa4ca7a Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Fri, 25 Oct 2024 14:06:08 +0000 Subject: [PATCH] =?UTF-8?q?=E7=B4=B0=E3=81=8B=E3=81=84=E3=83=90=E3=82=B0?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore.js | 20 +++++++++++-------- components/発車時刻表/EachData.tsx | 16 ++++++++++----- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 8a9f340..baae4cf 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -177,10 +177,10 @@ export const EachTrainInfoCore = ({ const [isJumped, setIsJumped] = useState(false); useEffect(() => { if (isJumped) return () => {}; - setShowThrew(true); if (!points) return () => {}; if (points.length == 0) return () => {}; const position = points.findIndex((d) => d == true); + let isThrew = false; if (position == -1) return () => {}; if (trainDataWidhThrough[position].split(",")[1] == "通過") { LayoutAnimation.configureNext({ @@ -188,14 +188,18 @@ export const EachTrainInfoCore = ({ update: { type: "easeInEaseOut", springDamping: 0.6 }, }); setShowThrew(true); + isThrew = true; + } + if (position < 5) { + } // 5駅以内の場合はスクロールしない + else { + const count = position * 44 - 50; + // 0.5秒待機してからスクロール + setTimeout( + () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), + 400 + ); } - if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない - const count = position * 44-50; - // 0.5秒待機してからスクロール - setTimeout( - () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), - 400 - ); setIsJumped(true); }, [points]); const trainName = useMemo(() => { diff --git a/components/発車時刻表/EachData.tsx b/components/発車時刻表/EachData.tsx index 22dd788..275358e 100644 --- a/components/発車時刻表/EachData.tsx +++ b/components/発車時刻表/EachData.tsx @@ -102,14 +102,18 @@ export const EachData: FC = (props) => { }; const [platformNumber, setPlatformNumber] = useState(); + const [platformDescription, setPlatformDescription] = useState(); useEffect(() => { fetch( `https://n8n.haruk.in/webhook/JR-shikoku-PosID?PosNum=${currentTrainData?.PosNum}&Line=${currentTrainData?.Line}` ) .then((res) => res.json()) - .then((data) => - setPlatformNumber(data?.type == "Station" ? data?.platform : undefined) - ); + .then((data) => { + setPlatformNumber(data?.type == "Station" ? data?.platform : undefined); + setPlatformDescription( + data?.type == "Station" ? data?.description : undefined + ); + }); }, [currentTrainData, currentTrain]); return ( @@ -141,9 +145,11 @@ export const EachData: FC = (props) => { { Linking.openURL( "https://nexcloud.haruk.in/apps/forms/s/TEkBQW5WLcYjLyAzGxncQLtw"