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 f39f34e
Show file tree
Hide file tree
Showing 2 changed files with 246 additions and 245 deletions.
7 changes: 4 additions & 3 deletions packages/react-native/React/Modules/RCTUIManager.m
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 f39f34e

Please sign in to comment.