mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Change class names to modules names in packages
Reviewed By: achen1 Differential Revision: D9508095 fbshipit-source-id: e3973ea417c803110eb8612c854a6374a849474b
This commit is contained in:
committed by
Facebook Github Bot
parent
5eaa2d29c0
commit
48169b28e2
@@ -8,6 +8,7 @@
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import com.facebook.infer.annotation.Assertions;
|
||||
import com.facebook.react.module.annotations.ReactModule;
|
||||
import com.facebook.systrace.Systrace;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -44,10 +45,9 @@ public class NativeModuleRegistry {
|
||||
JSInstance jsInstance) {
|
||||
ArrayList<JavaModuleWrapper> javaModules = new ArrayList<>();
|
||||
for (Map.Entry<String, ModuleHolder> entry : mModules.entrySet()) {
|
||||
String type = entry.getKey();
|
||||
if (!entry.getValue().isCxxModule()) {
|
||||
//if (!CxxModuleWrapperBase.class.isAssignableFrom(entry.getValue().getModule().getClass())) {
|
||||
javaModules.add(new JavaModuleWrapper(jsInstance, type, entry.getValue()));
|
||||
javaModules.add(new JavaModuleWrapper(jsInstance, entry.getValue()));
|
||||
}
|
||||
}
|
||||
return javaModules;
|
||||
@@ -120,19 +120,21 @@ public class NativeModuleRegistry {
|
||||
// iterating over all the modules for find this one instance, and then calling it, we short-circuit
|
||||
// the search, and simply call OnBatchComplete on the UI Manager.
|
||||
// With Fabric, UIManager would no longer be a NativeModule, so this call would simply go away
|
||||
ModuleHolder moduleHolder = mModules.get("com.facebook.react.uimanager.UIManagerModule");
|
||||
ModuleHolder moduleHolder = mModules.get("UIManager");
|
||||
if (moduleHolder != null && moduleHolder.hasInstance()) {
|
||||
((OnBatchCompleteListener) moduleHolder.getModule()).onBatchComplete();
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends NativeModule> boolean hasModule(Class<T> moduleInterface) {
|
||||
return mModules.containsKey(moduleInterface.getName());
|
||||
String name = moduleInterface.getAnnotation(ReactModule.class).name();
|
||||
return mModules.containsKey(name);
|
||||
}
|
||||
|
||||
public <T extends NativeModule> T getModule(Class<T> moduleInterface) {
|
||||
String name = moduleInterface.getAnnotation(ReactModule.class).name();
|
||||
return (T) Assertions.assertNotNull(
|
||||
mModules.get(moduleInterface.getName()), moduleInterface.getSimpleName()).getModule();
|
||||
mModules.get(name), moduleInterface.getSimpleName()).getModule();
|
||||
}
|
||||
|
||||
public List<NativeModule> getAllModules() {
|
||||
|
||||
Reference in New Issue
Block a user