From 15979937da1120a5b79f2c0b58ad2b3cfaa8de71 Mon Sep 17 00:00:00 2001 From: Tsubasa SEKIGUCHI Date: Sun, 14 Jul 2024 09:41:00 +0900 Subject: [PATCH] =?UTF-8?q?=E6=99=AE=E9=80=9A/=E5=90=84=E9=A7=85=E5=81=9C?= =?UTF-8?q?=E8=BB=8A=E3=81=8C=E9=81=B8=E3=81=B9=E3=81=AA=E3=81=84=E3=83=90?= =?UTF-8?q?=E3=82=B0=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/screens/TrainTypeSettingsScreen.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/screens/TrainTypeSettingsScreen.tsx b/src/screens/TrainTypeSettingsScreen.tsx index 29d4235ee..b1b714d2e 100644 --- a/src/screens/TrainTypeSettingsScreen.tsx +++ b/src/screens/TrainTypeSettingsScreen.tsx @@ -44,10 +44,9 @@ const TrainTypeSettings: React.FC = () => { ) const onPressBack = useCallback(async () => { - if (!trainType) { - return + if (trainType) { + await fetchTrainTypeStations({ lineGroupId: trainType.groupId }) } - await fetchTrainTypeStations({ lineGroupId: trainType.groupId }) if (navigation.canGoBack()) { navigation.goBack() @@ -71,9 +70,10 @@ const TrainTypeSettings: React.FC = () => { ...prev, trainType: null, })) + // 種別が変わるとすでに選択していた行先が停車駅に存在しない場合があるのでリセットする setStationState((prev) => ({ ...prev, - stations: [], + wantedDestination: null, })) return }