add viewManager param to @ReactModuleList

Reviewed By: achen1

Differential Revision: D4338871

fbshipit-source-id: 4ac175e0a9049d5fb08c9d01f630a3e17124e08e
This commit is contained in:
Aaron Chiu 2016-12-16 15:22:53 -08:00 committed by Facebook Github Bot
parent 71f32fb5a3
commit c27cc9c1ac
3 changed files with 26 additions and 18 deletions

View File

@ -52,7 +52,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_M
* require special integration with other framework parts (e.g. with the list of packages to load
* view managers from).
*/
@ReactModuleList({
@ReactModuleList(
javaModules = {
AndroidInfoModule.class,
AnimationsDebugModule.class,
DeviceEventManagerModule.class,
@ -65,7 +66,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_M
DebugComponentOwnershipModule.class,
JSCHeapCapture.class,
JSCSamplingProfiler.class,
})
}
)
/* package */ class CoreModulesPackage extends LazyReactPackage {
private final ReactInstanceManager mReactInstanceManager;

View File

@ -19,8 +19,14 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
public @interface ReactModuleList {
/**
* The native modules in this list should be annotated with {@link ReactModule}.
* @return List of native modules.
* The Java modules in this list should be annotated with {@link ReactModule}.
* @return List of Java modules in the package.
*/
Class<? extends NativeModule>[] value();
Class<? extends NativeModule>[] javaModules();
/**
* The View Managers in this list should be annotated with {@link ReactModule}.
* @return List of view manager in the package.
*/
Class<? extends NativeModule>[] viewManagers() default {};
}

View File

@ -87,7 +87,7 @@ public class ReactModuleSpecProcessor extends AbstractProcessor {
ReactModuleList reactModuleList = typeElement.getAnnotation(ReactModuleList.class);
List<String> nativeModules = new ArrayList<>();
try {
reactModuleList.value(); // throws MirroredTypesException
reactModuleList.javaModules(); // throws MirroredTypesException
} catch (MirroredTypesException mirroredTypesException) {
List<? extends TypeMirror> typeMirrors = mirroredTypesException.getTypeMirrors();
for (TypeMirror typeMirror : typeMirrors) {