A couple of checks for corner cases in RCTGetDimensions and RCTExportedDimensions
Summary: We need this checks to make the results of those function more reliable. Reviewed By: sammy-SC Differential Revision: D24038911 fbshipit-source-id: 3b54fe3056c9508cde84ea157beebea57e7e49b6
This commit is contained in:
Родитель
9a2a4ba579
Коммит
e853722981
|
@ -93,7 +93,8 @@ static BOOL RCTIsIPhoneX()
|
|||
static NSDictionary *RCTExportedDimensions(RCTBridge *bridge)
|
||||
{
|
||||
RCTAssertMainQueue();
|
||||
RCTDimensions dimensions = RCTGetDimensions(bridge.accessibilityManager.multiplier);
|
||||
RCTAssert(bridge, @"Bridge must not be `nil`.");
|
||||
RCTDimensions dimensions = RCTGetDimensions(bridge.accessibilityManager.multiplier ?: 1.0);
|
||||
__typeof(dimensions.window) window = dimensions.window;
|
||||
NSDictionary<NSString *, NSNumber *> *dimsWindow = @{
|
||||
@"width" : @(window.width),
|
||||
|
|
|
@ -16,7 +16,8 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale)
|
|||
|
||||
UIView *mainWindow;
|
||||
mainWindow = RCTKeyWindow();
|
||||
CGSize windowSize = mainWindow.bounds.size;
|
||||
// We fallback to screen size if a key window is not found.
|
||||
CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize;
|
||||
|
||||
RCTDimensions result;
|
||||
typeof(result.screen) dimsScreen = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче