Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPHONE 14 Pro issue resolved #48

Open
Hassan-Naeem-code opened this issue Nov 24, 2022 · 3 comments
Open

IPHONE 14 Pro issue resolved #48

Hassan-Naeem-code opened this issue Nov 24, 2022 · 3 comments

Comments

@Hassan-Naeem-code
Copy link

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] 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.

@devym-37
Copy link

@Hassan-Naeem-code I forked this project. and release new npm. this project supported additional 13mini https://www.npmjs.com/package/react-native-safearea-height

@gnuh96
Copy link

gnuh96 commented May 4, 2023

i still have a value 20 on iphone 14 pro, in https://www.npmjs.com/package/react-native-safearea-height with package react-native-safearea-height it return 59 instead of 49

@devym-37
Copy link

@gnuh96 I created the height using their site as a reference
https://useyourloaf.com/blog/iphone-14-screen-sizes/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants