From 5e7c3ca0057f6084d692e30ae4db863fb20968ff Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Sun, 16 Sep 2018 21:38:47 -0700 Subject: [PATCH] Making RCTIsIPhoneX() return true for the R and Max models Summary: Actual sizes can be found on the offical website. Reviewed By: fkgozali Differential Revision: D9837072 fbshipit-source-id: 38b3f2177629e82740eecc8df4566febbe20815a --- React/Modules/RCTDeviceInfo.m | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/React/Modules/RCTDeviceInfo.m b/React/Modules/RCTDeviceInfo.m index 7c30ac201..1be4fcd87 100644 --- a/React/Modules/RCTDeviceInfo.m +++ b/React/Modules/RCTDeviceInfo.m @@ -58,10 +58,15 @@ static BOOL RCTIsIPhoneX() { dispatch_once(&onceToken, ^{ RCTAssertMainQueue(); - isIPhoneX = CGSizeEqualToSize( - [UIScreen mainScreen].nativeBounds.size, - CGSizeMake(1125, 2436) - ); + CGSize screenSize = [UIScreen mainScreen].nativeBounds.size; + CGSize iPhoneXScreenSize = CGSizeMake(1125, 2436); + CGSize iPhoneXMaxScreenSize = CGSizeMake(1242, 2688); + CGSize iPhoneXRScreenSize = CGSizeMake(828, 1792); + + isIPhoneX = + CGSizeEqualToSize(screenSize, iPhoneXScreenSize) || + CGSizeEqualToSize(screenSize, iPhoneXMaxScreenSize) || + CGSizeEqualToSize(screenSize, iPhoneXRScreenSize); }); return isIPhoneX;