mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Introduce mobile config flag to load classes for View Managers
Reviewed By: kathryngray Differential Revision: D6148468 fbshipit-source-id: d0f919f63922dae4b0720f22fa70ab4a7f67b48a
This commit is contained in:
committed by
Facebook Github Bot
parent
55f75dfd65
commit
f0fb720eaa
@@ -9,13 +9,11 @@
|
||||
|
||||
package com.facebook.react.bridge;
|
||||
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
import java.lang.reflect.Constructor;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Provider;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import com.facebook.react.common.build.ReactBuildConfig;
|
||||
|
||||
/**
|
||||
* A specification for a native module. This exists so that we don't have to pay the cost
|
||||
* for creation until/if the module is used.
|
||||
@@ -27,7 +25,7 @@ public class ModuleSpec {
|
||||
private static final Class[] EMPTY_SIGNATURE = {};
|
||||
private static final Class[] CONTEXT_SIGNATURE = { ReactApplicationContext.class };
|
||||
|
||||
private final Class<? extends NativeModule> mType;
|
||||
private final @Nullable Class<? extends NativeModule> mType;
|
||||
private final Provider<? extends NativeModule> mProvider;
|
||||
|
||||
/**
|
||||
@@ -64,12 +62,22 @@ public class ModuleSpec {
|
||||
});
|
||||
}
|
||||
|
||||
public ModuleSpec(Class<? extends NativeModule> type, Provider<? extends NativeModule> provider) {
|
||||
public static ModuleSpec viewManagerSpec(Provider<? extends NativeModule> provider) {
|
||||
return new ModuleSpec(null, provider);
|
||||
}
|
||||
|
||||
public static ModuleSpec nativeModuleSpec(
|
||||
Class<? extends NativeModule> type, Provider<? extends NativeModule> provider) {
|
||||
return new ModuleSpec(type, provider);
|
||||
}
|
||||
|
||||
private ModuleSpec(
|
||||
@Nullable Class<? extends NativeModule> type, Provider<? extends NativeModule> provider) {
|
||||
mType = type;
|
||||
mProvider = provider;
|
||||
}
|
||||
|
||||
public Class<? extends NativeModule> getType() {
|
||||
public @Nullable Class<? extends NativeModule> getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user