Skip to content

Commit

Permalink
reactBridgeDidFinishTransaction was finally removed
Browse files Browse the repository at this point in the history
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

Reviewed By: mmmulani

Differential Revision: D6549729

fbshipit-source-id: 58094aab982c67cec3d7fa3b616c637cb84d697f
  • Loading branch information
shergin authored and facebook-github-bot committed Dec 18, 2017
1 parent b263560 commit d2dc451
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
21 changes: 1 addition & 20 deletions React/Modules/RCTUIManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ @implementation RCTUIManager

// Keyed by viewName
NSDictionary *_componentDataByName;

NSMutableSet<id<RCTComponent>> *_bridgeTransactionListeners;
}

@synthesize bridge = _bridge;
Expand Down Expand Up @@ -107,7 +105,6 @@ - (void)invalidate
self->_rootViewTags = nil;
self->_shadowViewRegistry = nil;
self->_viewRegistry = nil;
self->_bridgeTransactionListeners = nil;
self->_bridge = nil;

[[NSNotificationCenter defaultCenter] removeObserver:self];
Expand Down Expand Up @@ -145,7 +142,6 @@ - (void)setBridge:(RCTBridge *)bridge
_pendingUIBlocks = [NSMutableArray new];
_rootViewTags = [NSMutableSet new];

_bridgeTransactionListeners = [NSMutableSet new];
_observerCoordinator = [RCTUIManagerObserverCoordinator new];

// Get view managers from bridge
Expand Down Expand Up @@ -448,10 +444,6 @@ - (void)_purgeChildren:(NSArray<id<RCTComponent>> *)children
[(id<RCTInvalidating>)subview invalidate];
}
[registry removeObjectForKey:subview.reactTag];

if (registry == (NSMutableDictionary<NSNumber *, id<RCTComponent>> *)self->_viewRegistry) {
[self->_bridgeTransactionListeners removeObject:subview];
}
});
}
}
Expand Down Expand Up @@ -996,9 +988,7 @@ - (void)_manageChildren:(NSNumber *)containerTag
if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
((UIView *)view).backgroundColor = backgroundColor;
}
if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
[uiManager->_bridgeTransactionListeners addObject:view];
}

uiManager->_viewRegistry[reactTag] = view;

#if RCT_DEV
Expand Down Expand Up @@ -1117,15 +1107,6 @@ - (void)_layoutAndMount
[self _amendPendingUIBlocksWithStylePropagationUpdateForShadowView:rootView];
}

[self addUIBlock:^(RCTUIManager *uiManager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
/**
* TODO(tadeu): Remove it once and for all
*/
for (id<RCTComponent> node in uiManager->_bridgeTransactionListeners) {
[node reactBridgeDidFinishTransaction];
}
}];

[_observerCoordinator uiManagerWillPerformMounting:self];

[self flushUIBlocksWithCompletion:^{
Expand Down
5 changes: 0 additions & 5 deletions React/Views/RCTComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ typedef void (^RCTBubblingEventBlock)(NSDictionary *body);
*/
- (void)didUpdateReactSubviews;

// TODO: Deprecate this
// This method is called after layout has been performed for all views known
// to the RCTViewManager. It is only called on UIViews, not shadow views.
- (void)reactBridgeDidFinishTransaction;

@end

// TODO: this is kinda dumb - let's come up with a
Expand Down

0 comments on commit d2dc451

Please sign in to comment.