Permalink
Browse files

Using RCTExecuteOnMainQueue in RCTUIManager

Reviewed By: javache

Differential Revision: D5937423

fbshipit-source-id: 1b7f5976acdfdfd00c6aa5c13e80113ba1e04434
  • Loading branch information...
shergin authored and facebook-github-bot committed Oct 3, 2017
1 parent feba4f6 commit 9cd095eae8033fb889b3acc3c590ca61db841262
Showing with 5 additions and 5 deletions.
  1. +5 −5 React/Modules/RCTUIManager.m
@@ -88,7 +88,7 @@ - (void)invalidate
// This only accessed from the shadow queue
_pendingUIBlocks = nil;
dispatch_async(dispatch_get_main_queue(), ^{
RCTExecuteOnMainQueue(^{
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"UIManager invalidate", nil);
for (NSNumber *rootViewTag in self->_rootViewTags) {
[(id<RCTInvalidating>)self->_viewRegistry[rootViewTag] invalidate];
@@ -538,7 +538,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView *
if (RCTIsReactRootView(reactTag)) {
CGSize contentSize = shadowView.frame.size;
dispatch_async(dispatch_get_main_queue(), ^{
RCTExecuteOnMainQueue(^{
UIView *view = self->_viewRegistry[reactTag];
RCTAssert(view != nil, @"view (for ID %@) not found", reactTag);
@@ -953,7 +953,7 @@ - (void)_manageChildren:(NSNumber *)containerTag
// Dispatch view creation directly to the main thread instead of adding to
// UIBlocks array. This way, it doesn't get deferred until after layout.
__weak RCTUIManager *weakManager = self;
dispatch_async(dispatch_get_main_queue(), ^{
RCTExecuteOnMainQueue(^{
RCTUIManager *uiManager = weakManager;
if (!uiManager) {
return;
@@ -1119,7 +1119,7 @@ - (void)flushUIBlocks
if (previousPendingUIBlocks.count) {
// Execute the previously queued UI blocks
RCTProfileBeginFlowEvent();
dispatch_async(dispatch_get_main_queue(), ^{
RCTExecuteOnMainQueue(^{
RCTProfileEndFlowEvent();
RCT_PROFILE_BEGIN_EVENT(RCTProfileTagAlways, @"-[UIManager flushUIBlocks]", (@{
@"count": [@(previousPendingUIBlocks.count) stringValue],
@@ -1512,7 +1512,7 @@ - (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(UIView
RCTExecuteOnUIManagerQueue(^{
NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag;
dispatch_async(dispatch_get_main_queue(), ^{
RCTExecuteOnMainQueue(^{
UIView *rootView = nil;
if (rootTag != nil) {
rootView = [self viewForReactTag:rootTag];

0 comments on commit 9cd095e

Please sign in to comment.