Skip to content

Commit

Permalink
Ensure preferredContentSizeCategory is only called from the main thread
Browse files Browse the repository at this point in the history
  • Loading branch information
paddlefish authored and mikehardy committed Oct 31, 2019
1 parent 2dced2b commit 5db7c09
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ios/RNDeviceInfo/RNDeviceInfo.m
Expand Up @@ -382,7 +382,10 @@ - (float) getFontScale {

// Shared application is unavailable in an app extension.
if (application) {
NSString *contentSize = application.preferredContentSizeCategory;
__block NSString *contentSize = nil;
RCTUnsafeExecuteOnMainQueueSync(^{
contentSize = application.preferredContentSizeCategory;
});

if ([contentSize isEqual: @"UICTContentSizeCategoryXS"]) fontScale = 0.82;
else if ([contentSize isEqual: @"UICTContentSizeCategoryS"]) fontScale = 0.88;
Expand Down

0 comments on commit 5db7c09

Please sign in to comment.