From 704c6c6bada682ec7e9008a775f4719fd1d0bd00 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Thu, 21 Jan 2021 15:00:39 -0500 Subject: fixed isIPhoneX and adjusted spacing --- src/utils/statusBarHeight.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/utils') diff --git a/src/utils/statusBarHeight.ts b/src/utils/statusBarHeight.ts index b8eb7b33..c5509376 100644 --- a/src/utils/statusBarHeight.ts +++ b/src/utils/statusBarHeight.ts @@ -1,15 +1,14 @@ import {Platform, StatusBar} from 'react-native'; import {SCREEN_HEIGHT, SCREEN_WIDTH} from './screenDimensions'; -const X_WIDTH = 375; -const X_HEIGHT = 812; -const XSMAX_WIDTH = 414; -const XSMAX_HEIGHT = 896; - +/** + * Working as of Q1 2021, latest iPhone is 12 + * iPhone 8/SE has a logical screen ratio of about 1.77 + * Rest has a logical screen ratio of about 2.16 + */ export const isIPhoneX = () => Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS - ? (SCREEN_WIDTH === X_WIDTH && SCREEN_HEIGHT === X_HEIGHT) || - (SCREEN_WIDTH === XSMAX_WIDTH && SCREEN_HEIGHT === XSMAX_HEIGHT) + ? SCREEN_HEIGHT / SCREEN_WIDTH > 2 : false; // Taken from: https://github.com/react-navigation/react-navigation/issues/283 -- cgit v1.2.3-70-g09d2