From c45c58cc644a7fc5ae1d9389de4fe4ce60517793 Mon Sep 17 00:00:00 2001 From: harukin-OneMix4 Date: Mon, 12 Feb 2024 21:51:35 +0900 Subject: [PATCH] =?UTF-8?q?=E6=A8=AA=E6=96=B9=E5=90=91=E3=81=AE=E3=82=A2?= =?UTF-8?q?=E3=83=8B=E3=83=A1=E3=83=BC=E3=82=B7=E3=83=A7=E3=83=B3=E3=82=84?= =?UTF-8?q?=E8=A6=81=E7=B4=A0=E3=81=AE=E8=A2=AB=E3=82=8A=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apps.js | 85 ++++++++++++++++++- .../EachTrainInfo/TrainDataView.js | 2 +- .../EachTrainInfoCore.js | 41 +++++---- 3 files changed, 108 insertions(+), 20 deletions(-) diff --git a/Apps.js b/Apps.js index 2e3e09d..a405cb9 100644 --- a/Apps.js +++ b/Apps.js @@ -5,6 +5,7 @@ import { Text, TouchableOpacity, useWindowDimensions, + LayoutAnimation, } from "react-native"; import { WebView } from "react-native-webview"; import Constants from "expo-constants"; @@ -19,6 +20,7 @@ import { useFavoriteStation } from "./stateBox/useFavoriteStation"; import { useCurrentTrain } from "./stateBox/useCurrentTrain"; import { SheetManager } from "react-native-actions-sheet"; import TrainMenu from "./components/trainMenu"; +import { EachTrainInfoCore } from "./components/ActionSheetComponents/EachTrainInfoCore"; /* import StatusbarDetect from './StatusbarDetect'; var Status = StatusbarDetect(); */ @@ -186,6 +188,7 @@ export default function Apps({ navigation, webview, stationData }) { case "ShowTrainTimeInfo": { const { trainNum, limited } = dataSet; //alert(trainNum, limited); + LayoutAnimation.easeInEaseOut(); setTrainInfo({ trainNum, limited, @@ -193,6 +196,7 @@ export default function Apps({ navigation, webview, stationData }) { currentTrain.filter((a) => a.num == trainNum) ), }); //遅延情報は未実装 + if (isLandscape) return; const payload = { data: { trainNum, @@ -294,7 +298,7 @@ export default function Apps({ navigation, webview, stationData }) { }} onLayout={handleLayout} > - {isLandscape ? ( + {!trainInfo.trainData && isLandscape ? ( + {isLandscape && trainInfo.trainData && ( + + + + )} {isLandscape || ( navigate("trainMenu", { webview })} @@ -350,9 +373,23 @@ export default function Apps({ navigation, webview, stationData }) { mapSwitch={mapSwitch == "true" ? "flex" : "none"} /> )} + {isLandscape && trainInfo.trainData && ( + { + LayoutAnimation.easeInEaseOut(); + setTrainInfo({ + trainNum: undefined, + limited: undefined, + trainData: undefined, + }); + }} + top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} + /> + )} webview.current.reload()} top={Platform.OS == "ios" ? Constants.statusBarHeight : 0} + right={isLandscape && trainInfo.trainData ? (width / 100) * 40 : 0} LoadError={LoadError} /> @@ -395,12 +432,54 @@ const MapsButton = ({ onPress, top, mapSwitch }) => { ); }; -const ReloadButton = ({ onPress, top, mapSwitch, LoadError = false }) => { +const LandscapeBackButton = ({ onPress, top }) => { const styles = { touch: { position: "absolute", top, - right: 10, + left: 10, + width: 50, + height: 50, + backgroundColor: "#0099CC", + borderColor: "white", + borderStyle: "solid", + borderWidth: 1, + borderRadius: 50, + alignContent: "center", + alignSelf: "center", + alignItems: "center", + display: "flex", + }, + text: { + textAlign: "center", + width: "auto", + height: "auto", + textAlignVertical: "center", + fontWeight: "bold", + color: "white", + }, + }; + return ( + + + + + + ); +}; + +const ReloadButton = ({ + onPress, + top, + mapSwitch, + LoadError = false, + right, +}) => { + const styles = { + touch: { + position: "absolute", + top, + right: 10 + right, width: 50, height: 50, backgroundColor: LoadError ? "red" : "#0099CC", diff --git a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js index 6ac2eb7..e8a229e 100644 --- a/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js +++ b/components/ActionSheetComponents/EachTrainInfo/TrainDataView.js @@ -35,7 +35,7 @@ export const TrainDataView = ({ flexDirection: "row", //minHeight: 200, //height: heightPercentageToDP("20%"), - width: isLandscape ? width / 2 : width, + width: isLandscape ? (width / 100) * 40 : width, flex: 1, }} > diff --git a/components/ActionSheetComponents/EachTrainInfoCore.js b/components/ActionSheetComponents/EachTrainInfoCore.js index f20b8b6..029a48a 100644 --- a/components/ActionSheetComponents/EachTrainInfoCore.js +++ b/components/ActionSheetComponents/EachTrainInfoCore.js @@ -52,7 +52,7 @@ export const EachTrainInfoCore = ({ currentTrain.filter((d) => d.num == data.trainNum) ) ); - }, [currentTrain]); + }, [currentTrain, data.trainNum]); //bconst insets = useSafeAreaInsets(); @@ -232,7 +232,9 @@ export const EachTrainInfoCore = ({ setNearTrainIDList(returnArray); setShowNearTrain(TDArray); }, [data]); - const scrollHandlers = useScrollHandlers("scrollview-1", actionSheetRef); + const scrollHandlers = actionSheetRef + ? useScrollHandlers("scrollview-1", actionSheetRef) + : null; const migrateTrainName = (string) => { return string .replace("マリン", "マリンライナー") @@ -401,18 +403,20 @@ export const EachTrainInfoCore = ({ borderWidth: 1, }} > - - - + {isLandscape || ( + + + + )} {data.limited @@ -450,7 +454,8 @@ export const EachTrainInfoCore = ({ /> )} - {isLandscape ? ( + {/* {isLandscape */} + {false ? (