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({