From 36e0dd2d483ded2764af1a31abcceaaaf136cfa0 Mon Sep 17 00:00:00 2001 From: Nick Lockwood Date: Fri, 22 Jan 2016 08:18:15 -0800 Subject: [PATCH] Fixed screen size bug on iPhone6+ Summary: public This diff fixes a bug in RCTScreenScale() on iPhone6+. The issue was due to the fact that the iPhone6+'s virtual screen resolution of 414x736 points 3x resolution (1242x2208 pixels) does not match its actual screen resolution, which is 1080p (1080x1920 pixels). I did not realize that `[UIScreen mainScreen].nativeBounds` reports the *actual* resolution, not the virtual resolution, and was dividing by the virtual scale (3.0) instead of the actual native scale factor (2.6). This only affects iPhone6+, because for all other iOS devices, the virtual resolution matches the native resolution. Reviewed By: milend Differential Revision: D2854663 fb-gh-sync-id: bce8965a151e2f005a02a5f6b54f259d01b9ab12 --- React/Base/RCTUtils.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index 7040aa1fe..d2a0916b3 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -219,13 +219,7 @@ CGSize RCTScreenSize() static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ RCTExecuteOnMainThread(^{ - if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedDescending) { - CGSize pixelSize = [UIScreen mainScreen].nativeBounds.size; - CGFloat scale = RCTScreenScale(); - size = (CGSize){pixelSize.width / scale, pixelSize.height / scale}; - } else { - size = [UIScreen mainScreen].bounds.size; - } + size = [UIScreen mainScreen].bounds.size; }, YES); });