mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 12:25:59 +08:00
Migrate DeviceInfoModule from RN Module to Native Function.
Reviewed By: danzimm Differential Revision: D6750934 fbshipit-source-id: f453801737e41632c6b84ff894e7f0eb66b575dc
This commit is contained in:
committed by
Facebook Github Bot
parent
6224ef5301
commit
429fcc8cab
@@ -12,6 +12,7 @@
|
||||
#import "RCTAccessibilityManager.h"
|
||||
#import "RCTAssert.h"
|
||||
#import "RCTEventDispatcher.h"
|
||||
#import "RCTUIUtils.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
@implementation RCTDeviceInfo {
|
||||
@@ -72,18 +73,18 @@ static NSDictionary *RCTExportedDimensions(RCTBridge *bridge)
|
||||
{
|
||||
RCTAssertMainQueue();
|
||||
|
||||
// Don't use RCTScreenSize since it the interface orientation doesn't apply to it
|
||||
CGRect screenSize = [[UIScreen mainScreen] bounds];
|
||||
NSDictionary *dims = @{
|
||||
@"width": @(screenSize.size.width),
|
||||
@"height": @(screenSize.size.height),
|
||||
@"scale": @(RCTScreenScale()),
|
||||
@"fontScale": @(bridge.accessibilityManager.multiplier)
|
||||
};
|
||||
RCTDimensions dimensions = RCTGetDimensions(bridge.accessibilityManager.multiplier);
|
||||
typeof (dimensions.window) window = dimensions.window; // Window and Screen are considered equal for iOS.
|
||||
NSDictionary<NSString *, NSNumber *> *dims = @{
|
||||
@"width": @(window.width),
|
||||
@"height": @(window.height),
|
||||
@"scale": @(window.scale),
|
||||
@"fontScale": @(window.fontScale)
|
||||
};
|
||||
return @{
|
||||
@"window": dims,
|
||||
@"screen": dims
|
||||
};
|
||||
@"window": dims,
|
||||
@"screen": dims
|
||||
};
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
|
||||
Reference in New Issue
Block a user