aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-01-21 15:00:39 -0500
committerIvan Chen <ivan@tagg.id>2021-01-21 15:00:39 -0500
commit704c6c6bada682ec7e9008a775f4719fd1d0bd00 (patch)
tree0cdd4fb0720abc2e54c2a0470b3a207090d6d859 /src/utils
parent30a7a34f8c5eb379de4e5ebe38cfeeb259f3f1e3 (diff)
fixed isIPhoneX and adjusted spacing
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/statusBarHeight.ts13
1 files changed, 6 insertions, 7 deletions
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