import React, { useEffect, useState } from "react"; import { View, Text, TouchableOpacity, useWindowDimensions, } from "react-native"; import { StateBox } from "./StateBox"; import { heightPercentageToDP, widthPercentageToDP, } from "react-native-responsive-screen"; export const TrainDataView = ({ currentTrainData, currentPosition, nearTrainIDList, 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]); return ( { if (nearTrainIDList.length == 0) return; openTrainInfo(nearTrainIDList[0]); }} > {nearTrainIDList.length == 0 ? ( ) : ( )} ); };