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"