From af70d05838e84131678688a5dbfddfeede1840a3 Mon Sep 17 00:00:00 2001 From: Martin Kralik Date: Tue, 27 Oct 2015 05:07:40 -0700 Subject: [PATCH] moved `reactBridgeDidFinishTransaction` calls Summary: Previously `_bridgeTransactionListeners` were informed about `reactBridgeDidFinishTransaction` inside of one of the UI blocks. That seems pretty arbitrary, doesn't really mean a "transaction" is really over (assuming transaction means all UI updates) and even when that block does nothing we still need to call these listeners, since there could be other UI blocks generated somewhere else! So I've moved this call to a place that seemed better (=after all UI blocks are done), since all listeners are interested in knowing when layout has happened. public Reviewed By: nicklockwood Differential Revision: D2571122 fb-gh-sync-id: 62be03ebc4353d6f6318c9765079b87b07483be2 --- React/Modules/RCTUIManager.m | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 6c827b983..d8e5d17bc 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -575,13 +575,6 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls); } withCompletionBlock:nil]; } } - - /** - * TODO(tadeu): Remove it once and for all - */ - for (id node in _bridgeTransactionListeners) { - [node reactBridgeDidFinishTransaction]; - } }; } @@ -908,6 +901,14 @@ RCT_EXPORT_METHOD(findSubviewIn:(nonnull NSNumber *)reactTag atPoint:(CGPoint)po for (dispatch_block_t block in previousPendingUIBlocks) { block(); } + /** + * TODO(tadeu): Remove it once and for all + */ + if (previousPendingUIBlocks.count) { + for (id node in _bridgeTransactionListeners) { + [node reactBridgeDidFinishTransaction]; + } + } } @catch (NSException *exception) { RCTLogError(@"Exception thrown while executing UI block: %@", exception);