const 테블릿 = () => { // 테블릿인지 아닌지 판별하기 위해 구현
let aspectRatio = window.height / window.width;
return window.width > 500 && aspectRatio < 1.6;
};
useEffect(() => {
const 테블릿을 판별하기위한 변수 = 테블릿();
if (테블릿을 판별하기위한 변수) {
Orientation.unlockAllOrientations(); // 테블릿 가로, 세로 회전을 허용
}
else {
Orientation.lockToPortrait(); // 인치가 작은 스마트폰 세로모드로 고정
}
return () => {
Orientation.unlockAllOrientations(); // 컴포넌트 언마운트 시 방향 설정 초기화
};
}, []);