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
This commit is contained in:
Valentin Shergin 2018-09-16 21:38:47 -07:00 committed by Facebook Github Bot
parent e82a2178af
commit 5e7c3ca005
1 changed files with 9 additions and 4 deletions

View File

@ -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;