Skip to content

IPHONE 14 Pro issue resolved #48

@Hassan-Naeem-code

Description

@Hassan-Naeem-code

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-status-bar-height@2.6.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-status-bar-height/index.d.ts b/node_modules/react-native-status-bar-height/index.d.ts
index 3618a5e..3967bf7 100644
--- a/node_modules/react-native-status-bar-height/index.d.ts
+++ b/node_modules/react-native-status-bar-height/index.d.ts
@@ -5,6 +5,8 @@ declare module 'react-native-status-bar-height' {
     export function isIPhoneXMax(): boolean
     export function isIPhone12(): boolean
     export function isIPhone12Max(): boolean
+    export function isIPhone14(): boolean
+    export function isIPhone14Max(): boolean
     export function isIPhoneWithMonobrow(): boolean
     export function isExpo(): boolean;
 }
diff --git a/node_modules/react-native-status-bar-height/index.js b/node_modules/react-native-status-bar-height/index.js
index 08fd56b..8a92363 100644
--- a/node_modules/react-native-status-bar-height/index.js
+++ b/node_modules/react-native-status-bar-height/index.js
@@ -4,6 +4,8 @@ const STATUSBAR_DEFAULT_HEIGHT = 20;
 const STATUSBAR_X_HEIGHT = 44;
 const STATUSBAR_IP12_HEIGHT = 47;
 const STATUSBAR_IP12MAX_HEIGHT = 47;
+const STATUSBAR_IP14_HEIGHT = 54;
+const STATUSBAR_IP14MAX_HEIGHT = 47;
 
 const X_WIDTH = 375;
 const X_HEIGHT = 812;
@@ -17,6 +19,12 @@ const IP12_HEIGHT = 844;
 const IP12MAX_WIDTH = 428;
 const IP12MAX_HEIGHT = 926;
 
+const IP14_WIDTH = 393;
+const IP14_HEIGHT = 852;
+
+const IP14MAX_WIDTH = 428;
+const IP14MAX_HEIGHT = 926;
+
 const { height: W_HEIGHT, width: W_WIDTH } = Dimensions.get('window');
 
 let statusBarHeight = STATUSBAR_DEFAULT_HEIGHT;
@@ -24,6 +32,8 @@ let isIPhoneX_v = false;
 let isIPhoneXMax_v = false;
 let isIPhone12_v = false;
 let isIPhone12Max_v = false;
+let isIPhone14_v = false;
+let isIPhone14Max_v = false;
 let isIPhoneWithMonobrow_v = false;
 
 if (Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS) {
@@ -43,6 +53,14 @@ if (Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS) {
         isIPhoneWithMonobrow_v = true;
         isIPhone12Max_v = true;
         statusBarHeight = STATUSBAR_IP12MAX_HEIGHT;
+    } else if (W_WIDTH === IP14_WIDTH && W_HEIGHT === IP14_HEIGHT) {
+        isIPhoneWithMonobrow_v = true;
+        isIPhone14_v = true;
+        statusBarHeight = STATUSBAR_IP14_HEIGHT;
+    } else if (W_WIDTH === IP14MAX_WIDTH && W_HEIGHT === IP14MAX_HEIGHT) {
+        isIPhoneWithMonobrow_v = true;
+        isIPhone14Max_v = true;
+        statusBarHeight = STATUSBAR_IP14MAX_HEIGHT;
     }
 }
 
@@ -50,6 +68,8 @@ export const isIPhoneX = () =>  isIPhoneX_v;
 export const isIPhoneXMax = () =>  isIPhoneXMax_v;
 export const isIPhone12 = () =>  isIPhone12_v;
 export const isIPhone12Max = () =>  isIPhone12Max_v;
+export const isIPhone14 = () =>  isIPhone14_v;
+export const isIPhone14Max = () =>  isIPhone14Max_v;
 export const isIPhoneWithMonobrow = () => isIPhoneWithMonobrow_v;
 
 const getExpoRoot = () => global.Expo || global.__expo || global.__exponent;

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions