From bd1ea0857c5fd4c56dd75c0e395ed255b47097f5 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:00:33 +0000 Subject: [PATCH 1/6] =?UTF-8?q?=E7=8F=BE=E5=9C=A8=E5=9C=B0=E3=82=B8?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=83=97=E6=A9=9F=E8=83=BD=E3=82=92=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfoCore.js | 27 ++++++++++++++++++- components/DynamicHeaderScrollView.js | 6 ++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index e73893e..3f362cf 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -1,4 +1,4 @@ -import React, { useEffect, useMemo, useState } from "react"; +import React, { useEffect, useMemo, useRef, useState } from "react"; import { View, Text, @@ -7,6 +7,7 @@ import { useWindowDimensions, BackHandler, Linking, + LayoutAnimation, } from "react-native"; import { SheetManager } from "react-native-actions-sheet"; import { AS } from "../../storageControl"; @@ -173,6 +174,28 @@ export const EachTrainInfoCore = ({ trainPositionSwitch == "true" ? findReversalPoints(currentPosition, stopStationIDList) : stopStationIDList.map(() => false); + const [isJumped, setIsJumped] = useState(false); + useEffect(() => { + if (isJumped) return () => {}; + if (!points) return () => {}; + if (points.length == 0) return () => {}; + const position = points.findIndex((d) => d == true); + if (position == -1) return () => {}; + if (trainDataWidhThrough[position].split(",")[1] == "通過") { + LayoutAnimation.configureNext({ + duration: 200, + update: { type: "easeInEaseOut", springDamping: 0.6 }, + }); + setShowThrew(true); + } + const count = position * 44-30; + // 0.5秒待機してからスクロール + setTimeout( + () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), + 500 + ); + setIsJumped(true); + }, [points]); const trainName = useMemo(() => { if (!data.limited) return ""; const limitedArray = data.limited.split(":"); @@ -198,6 +221,7 @@ export const EachTrainInfoCore = ({ const { height } = useWindowDimensions(); const { isLandscape } = useDeviceOrientationChange(); + const ScrollViewRef = useRef(); const [trueTrainID, setTrueTrainID] = useState(); useEffect(() => { @@ -389,6 +413,7 @@ export const EachTrainInfoCore = ({ from={from} styles={styles} actionSheetRef={actionSheetRef} + ScrollViewRef={ScrollViewRef} containerProps={{ style: { maxHeight: isLandscape ? height - 94 : (height / 100) * 70, diff --git a/components/DynamicHeaderScrollView.js b/components/DynamicHeaderScrollView.js index 5602473..180eae2 100644 --- a/components/DynamicHeaderScrollView.js +++ b/components/DynamicHeaderScrollView.js @@ -13,14 +13,13 @@ export const DynamicHeaderScrollView = (props) => { topStickyContent, styles, from, + ScrollViewRef, } = props; const [headerSize, setHeaderSize] = useState("default"); useLayoutEffect(() => { AS.getItem("headerSize") .then((res) => { - if (res) { - setHeaderSize(res); - } + if (res) setHeaderSize(res); }) .catch((e) => { AS.setItem("headerSize", "default"); @@ -160,6 +159,7 @@ export const DynamicHeaderScrollView = (props) => { stickyHeaderIndices={[1]} scrollEventThrottle={16} onScroll={onScroll} + ref={ScrollViewRef} > {topStickyContent && ( From 40b7437c87878c97c19126291d0c3d986339c116 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:37:20 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E7=99=BA=E5=8B=95=E6=9D=A1=E4=BB=B6=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../findReversalPoints.js | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/eachTrainInfoCoreLib/findReversalPoints.js b/lib/eachTrainInfoCoreLib/findReversalPoints.js index 353a75c..5981d75 100644 --- a/lib/eachTrainInfoCoreLib/findReversalPoints.js +++ b/lib/eachTrainInfoCoreLib/findReversalPoints.js @@ -17,31 +17,31 @@ export const findReversalPoints = (array, stopStationIDList) => { }); return a; }); - if (index != -1) { - return index; - } + if (index != -1) return index; } // 駅間の場合 if (array.length == 2) { - const allThroughStation = stopStationIDList.map((d) => { - if(array[0] == "M12" && array[1] == "Y09" || array[0] == "Y09" && array[1] == "M12"){ - if(d[0] == "M12"){ - return true; - } - else return false; - } - if (d[0] < array[0] && d[0] > array[1]) { - return true; - } else if (d[0] < array[1] && d[0] > array[0]) { - return true; - }else if (d[0] < array[0] && d[0] == array[1]) { - return true; - } else if (d[0] == array[1] && d[0] > array[0]) { - return true; - } + if ( + (array[0] == "M12" && array[1] == "Y09") || + (array[0] == "Y09" && array[1] == "M12") + ) + return d[0] == "M12" ? true : false; - return false; + let returndata = false; + d.forEach((x) => { + if (array[0] < x && x < array[1]) { + returndata = true; + } else if (array[0] < x && x == array[1]) { + returndata = true; + } else if (array[1] == x && x < array[0]) { + returndata = true; + } else if (array[1] < x && x < array[0]) { + returndata = true; + } + }); + + return returndata; }); return allThroughStation; } From 6440cff9283fa36b4cc13e3d4d561f5e43002079 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 07:48:05 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E5=8B=95=E4=BD=9C=E5=8E=9F=E7=90=86?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfoCore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index 3f362cf..d0ee70f 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -188,7 +188,8 @@ export const EachTrainInfoCore = ({ }); setShowThrew(true); } - const count = position * 44-30; + if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない + const count = position * 44-40; // 0.5秒待機してからスクロール setTimeout( () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), From eeb3993c712ac848d60e93b3972eeb3f95551e85 Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Wed, 23 Oct 2024 08:00:09 +0000 Subject: [PATCH 4/6] =?UTF-8?q?css=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EachTrainInfo/EachStopList.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js index f5d3fb6..9f3d451 100644 --- a/components/ActionSheetComponents/EachTrainInfo/EachStopList.js +++ b/components/ActionSheetComponents/EachTrainInfo/EachStopList.js @@ -107,9 +107,14 @@ export const EachStopList = ({ {station} - {points ? ( - 🚊 - ) : null} + + {points ? ( + + 🚊 + + ) : null} + + {!isNaN(currentTrainData?.delay) && currentTrainData?.delay != 0 && ( Date: Wed, 23 Oct 2024 14:30:47 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E5=80=A4=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/EachTrainInfoCore.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index d0ee70f..f5ab02c 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -183,17 +183,17 @@ export const EachTrainInfoCore = ({ if (position == -1) return () => {}; if (trainDataWidhThrough[position].split(",")[1] == "通過") { LayoutAnimation.configureNext({ - duration: 200, + duration: 400, update: { type: "easeInEaseOut", springDamping: 0.6 }, }); setShowThrew(true); } if(position < 5) return() => {}; // 5駅以内の場合はスクロールしない - const count = position * 44-40; + const count = position * 44-50; // 0.5秒待機してからスクロール setTimeout( () => ScrollViewRef.current?.scrollTo({ y: count, animated: true }), - 500 + 400 ); setIsJumped(true); }, [points]); From 681f4d625ffdfedfc99b1d761f9880b908cc9ade Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Thu, 24 Oct 2024 17:21:50 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E6=A9=9F=E8=83=BD?= =?UTF-8?q?=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Settings/LayoutSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Settings/LayoutSettings.js b/components/Settings/LayoutSettings.js index 44b36bb..64af443 100644 --- a/components/Settings/LayoutSettings.js +++ b/components/Settings/LayoutSettings.js @@ -131,7 +131,7 @@ export const LayoutSettings = ({ bool={trainPosition} setBool={setTrainPosition} color="red" - str="列車の現在位置をアイコン表示" + str="列車の現在地表示/ジャンプ" />