reactBridgeDidFinishTransaction was finally removed

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
This commit is contained in:
Valentin Shergin 2017-12-18 11:43:37 -08:00 коммит произвёл Facebook Github Bot
Родитель b263560c73
Коммит d2dc451407
2 изменённых файлов: 1 добавлений и 25 удалений

Просмотреть файл

@ -68,8 +68,6 @@ NSString *const RCTUIManagerWillUpdateViewsDueToContentSizeMultiplierChangeNotif
// Keyed by viewName // Keyed by viewName
NSDictionary *_componentDataByName; NSDictionary *_componentDataByName;
NSMutableSet<id<RCTComponent>> *_bridgeTransactionListeners;
} }
@synthesize bridge = _bridge; @synthesize bridge = _bridge;
@ -107,7 +105,6 @@ RCT_EXPORT_MODULE()
self->_rootViewTags = nil; self->_rootViewTags = nil;
self->_shadowViewRegistry = nil; self->_shadowViewRegistry = nil;
self->_viewRegistry = nil; self->_viewRegistry = nil;
self->_bridgeTransactionListeners = nil;
self->_bridge = nil; self->_bridge = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
@ -145,7 +142,6 @@ RCT_EXPORT_MODULE()
_pendingUIBlocks = [NSMutableArray new]; _pendingUIBlocks = [NSMutableArray new];
_rootViewTags = [NSMutableSet new]; _rootViewTags = [NSMutableSet new];
_bridgeTransactionListeners = [NSMutableSet new];
_observerCoordinator = [RCTUIManagerObserverCoordinator new]; _observerCoordinator = [RCTUIManagerObserverCoordinator new];
// Get view managers from bridge // Get view managers from bridge
@ -448,10 +444,6 @@ static NSDictionary *deviceOrientationEventBody(UIDeviceOrientation orientation)
[(id<RCTInvalidating>)subview invalidate]; [(id<RCTInvalidating>)subview invalidate];
} }
[registry removeObjectForKey:subview.reactTag]; [registry removeObjectForKey:subview.reactTag];
if (registry == (NSMutableDictionary<NSNumber *, id<RCTComponent>> *)self->_viewRegistry) {
[self->_bridgeTransactionListeners removeObject:subview];
}
}); });
} }
} }
@ -996,9 +988,7 @@ RCT_EXPORT_METHOD(createView:(nonnull NSNumber *)reactTag
if ([view respondsToSelector:@selector(setBackgroundColor:)]) { if ([view respondsToSelector:@selector(setBackgroundColor:)]) {
((UIView *)view).backgroundColor = backgroundColor; ((UIView *)view).backgroundColor = backgroundColor;
} }
if ([view respondsToSelector:@selector(reactBridgeDidFinishTransaction)]) {
[uiManager->_bridgeTransactionListeners addObject:view];
}
uiManager->_viewRegistry[reactTag] = view; uiManager->_viewRegistry[reactTag] = view;
#if RCT_DEV #if RCT_DEV
@ -1117,15 +1107,6 @@ RCT_EXPORT_METHOD(dispatchViewManagerCommand:(nonnull NSNumber *)reactTag
[self _amendPendingUIBlocksWithStylePropagationUpdateForShadowView:rootView]; [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]; [_observerCoordinator uiManagerWillPerformMounting:self];
[self flushUIBlocksWithCompletion:^{ [self flushUIBlocksWithCompletion:^{

Просмотреть файл

@ -50,11 +50,6 @@ typedef void (^RCTBubblingEventBlock)(NSDictionary *body);
*/ */
- (void)didUpdateReactSubviews; - (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 @end
// TODO: this is kinda dumb - let's come up with a // TODO: this is kinda dumb - let's come up with a