Permalink
Browse files

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
  • Loading branch information...
shergin authored and facebook-github-bot committed Oct 3, 2017
1 parent be27f44 commit feba4f6a92dc2d411b0803764acce498e6755d87
Showing with 8 additions and 8 deletions.
  1. +8 −8 React/Modules/RCTUIManager.m
@@ -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];
@@ -259,7 +259,7 @@ - (void)registerRootView:(RCTRootContentView *)rootView
_viewRegistry[reactTag] = rootView;
// Register shadow view
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
if (!self->_viewRegistry) {
return;
}
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -393,7 +393,7 @@ - (void)setBackgroundColor:(UIColor *)color forView:(UIView *)view
RCTAssertMainQueue();
NSNumber *reactTag = view.reactTag;
dispatch_async(RCTGetUIManagerQueue(), ^{
RCTExecuteOnUIManagerQueue(^{
if (!self->_viewRegistry) {
return;
}
@@ -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;

0 comments on commit feba4f6

Please sign in to comment.