Open Ledinhtl opened 1 year ago
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.
react-native-status-bar-height@2.6.0
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..8520a23 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,9 @@ 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 isIPhone14ProMax(): 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..100065d 100644 --- a/node_modules/react-native-status-bar-height/index.js +++ b/node_modules/react-native-status-bar-height/index.js @@ -4,6 +4,9 @@ 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 STATUSBAR_IP14PROMAX_HEIGHT = 50; const X_WIDTH = 375; const X_HEIGHT = 812; @@ -17,6 +20,15 @@ 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 IP14PROMAX_WIDTH = 430; +const IP14PROMAX_HEIGHT = 932; + const { height: W_HEIGHT, width: W_WIDTH } = Dimensions.get('window'); let statusBarHeight = STATUSBAR_DEFAULT_HEIGHT; @@ -24,6 +36,9 @@ 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 isIPhone14ProMax_v = false; let isIPhoneWithMonobrow_v = false; if (Platform.OS === 'ios' && !Platform.isPad && !Platform.isTVOS) { @@ -43,6 +58,18 @@ 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; + } else if (W_WIDTH === IP14PROMAX_WIDTH && W_HEIGHT === IP14PROMAX_HEIGHT) { + isIPhoneWithMonobrow_v = true; + isIPhone14ProMax_v = true; + statusBarHeight = STATUSBAR_IP14PROMAX_HEIGHT; } } @@ -50,6 +77,9 @@ 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 isIPhone14ProMax = () => isIPhone14ProMax_v; export const isIPhoneWithMonobrow = () => isIPhoneWithMonobrow_v; const getExpoRoot = () => global.Expo || global.__expo || global.__exponent;
This issue body was partially generated by patch-package.
China PHONEFIX can solve difficult mobile phone repair problems. If you are interested, you can learn more.
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:
This issue body was partially generated by patch-package.