Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/commons/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
NativeModules,
I18nManager,
AccessibilityInfo,
AccessibilityChangeEvent
AccessibilityChangeEvent,
StatusBar
} from 'react-native';

export enum orientations {
Expand Down Expand Up @@ -34,14 +35,14 @@ let breakpoints: Breakpoint[];
let defaultMargin = 0;

const isSubWindow = windowWidth < screenWidth;
//@ts-ignore
isTablet = Platform.isPad || (getAspectRatio() < 1.6 && Math.max(screenWidth, screenHeight) >= 900);
isTablet =
(Platform.OS === 'ios' && Platform.isPad) || (getAspectRatio() < 1.6 && Math.max(screenWidth, screenHeight) >= 900);

function setStatusBarHeight() {
const {StatusBarManager} = NativeModules;
statusBarHeight = StatusBarManager?.HEIGHT || 0; // So there will be a value for any case
if (isIOS) {
statusBarHeight = (StatusBar.currentHeight ?? StatusBarManager?.HEIGHT) || 0;

if (isIOS && StatusBarManager) {
// override guesstimate height with the actual height from StatusBarManager
StatusBarManager.getHeight((data:{height:number}) => (statusBarHeight = data.height));
}
Expand Down Expand Up @@ -125,7 +126,7 @@ const constants = {
return screenHeight <= 600;
},
get isWideScreen() {
return isTablet && !isSubWindow || this.isLandscape;
return (isTablet && !isSubWindow) || this.isLandscape;
},
get screenAspectRatio() {
return getAspectRatio();
Expand Down