From 12f23bef165e3111ca2be6048d4555ea02f9caac Mon Sep 17 00:00:00 2001 From: harukin-DeskMini Date: Wed, 1 Feb 2023 15:25:33 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=81=B5=E3=81=81=E3=81=BC=E9=A7=85?= =?UTF-8?q?=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4(=E7=8F=BE=E5=9C=A8=E5=9C=B0?= =?UTF-8?q?=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.js | 6 +++ .../StationDeteilView.js | 25 ++++++++---- components/駅名表/Sign.js | 3 -- menu.js | 39 +++++++++++++------ 4 files changed, 52 insertions(+), 21 deletions(-) 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..0789af4 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, @@ -119,6 +120,9 @@ 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); useEffect(() => { fetch( @@ -141,7 +145,7 @@ export default function Menu(props) { > - + + { + return ( + + + + ); + }} + /> {currentStation && ( - <> - - - + )} Date: Wed, 1 Feb 2023 16:57:49 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E9=A7=85=E5=90=8D=E6=9D=BF=E3=82=92=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E3=81=97=E3=81=9FLED=E8=A1=A8=E7=A4=BA=E3=81=A8=E9=81=B8?= =?UTF-8?q?=E6=8A=9E=E7=94=BB=E9=9D=A2=E3=81=AE=E6=95=B4=E5=82=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- menu.js | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/menu.js b/menu.js index 0789af4..5a30294 100644 --- a/menu.js +++ b/menu.js @@ -74,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); @@ -123,6 +131,7 @@ export default function Menu(props) { const carouselRef = useRef(); const scrollRef = useRef(); const [isScroll, setIsScroll] = useState(true); + const [selectedCurrentStation, setSelectedCurrentStation] = useState(0); useEffect(() => { fetch( @@ -166,11 +175,20 @@ export default function Menu(props) { { + setSelectedCurrentStation(d); + }} renderItem={({ item, index }) => { return ( @@ -185,8 +203,16 @@ export default function Menu(props) { ); }} /> - {currentStation && ( - + {(currentStation || originalStationList) && ( + )}