nil instead of empty `RCTViewManagerUIBlock` blocks

Summary: Same as in previous diffs. Gets us into a better place to know if we really have UI updates and it's marginally more efficient.

Depends on D2571143. (not really)

public

Reviewed By: nicklockwood

Differential Revision: D2571166

fb-gh-sync-id: e8f34521ec2e12156a49f1cd655e92df1db34fca
This commit is contained in:
Martin Kralik 2015-10-27 05:07:44 -07:00 committed by facebook-github-bot-5
parent 8989ff925d
commit 28f5af0c39
1 changed files with 11 additions and 5 deletions

View File

@ -509,6 +509,10 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
}
}
if (!viewsWithNewFrames.count) {
// no frame change results in no UI update block
return nil;
}
// Perform layout (possibly animated)
return ^(__unused RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
RCTResponseSenderBlock callback = self->_layoutAnimation.callback;
@ -583,11 +587,13 @@ extern NSString *RCTBridgeModuleNameForClass(Class cls);
NSMutableSet *applierBlocks = [NSMutableSet setWithCapacity:1];
[topView collectUpdatedProperties:applierBlocks parentProperties:@{}];
[self addUIBlock:^(__unused RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
for (RCTApplierBlock block in applierBlocks) {
block(viewRegistry);
}
}];
if (applierBlocks.count) {
[self addUIBlock:^(__unused RCTUIManager *uiManager, RCTSparseArray *viewRegistry) {
for (RCTApplierBlock block in applierBlocks) {
block(viewRegistry);
}
}];
}
}
/**