Convert ReactPackages in FB4a to switch-case

Reviewed By: achen1

Differential Revision: D9511962

fbshipit-source-id: ea42b25f13b157866057d96d026317098e47ea63
This commit is contained in:
Ram N
2018-09-06 09:21:23 -07:00
committed by Facebook Github Bot
parent 0df92afc1c
commit 2f79960a69
3 changed files with 140 additions and 7 deletions

View File

@@ -78,7 +78,6 @@ public abstract class LazyReactPackage implements ReactPackage {
*/
/* package */
Iterable<ModuleHolder> getNativeModuleIterator(final ReactApplicationContext reactContext) {
final List<String> eagerNativeModules = getEagerNativeModules();
final Map<String, ReactModuleInfo> reactModuleInfoMap =
getReactModuleInfoProvider().getReactModuleInfos();
final List<ModuleSpec> nativeModules = getNativeModules(reactContext);
@@ -96,7 +95,7 @@ public abstract class LazyReactPackage implements ReactPackage {
String name = moduleSpec.getName();
ReactModuleInfo reactModuleInfo = reactModuleInfoMap.get(name);
ModuleHolder moduleHolder;
if (reactModuleInfo == null || eagerNativeModules.contains(name)) {
if (reactModuleInfo == null) {
NativeModule module;
ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_START, name);
try {
@@ -131,11 +130,6 @@ public abstract class LazyReactPackage implements ReactPackage {
*/
protected abstract List<ModuleSpec> getNativeModules(ReactApplicationContext reactContext);
/** @return list of native modules which should be eagerly initialized. */
protected List<String> getEagerNativeModules() {
return Collections.emptyList();
}
/**
* This is only used when a LazyReactPackage is a part of {@link CompositeReactPackage} Once we
* deprecate {@link CompositeReactPackage}, this can be removed too