Remove class loads for CoreModulesPackage
Summary: CoreModulePackages was following the old way of adding Native Modules to the Array list. This diff changes it to use names instead of class. Reviewed By: achen1 Differential Revision: D9996803 fbshipit-source-id: a6c3daf2193a2559db0908f9e26e339e03e4f8c7
This commit is contained in:
parent
36033bd0ed
commit
c31f79fe47
|
@ -71,7 +71,7 @@ import javax.inject.Provider;
|
|||
public List<ModuleSpec> getNativeModules(final ReactApplicationContext reactContext) {
|
||||
return Arrays.asList(
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
AndroidInfoModule.class,
|
||||
AndroidInfoModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -79,7 +79,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
DeviceEventManagerModule.class,
|
||||
DeviceEventManagerModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -87,7 +87,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
ExceptionsManagerModule.class,
|
||||
ExceptionsManagerModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -95,7 +95,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
HeadlessJsTaskSupportModule.class,
|
||||
HeadlessJsTaskSupportModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -103,7 +103,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
SourceCodeModule.class,
|
||||
SourceCodeModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -111,7 +111,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
Timing.class,
|
||||
Timing.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -119,7 +119,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
UIManagerModule.class,
|
||||
UIManagerModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
@ -127,7 +127,7 @@ import javax.inject.Provider;
|
|||
}
|
||||
}),
|
||||
ModuleSpec.nativeModuleSpec(
|
||||
DeviceInfoModule.class,
|
||||
DeviceInfoModule.NAME,
|
||||
new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
|
|
|
@ -23,9 +23,9 @@ import com.facebook.react.module.annotations.ReactModule;
|
|||
/**
|
||||
* Native module that handles device hardware events like hardware back presses.
|
||||
*/
|
||||
@ReactModule(name = "DeviceEventManager")
|
||||
@ReactModule(name = DeviceEventManagerModule.NAME)
|
||||
public class DeviceEventManagerModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String NAME = "DeviceEventManager";
|
||||
public interface RCTDeviceEventEmitter extends JavaScriptModule {
|
||||
void emit(String eventName, @Nullable Object data);
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import com.facebook.react.util.JSStackTrace;
|
|||
@ReactModule(name = ExceptionsManagerModule.NAME)
|
||||
public class ExceptionsManagerModule extends BaseJavaModule {
|
||||
|
||||
protected static final String NAME = "ExceptionsManager";
|
||||
public static final String NAME = "ExceptionsManager";
|
||||
|
||||
private final DevSupportManager mDevSupportManager;
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ import com.facebook.react.module.annotations.ReactModule;
|
|||
* Simple native module that allows JS to notify native of having completed some task work, so that
|
||||
* it can e.g. release any resources, stop timers etc.
|
||||
*/
|
||||
@ReactModule(name = HeadlessJsTaskSupportModule.MODULE_NAME)
|
||||
@ReactModule(name = HeadlessJsTaskSupportModule.NAME)
|
||||
public class HeadlessJsTaskSupportModule extends ReactContextBaseJavaModule {
|
||||
|
||||
protected static final String MODULE_NAME = "HeadlessJsTaskSupport";
|
||||
public static final String NAME = "HeadlessJsTaskSupport";
|
||||
|
||||
public HeadlessJsTaskSupportModule(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
|
@ -29,7 +29,7 @@ public class HeadlessJsTaskSupportModule extends ReactContextBaseJavaModule {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MODULE_NAME;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
|
|
|
@ -35,7 +35,7 @@ import com.facebook.react.module.annotations.ReactModule;
|
|||
public final class Timing extends ReactContextBaseJavaModule implements LifecycleEventListener,
|
||||
HeadlessJsTaskEventListener {
|
||||
|
||||
protected static final String NAME = "Timing";
|
||||
public static final String NAME = "Timing";
|
||||
|
||||
// These timing contants should be kept in sync with the ones in `JSTimers.js`.
|
||||
// The minimum time in milliseconds left in the frame to call idle callbacks.
|
||||
|
|
|
@ -24,11 +24,11 @@ import com.facebook.react.uimanager.DisplayMetricsHolder;
|
|||
/**
|
||||
* Module that exposes Android Constants to JS.
|
||||
*/
|
||||
@ReactModule(name = DeviceInfoModule.sModuleName)
|
||||
@ReactModule(name = DeviceInfoModule.NAME)
|
||||
public class DeviceInfoModule extends BaseJavaModule implements
|
||||
LifecycleEventListener {
|
||||
|
||||
static final String sModuleName = "DeviceInfo";
|
||||
public static final String NAME = "DeviceInfo";
|
||||
|
||||
private @Nullable ReactApplicationContext mReactApplicationContext;
|
||||
private float mFontScale;
|
||||
|
@ -47,7 +47,7 @@ public class DeviceInfoModule extends BaseJavaModule implements
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return sModuleName;
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,9 +26,9 @@ import static android.content.Context.UI_MODE_SERVICE;
|
|||
/**
|
||||
* Module that exposes Android Constants to JS.
|
||||
*/
|
||||
@ReactModule(name = "PlatformConstants")
|
||||
@ReactModule(name = AndroidInfoModule.NAME)
|
||||
public class AndroidInfoModule extends ReactContextBaseJavaModule {
|
||||
|
||||
public static final String NAME = "PlatformConstants";
|
||||
private static final String IS_TESTING = "IS_TESTING";
|
||||
|
||||
public AndroidInfoModule(ReactApplicationContext reactContext) {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class UIManagerModule extends ReactContextBaseJavaModule implements
|
|||
@Nullable String resolveCustomEventName(String eventName);
|
||||
}
|
||||
|
||||
protected static final String NAME = "UIManager";
|
||||
public static final String NAME = "UIManager";
|
||||
|
||||
private static final boolean DEBUG =
|
||||
PrinterHolder.getPrinter().shouldDisplayLogMessage(ReactDebugOverlayTags.UI_MANAGER);
|
||||
|
|
Loading…
Reference in New Issue