Skip to content

Commit

Permalink
Making RCTIsIPhoneX() return true for the R and Max models
Browse files Browse the repository at this point in the history
Summary: Actual sizes can be found on the offical website.

Reviewed By: fkgozali

Differential Revision: D9837072

fbshipit-source-id: 38b3f2177629e82740eecc8df4566febbe20815a
  • Loading branch information
shergin authored and facebook-github-bot committed Sep 17, 2018
1 parent e82a217 commit 5e7c3ca
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions React/Modules/RCTDeviceInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5e7c3ca

Please sign in to comment.