Skip to content

Commit

Permalink
Using RCTExecuteOnUIManagerQueue convinient func in all conseptually …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
shergin authored and facebook-github-bot committed Oct 3, 2017
1 parent be27f44 commit feba4f6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions React/Modules/RCTUIManager.m
Expand Up @@ -174,7 +174,7 @@ - (void)didReceiveNewContentSizeMultiplier
body:@([_bridge.accessibilityManager multiplier])];
#pragma clang diagnostic pop

dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
[[NSNotificationCenter defaultCenter] postNotificationName:RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotification
object:self];
[self setNeedsLayout];
Expand Down Expand Up @@ -259,7 +259,7 @@ - (void)registerRootView:(RCTRootContentView *)rootView
_viewRegistry[reactTag] = rootView;

// Register shadow view
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
if (!self->_viewRegistry) {
return;
}
Expand Down Expand Up @@ -296,7 +296,7 @@ - (void)setAvailableSize:(CGSize)availableSize forRootView:(UIView *)rootView
{
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);
Expand All @@ -315,7 +315,7 @@ - (void)setLocalData:(NSObject *)localData forView:(UIView *)view
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);

Expand Down Expand Up @@ -356,7 +356,7 @@ - (void)setSize:(CGSize)size forView:(UIView *)view
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);

Expand All @@ -374,7 +374,7 @@ - (void)setIntrinsicContentSize:(CGSize)size forView:(UIView *)view
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);
Expand All @@ -393,7 +393,7 @@ - (void)setBackgroundColor:(UIColor *)color forView:(UIView *)view
RCTAssertMainQueue();

NSNumber *reactTag = view.reactTag;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
if (!self->_viewRegistry) {
return;
}
Expand Down Expand Up @@ -1510,7 +1510,7 @@ - (void)rootViewForReactTag:(NSNumber *)reactTag withCompletion:(void (^)(UIView
return;
}

dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
NSNumber *rootTag = [self shadowViewForReactTag:reactTag].rootView.reactTag;
dispatch_async(dispatch_get_main_queue(), ^{
UIView *rootView = nil;
Expand Down

0 comments on commit feba4f6

Please sign in to comment.