回転判定の移動、コードの部分共通化
This commit is contained in:
@@ -1,15 +1,7 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
import {
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
useWindowDimensions,
|
||||
} from "react-native";
|
||||
import React from "react";
|
||||
import { View, TouchableOpacity, useWindowDimensions } from "react-native";
|
||||
import { StateBox } from "./StateBox";
|
||||
import {
|
||||
heightPercentageToDP,
|
||||
widthPercentageToDP,
|
||||
} from "react-native-responsive-screen";
|
||||
import { useDeviceOrientationChange } from "../../../stateBox/useDeviceOrientationChange";
|
||||
|
||||
export const TrainDataView = ({
|
||||
currentTrainData,
|
||||
@@ -18,16 +10,8 @@ export const TrainDataView = ({
|
||||
openTrainInfo,
|
||||
mode = 0,
|
||||
}) => {
|
||||
const [isLandscape, setIsLandscape] = useState(false);
|
||||
const { width, height } = useWindowDimensions();
|
||||
useEffect(() => {
|
||||
if (height / width > 1.5) {
|
||||
setIsLandscape(false);
|
||||
}
|
||||
if (height / width < 1.5) {
|
||||
setIsLandscape(true);
|
||||
}
|
||||
}, [width, height]);
|
||||
const { isLandscape } = useDeviceOrientationChange();
|
||||
|
||||
return (
|
||||
<View
|
||||
|
Reference in New Issue
Block a user