diff --git a/App.js b/App.js index bfa3ca2..0163eba 100644 --- a/App.js +++ b/App.js @@ -19,6 +19,12 @@ import News from "./components/news.js"; import Setting from "./components/settings.js"; import TrainMenu from "./components/trainMenu.js"; import FavoriteList from "./components/FavoriteList.js"; +import { LogBox } from "react-native"; + +LogBox.ignoreLogs([ + "ViewPropTypes will be removed", + "ColorPropType will be removed", +]); const Stack = createStackNavigator(); const Tab = createBottomTabNavigator(); if (Platform.OS === "android") { diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index bc0fafa..3b1b05c 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -5,6 +5,10 @@ import ActionSheet from "react-native-actions-sheet"; import Sign from "../../components/駅名表/Sign"; import { TicketBox } from "../atom/TicketBox"; +import { + widthPercentageToDP as wp, + heightPercentageToDP as hp, +} from "react-native-responsive-screen"; export const StationDeteilView = (props) => { const { @@ -44,13 +48,20 @@ export const StationDeteilView = (props) => { {currentStation && ( - Linking.openURL(currentStation[0].StationTimeTable)} - /> + + Linking.openURL(currentStation[0].StationTimeTable)} + /> + )} {currentStation && ( diff --git a/components/駅名表/Sign.js b/components/駅名表/Sign.js index 8c1fc1f..3d0484c 100644 --- a/components/駅名表/Sign.js +++ b/components/駅名表/Sign.js @@ -40,7 +40,6 @@ export default function Sign(props) { return false; } }); - console.log(isFavorite.length); setTestButtonStatus(isFavorite.length != 0); }, [favoriteStation, currentStation]); @@ -260,8 +259,6 @@ const styleSheet = { height: (wp("80%") / 20) * 9, borderColor: "#2E94BB", borderWidth: 1, - margin: 10, - marginHorizontal: wp("10%"), backgroundColor: "white", }, 下帯: { diff --git a/menu.js b/menu.js index 6deeb0a..5a30294 100644 --- a/menu.js +++ b/menu.js @@ -1,4 +1,5 @@ import React, { useRef, useState, useEffect } from "react"; +import Carousel from "react-native-snap-carousel"; import { Platform, View, @@ -73,6 +74,14 @@ export default function Menu(props) { useEffect(() => { getStationList().then(setOriginalStationList); }, []); + const [locationAndFavorite, setLocationAndFavorite] = useState([]); + useEffect(() => { + if (!favoriteStation) return () => {}; + const data = favoriteStation.filter((d) => + JSON.stringify(d) === JSON.stringify(currentStation) ? false : true + ); + setLocationAndFavorite(data); + }, [currentStation, favoriteStation]); const [stationName, setStationName] = useState(undefined); const [currentStation, setCurrentStation] = useState(undefined); @@ -119,6 +128,10 @@ export default function Menu(props) { const [delayData, setDelayData] = useState(undefined); const [getTime, setGetTime] = useState(new Date()); const [loadingDelayData, setLoadingDelayData] = useState(true); + const carouselRef = useRef(); + const scrollRef = useRef(); + const [isScroll, setIsScroll] = useState(true); + const [selectedCurrentStation, setSelectedCurrentStation] = useState(0); useEffect(() => { fetch( @@ -141,7 +154,7 @@ export default function Menu(props) { > - + - {currentStation && ( - <> - - - + { + setSelectedCurrentStation(d); + }} + renderItem={({ item, index }) => { + return ( + + + + ); + }} + /> + {(currentStation || originalStationList) && ( + )}