Explicitly make UIManagerModule use OnBatchComplete on Android

Summary:
Currently, we scan all native modules to see if they implement the OnBatchCompleteListerner. If they do, we add those modules to a list, and when C++ calls OnBactchComplete is called, we execute the callback on each of the modules.
The only native module implementing this callback today is the UIManagerModule. With Fabric, UIManager will also not be a native module anymore. This diff removes all the work done for creating the list and assumes that UIManagerModule is the only place that is interested in OnBatchComplete call - and calls it directly.

Reviewed By: achen1

Differential Revision: D9186651

fbshipit-source-id: 473586b37c2465ccd041985dcdd56132026f34f1
This commit is contained in:
Ram N
2018-08-08 14:03:14 -07:00
committed by Facebook Github Bot
parent 69912495f9
commit 617e25d9b5
5 changed files with 13 additions and 55 deletions
@@ -122,14 +122,7 @@ public class NativeModuleRegistryBuilder {
}
public NativeModuleRegistry build() {
ArrayList<ModuleHolder> batchCompleteListenerModules = new ArrayList<>();
for (Map.Entry<String, ModuleHolder> entry : mModules.entrySet()) {
if (entry.getValue().hasOnBatchCompleteListener()) {
batchCompleteListenerModules.add(entry.getValue());
}
}
return new NativeModuleRegistry(
mReactApplicationContext, mModules, batchCompleteListenerModules);
mReactApplicationContext, mModules);
}
}