Skip to content

Commit f9b1430

Browse files
M-i-k-e-lInbal-Tish
authored andcommitted
Add isTablet to Constants (#499)
* Add isTablet to Constants * Rename and remove export
1 parent 2c8ea55 commit f9b1430

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/helpers/Constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const dimensionsScope = {
66
WINDOW: 'window',
77
SCREEN: 'screen'
88
}
9-
const orientations = {
9+
export const orientations = {
1010
PORTRAIT: 'portrait',
1111
LANDSCAPE: 'landscape'
1212
}
@@ -35,11 +35,13 @@ function setStatusBarHeight() {
3535
export const isRTL = I18nManager.isRTL;
3636

3737
const {height, width} = Dimensions.get(dimensionsScope.WINDOW);
38+
const screenAspectRatio = screenWidth < screenHeight ? screenHeight / screenWidth : screenWidth / screenHeight;
3839
export let orientation = getOrientation(height, width);
3940
export let screenWidth = width;
4041
export let screenHeight = height;
4142
export let isSmallScreen = screenWidth <= 340;
4243
export let isShortScreen = screenHeight <= 600;
44+
export const isTablet = Platform.isPad || (screenAspectRatio < 1.6 && Math.max(screenWidth, screenHeight) >= 900);
4345

4446
export function getSafeAreaInsets() {
4547
return (orientation === orientation.LANDSCAPE) ?

0 commit comments

Comments
 (0)