노치에 따른 분기처리 (ios,android)

Seonhee Kim·2023년 7월 12일
0

FYI

목록 보기
1/12

ios

import { getStatusBarHeight } from 'react-native-status-bar-height';

const statusBarHeight = getStatusBarHeight(true);
// 노치가 없는 기종의 높이는 20이 나온다.

statusBarHeight 차이에 따라 아이폰 8과 13을 구분하여 스타일을 주었다.

style={
	Platform.OS === 'ios'
	    ? statusBarHeight === 20
	      ? styles.chat_ios_08
	      : styles.chat_ios_13
	    : styles.chat_android
}

android

import { StatusBar } from 'react-native';

const statusBarHeight = StatusBar.currentHeight;
profile
안녕하세요 ~_~

0개의 댓글