해당 API는 어플리케이션 창의 크기를 구할 수 있도록 도움을 준다.

<aside> 💡 import {Dimensions} from 'react-native';

</aside>

아래와 같이 사용할 수 있다.

const windowWidth = Dimensions.get('window').width;
const windowHeight = Dimensions.get('window').height;

const {width: SCREEN_WIDTH, height: SCREEN_HEIGHT} = Dimensions.get('window')

window와 screen의 차이

const windowWidth = Dimensions.get('window').width;
const windowWidth = Dimensions.get('screen').width;

window는 어플리케이션 창의 크기를 반환하고, screen은 사용 기기의 디스플레이 크기를 반환한다.

PC로 확인 되는 차이

PC로 확인 되는 차이