From c27cc9c1ac9c2bda9b88a8af66aa13efd8ca9a0a Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Fri, 16 Dec 2016 15:22:53 -0800 Subject: [PATCH] add viewManager param to @ReactModuleList Reviewed By: achen1 Differential Revision: D4338871 fbshipit-source-id: 4ac175e0a9049d5fb08c9d01f630a3e17124e08e --- .../facebook/react/CoreModulesPackage.java | 30 ++++++++++--------- .../module/annotations/ReactModuleList.java | 12 ++++++-- .../processing/ReactModuleSpecProcessor.java | 2 +- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java index 33b5ec778..ce45cbe5e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java @@ -52,20 +52,22 @@ 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({ - AndroidInfoModule.class, - AnimationsDebugModule.class, - DeviceEventManagerModule.class, - ExceptionsManagerModule.class, - HeadlessJsTaskSupportModule.class, - SourceCodeModule.class, - Timing.class, - UIManagerModule.class, - // Debug only - DebugComponentOwnershipModule.class, - JSCHeapCapture.class, - JSCSamplingProfiler.class, -}) +@ReactModuleList( + javaModules = { + AndroidInfoModule.class, + AnimationsDebugModule.class, + DeviceEventManagerModule.class, + ExceptionsManagerModule.class, + HeadlessJsTaskSupportModule.class, + SourceCodeModule.class, + Timing.class, + UIManagerModule.class, + // Debug only + DebugComponentOwnershipModule.class, + JSCHeapCapture.class, + JSCSamplingProfiler.class, + } +) /* package */ class CoreModulesPackage extends LazyReactPackage { private final ReactInstanceManager mReactInstanceManager; diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java index dee1150bd..bf7cd7d9c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java @@ -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[] value(); + Class[] javaModules(); + + /** + * The View Managers in this list should be annotated with {@link ReactModule}. + * @return List of view manager in the package. + */ + Class[] viewManagers() default {}; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java index 1552c3cd7..6bb848156 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java @@ -87,7 +87,7 @@ public class ReactModuleSpecProcessor extends AbstractProcessor { ReactModuleList reactModuleList = typeElement.getAnnotation(ReactModuleList.class); List nativeModules = new ArrayList<>(); try { - reactModuleList.value(); // throws MirroredTypesException + reactModuleList.javaModules(); // throws MirroredTypesException } catch (MirroredTypesException mirroredTypesException) { List typeMirrors = mirroredTypesException.getTypeMirrors(); for (TypeMirror typeMirror : typeMirrors) {