Skip to content

Commit

Permalink
[RN][iOS] Fix race condition between A11yManager and UIManager
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi committed Jan 19, 2024
1 parent d2ac5d6 commit 38abcf3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/react-native/React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,13 @@ - (void)setBridge:(RCTBridge *)bridge
}

// This dispatch_async avoids a deadlock while configuring native modules
dispatch_async(dispatch_get_main_queue(), ^{
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
id a11yManager = [self->_bridge moduleForName:@"AccessibilityManager"
lazilyLoadIfNecessary:YES];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveNewContentSizeMultiplier)
name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification"
object:[self->_bridge moduleForName:@"AccessibilityManager"
lazilyLoadIfNecessary:YES]];
object:a11yManager];
});
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(namedOrientationDidChange)
Expand Down

0 comments on commit 38abcf3

Please sign in to comment.