mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
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
This commit is contained in:
parent
c4b948f62e
commit
36e0dd2d48
@ -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);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user