diff --git a/Apps.js b/Apps.js
index 84c25ff..0325832 100644
--- a/Apps.js
+++ b/Apps.js
@@ -1,8 +1,25 @@
-import React, { useEffect, useRef, useState } from "react";
-import { View, Platform, Text, TouchableOpacity } from "react-native";
+import React, {
+ useEffect,
+ useLayoutEffect,
+ useRef,
+ useState,
+ useCallback,
+} from "react";
+import {
+ View,
+ Platform,
+ Text,
+ TouchableOpacity,
+ useWindowDimensions,
+} from "react-native";
import { WebView } from "react-native-webview";
import Constants from "expo-constants";
import { Ionicons } from "@expo/vector-icons";
+
+import {
+ widthPercentageToDP as wp,
+ heightPercentageToDP as hp,
+} from "react-native-responsive-screen";
import { AS } from "./storageControl";
import { news } from "./config/newsUpdate";
import { getStationList, lineList } from "./lib/getStationList";
@@ -11,15 +28,30 @@ import { checkDuplicateTrainData } from "./lib/checkDuplicateTrainData";
import { useFavoriteStation } from "./stateBox/useFavoriteStation";
import { useCurrentTrain } from "./stateBox/useCurrentTrain";
import { SheetManager } from "react-native-actions-sheet";
+import TrainMenu from "./components/trainMenu";
/*
import StatusbarDetect from './StatusbarDetect';
var Status = StatusbarDetect(); */
export default function Apps({ navigation, webview, stationData }) {
const { currentTrain } = useCurrentTrain();
+ const { height, width } = useWindowDimensions();
const { navigate } = navigation;
var urlcache = "";
const { favoriteStation } = useFavoriteStation();
+ const [isLandscape, setIsLandscape] = useState(false); //画面が横向きかどうか
+ const handleLayout = () => {};
+ useEffect(() => {
+ console.log("レイアウト変更");
+ console.log(height, width);
+ console.log(height / width);
+ if (height / width > 1.5) {
+ setIsLandscape(false);
+ }
+ if (height / width < 1.5) {
+ setIsLandscape(true);
+ }
+ }, [height, width]);
//画面表示関連
const [iconSetting, setIconSetting] = useState(undefined);
@@ -271,8 +303,22 @@ export default function Apps({ navigation, webview, stationData }) {
style={{
height: "100%",
paddingTop: Platform.OS == "ios" ? Constants.statusBarHeight : 0,
+ flexDirection: isLandscape ? "row" : "column",
}}
+ onLayout={handleLayout}
>
+ {isLandscape ? (
+
+ ) : null}
{/* {Status} */}
- navigate("trainMenu", { webview })}
- top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
- mapSwitch={mapSwitch == "true" ? "flex" : "none"}
- />
+ {isLandscape || (
+ navigate("trainMenu", { webview })}
+ top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
+ mapSwitch={mapSwitch == "true" ? "flex" : "none"}
+ />
+ )}
webview.current.reload()}
top={Platform.OS == "ios" ? Constants.statusBarHeight : 0}
diff --git a/app.json b/app.json
index 1686ab8..19aa076 100644
--- a/app.json
+++ b/app.json
@@ -8,7 +8,7 @@
"android"
],
"version": "4.6",
- "orientation": "portrait",
+ "orientation": "default",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
diff --git a/components/trainMenu.js b/components/trainMenu.js
index 3069e1d..3702c6f 100644
--- a/components/trainMenu.js
+++ b/components/trainMenu.js
@@ -6,10 +6,11 @@ export default function TrainMenu({
navigation: { navigate },
webview,
stationData,
+ style,
}) {
const mapRef = useRef();
return (
-
+
);
})
)}
-
-
- navigate("howto", {
- info: "https://train.jr-shikoku.co.jp/usage.htm",
- })
- }
+ {navigate && (
+
+
+ navigate("howto", {
+ info: "https://train.jr-shikoku.co.jp/usage.htm",
+ })
+ }
+ >
+ 使い方
+
+ navigate("favoriteList")}
+ >
+ お気に入り
+
+
+ Linking.openURL(
+ "https://nexcloud.haruk.in/apps/forms/ZRHjWFF7znr5Xjr2"
+ )
+ }
+ >
+ フィードバック
+
+
+ )}
+ {navigate && (
+ navigate("Apps")}
>
- 使い方
-
- navigate("favoriteList")}
- >
- お気に入り
-
-
- Linking.openURL(
- "https://nexcloud.haruk.in/apps/forms/ZRHjWFF7znr5Xjr2"
- )
- }
- >
- この機能のフィードバック
-
-
- navigate("Apps")}
- >
-
-
- 閉じる
-
-
-
+
+
+ 閉じる
+
+
+
+ )}
);
}
@@ -115,14 +120,14 @@ const UsefulBox = (props) => {
style={{
flex: flex,
backgroundColor: backgroundColor,
- padding: 10,
+ padding: 5,
alignItems: "center",
margin: 2,
}}
onPress={onPressButton}
>
-
+
{children}