From 6a58263e9422e8077959fcc7a030276c35d8257b Mon Sep 17 00:00:00 2001 From: harukin-expo-dev-env Date: Tue, 6 May 2025 16:27:42 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E5=BE=8C=E3=81=AE=E9=A7=85=E3=83=AA?= =?UTF-8?q?=E3=82=B9=E3=83=88=E9=81=B8=E6=8A=9E=E3=82=92=E7=B6=AD=E6=8C=81?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/Menu/Carousel/CarouselTypeChanger.tsx | 7 +++++++ menu.js | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/components/Menu/Carousel/CarouselTypeChanger.tsx b/components/Menu/Carousel/CarouselTypeChanger.tsx index 6c9cecf..c2a0850 100644 --- a/components/Menu/Carousel/CarouselTypeChanger.tsx +++ b/components/Menu/Carousel/CarouselTypeChanger.tsx @@ -1,3 +1,4 @@ +import { AS } from "@/storageControl"; import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"; import React, { useEffect, useRef } from "react"; import { View, TouchableOpacity, Text, LayoutAnimation } from "react-native"; @@ -49,11 +50,15 @@ export const CarouselTypeChanger = ({ if (!position) return; returnToDefaultMode(); setStationListMode("position"); + AS.setItem("stationListMode", "position"); + setSelectedCurrentStation(0); }} onPress={() => { if (!position) return; returnToDefaultMode(); setStationListMode("position"); + AS.setItem("stationListMode", "position"); + setSelectedCurrentStation(0); }} > { returnToDefaultMode(); // お気に入りリスト更新 setStationListMode("favorite"); + AS.setItem("stationListMode", "favorite"); setSelectedCurrentStation(0); }} > diff --git a/menu.js b/menu.js index b07ec58..3a222f1 100644 --- a/menu.js +++ b/menu.js @@ -29,6 +29,7 @@ import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"; import { CarouselBox } from "./components/Menu/Carousel/CarouselBox"; import { CarouselTypeChanger } from "./components/Menu/Carousel/CarouselTypeChanger"; import { useUserPosition } from "./stateBox/useUserPosition"; +import { AS } from "./storageControl"; configureReanimatedLogger({ level: ReanimatedLogLevel.error, // Set the log level to error strict: true, // Reanimated runs in strict mode by default @@ -49,6 +50,13 @@ export default function Menu({ const [stationListMode, setStationListMode] = useState( /*<"position"|"favorite">*/ "position" ); + useEffect(()=>{ + AS.getItem("stationListMode").then((res) => { + setStationListMode(res); + }).catch((e) => { + // AS.setItem("stationListMode", "position"); + }); + }, []); const mapsRef = useRef(null); const returnToTop = (bool = true) => { scrollRef.current.scrollTo({