From feba4f6a92dc2d411b0803764acce498e6755d87 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Mon, 2 Oct 2017 18:07:42 -0700 Subject: [PATCH] Using RCTExecuteOnUIManagerQueue convinient func in all conseptually identical cases Summary: Reasons: * It is more clear and readable; * It is more semantical; * It allows us to add some magic (and complexity, to be fair) to the RCTExecuteOnUIManagerQueue. (See next diffs in the stack.) Reviewed By: javache Differential Revision: D5935466 fbshipit-source-id: aeb18d6e11c047eb19182a656da581b6ce073602 --- React/Modules/RCTUIManager.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index b22453b93..47cefa906 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -174,7 +174,7 @@ RCT_EXPORT_MODULE() body:@([_bridge.accessibilityManager multiplier])]; #pragma clang diagnostic pop - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ [[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification object:self]; [self setNeedsLayout]; @@ -259,7 +259,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) _viewRegistry[reactTag] = rootView; // Register shadow view - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ if (!self->_viewRegistry) { return; } @@ -296,7 +296,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) { RCTAssertMainQueue(); NSNumber *reactTag = rootView.reactTag; - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ RCTRootShadowView *shadowView = (RCTRootShadowView *)self->_shadowViewRegistry[reactTag]; RCTAssert(shadowView != nil, @"Could not locate shadow view with tag #%@", reactTag); RCTAssert([shadowView isKindOfClass:[RCTRootShadowView class]], @"Located shadow view (with tag #%@) is actually not root view.", reactTag); @@ -315,7 +315,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) RCTAssertMainQueue(); NSNumber *tag = view.reactTag; - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ RCTShadowView *shadowView = self->_shadowViewRegistry[tag]; RCTAssert(shadowView != nil, @"Could not locate shadow view with tag #%@", tag); @@ -356,7 +356,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) RCTAssertMainQueue(); NSNumber *reactTag = view.reactTag; - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag]; RCTAssert(shadowView != nil, @"Could not locate shadow view with tag #%@", reactTag); @@ -374,7 +374,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) RCTAssertMainQueue(); NSNumber *reactTag = view.reactTag; - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ RCTShadowView *shadowView = self->_shadowViewRegistry[reactTag]; if (shadowView == nil) { RCTLogWarn(@"Could not locate shadow view with tag #%@, this is probably caused by a temporary inconsistency between native views and shadow views.", reactTag); @@ -393,7 +393,7 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation) RCTAssertMainQueue(); NSNumber *reactTag = view.reactTag; - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ if (!self->_viewRegistry) { return; } @@ -1510,7 +1510,7 @@ RCT_EXPORT_METHOD(configureNextLayoutAnimation:(NSDictionary *)config return; } - dispatch_async(RCTGetUIManagerQueue(), ^{ + RCTExecuteOnUIManagerQueue(^{ NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag; dispatch_async(dispatch_get_main_queue(), ^{ UIView *rootView = nil;