public NativeModuleRegistry build() { ArrayList<ModuleHolder> batchCompleteListenerModules = new ArrayList<>(); for (Map.Entry<Class<? extends NativeModule>, ModuleHolder> entry : mModules.entrySet()) { if (OnBatchCompleteListener.class.isAssignableFrom(entry.getKey())) { batchCompleteListenerModules.add(entry.getValue()); } } return new NativeModuleRegistry( mReactApplicationContext, mModules, batchCompleteListenerModules); }
public void onBatchComplete() { for (ModuleHolder moduleHolder : mBatchCompleteListenerModules) { if (moduleHolder.isInitialized()) { ((OnBatchCompleteListener) moduleHolder.getModule()).onBatchComplete(); } } }