annotate FB4A's view managers with @ReactModule

Reviewed By: achen1

Differential Revision: D4044730

fbshipit-source-id: c80c23c524b2d9366c51c52cbcdee8a2a4f26f75
This commit is contained in:
Aaron Chiu 2016-10-20 05:40:17 -07:00 коммит произвёл Facebook Github Bot
Родитель e16251b46d
Коммит ffe06d3cfa
28 изменённых файлов: 89 добавлений и 48 удалений

Просмотреть файл

@ -13,7 +13,6 @@ import java.util.Arrays;
import java.util.HashSet;
import com.facebook.csslayout.Spacing;
import com.facebook.react.common.SetBuilder;
/**
* Keys for props that need to be shared across multiple classes.

Просмотреть файл

@ -12,6 +12,7 @@ package com.facebook.react.views.art;
import com.facebook.csslayout.CSSMeasureMode;
import com.facebook.csslayout.CSSNodeAPI;
import com.facebook.csslayout.MeasureOutput;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
@ -19,10 +20,11 @@ import com.facebook.react.uimanager.ThemedReactContext;
* ViewManager for ARTSurfaceView React views. Renders as a {@link ARTSurfaceView} and handles
* invalidating the native view on shadow view updates happening in the underlying tree.
*/
@ReactModule(name = ARTSurfaceViewManager.REACT_CLASS)
public class ARTSurfaceViewManager extends
BaseViewManager<ARTSurfaceView, ARTSurfaceViewShadowNode> {
private static final String REACT_CLASS = "ARTSurfaceView";
protected static final String REACT_CLASS = "ARTSurfaceView";
private static final CSSNodeAPI.MeasureFunction MEASURE_FUNCTION = new CSSNodeAPI.MeasureFunction() {
@Override

Просмотреть файл

@ -9,8 +9,9 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -10,8 +10,9 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/scroll:scroll'),
],
visibility = [

Просмотреть файл

@ -11,7 +11,6 @@ package com.facebook.react.views.drawer;
import javax.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
@ -21,11 +20,11 @@ import android.view.Gravity;
import android.view.View;
import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerModule;
@ -40,9 +39,10 @@ import com.facebook.react.views.drawer.events.DrawerStateChangedEvent;
/**
* View Manager for {@link ReactDrawerLayout} components.
*/
@ReactModule(name = ReactDrawerLayoutManager.REACT_CLASS)
public class ReactDrawerLayoutManager extends ViewGroupManager<ReactDrawerLayout> {
private static final String REACT_CLASS = "AndroidDrawerLayout";
protected static final String REACT_CLASS = "AndroidDrawerLayout";
public static final int OPEN_DRAWER = 1;
public static final int CLOSE_DRAWER = 2;

Просмотреть файл

@ -8,8 +8,8 @@ android_library(
name = 'imageevents',
srcs = IMAGE_EVENT_FILES,
deps = [
react_native_dep('third-party/android/support-annotations:android-support-annotations'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/android/support-annotations:android-support-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
@ -29,14 +29,15 @@ android_library(
react_native_dep('libraries/fresco/fresco-react-native:fresco-drawee'),
react_native_dep('libraries/fresco/fresco-react-native:fresco-react-native'),
react_native_dep('libraries/fresco/fresco-react-native:imagepipeline'),
react_native_dep('third-party/android/support-annotations:android-support-annotations'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/android/support-annotations:android-support-annotations'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/imagehelper:withmultisource'),
],
visibility = [

Просмотреть файл

@ -22,6 +22,7 @@ import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
@ -29,9 +30,10 @@ import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.annotations.ReactPropGroup;
@ReactModule(name = ReactImageManager.REACT_CLASS)
public class ReactImageManager extends SimpleViewManager<ReactImageView> {
public static final String REACT_CLASS = "RCTImageView";
protected static final String REACT_CLASS = "RCTImageView";
@Override
public String getName() {

Просмотреть файл

@ -9,9 +9,10 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/touch:touch'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/view:view'),
react_native_target('res:modal'),
],

Просмотреть файл

@ -14,6 +14,7 @@ import java.util.Map;
import android.content.DialogInterface;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.LayoutShadowNode;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerModule;
@ -24,9 +25,10 @@ import com.facebook.react.uimanager.events.EventDispatcher;
/**
* View manager for {@link ReactModalHostView} components.
*/
@ReactModule(name = ReactModalHostManager.REACT_CLASS)
public class ReactModalHostManager extends ViewGroupManager<ReactModalHostView> {
private static final String REACT_CLASS = "RCTModalHostView";
protected static final String REACT_CLASS = "RCTModalHostView";
@Override
public String getName() {

Просмотреть файл

@ -4,12 +4,13 @@ android_library(
name = 'picker',
srcs = glob(['**/*.java']),
deps = [
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -11,14 +11,16 @@ package com.facebook.react.views.picker;
import android.widget.Spinner;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ThemedReactContext;
/**
* {@link ReactPickerManager} for {@link ReactPicker} with {@link Spinner#MODE_DIALOG}.
*/
@ReactModule(name = ReactDialogPickerManager.REACT_CLASS)
public class ReactDialogPickerManager extends ReactPickerManager {
private static final String REACT_CLASS = "AndroidDialogPicker";
protected static final String REACT_CLASS = "AndroidDialogPicker";
@Override
public String getName() {

Просмотреть файл

@ -11,14 +11,16 @@ package com.facebook.react.views.picker;
import android.widget.Spinner;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ThemedReactContext;
/**
* {@link ReactPickerManager} for {@link ReactPicker} with {@link Spinner#MODE_DROPDOWN}.
*/
@ReactModule(name = ReactDropdownPickerManager.REACT_CLASS)
public class ReactDropdownPickerManager extends ReactPickerManager {
private static final String REACT_CLASS = "AndroidDropdownPicker";
protected static final String REACT_CLASS = "AndroidDropdownPicker";
@Override
public String getName() {

Просмотреть файл

@ -9,8 +9,9 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -15,6 +15,7 @@ import android.content.Context;
import android.widget.ProgressBar;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
@ -26,15 +27,17 @@ import com.facebook.react.uimanager.ViewProps;
* ProgressBar changes, we have to drop the existing ProgressBar (if there is one) and create a new
* one with the style given.
*/
@ReactModule(name = ReactProgressBarViewManager.REACT_CLASS)
public class ReactProgressBarViewManager extends
BaseViewManager<ProgressBarContainerView, ProgressBarShadowNode> {
protected static final String REACT_CLASS = "AndroidProgressBar";
/* package */ static final String PROP_STYLE = "styleAttr";
/* package */ static final String PROP_INDETERMINATE = "indeterminate";
/* package */ static final String PROP_PROGRESS = "progress";
/* package */ static final String PROP_ANIMATING = "animating";
/* package */ static final String REACT_CLASS = "AndroidProgressBar";
/* package */ static final String DEFAULT_STYLE = "Normal";
private static Object sProgressBarCtorLock = new Object();
@ -127,5 +130,4 @@ public class ReactProgressBarViewManager extends
throw new JSApplicationIllegalArgumentException("Unknown ProgressBar style: " + styleStr);
}
}
}

Просмотреть файл

@ -4,15 +4,16 @@ android_library(
name = 'scroll',
srcs = glob(['*.java']),
deps = [
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/views/view:view'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/touch:touch'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_target('java/com/facebook/react/views/view:view'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -14,6 +14,7 @@ import javax.annotation.Nullable;
import android.graphics.Color;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
@ -25,11 +26,13 @@ import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
* <p>Note that {@link ReactScrollView} and {@link ReactHorizontalScrollView} are exposed to JS
* as a single ScrollView component, configured via the {@code horizontal} boolean property.
*/
@ReactModule(name = ReactHorizontalScrollViewManager.REACT_CLASS)
public class ReactHorizontalScrollViewManager
extends ViewGroupManager<ReactHorizontalScrollView>
implements ReactScrollViewCommandHelper.ScrollCommandHandler<ReactHorizontalScrollView> {
private static final String REACT_CLASS = "AndroidHorizontalScrollView";
protected static final String REACT_CLASS = "AndroidHorizontalScrollView";
private @Nullable FpsListener mFpsListener = null;
public ReactHorizontalScrollViewManager() {

Просмотреть файл

@ -17,6 +17,7 @@ import android.graphics.Color;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
@ -28,11 +29,13 @@ import com.facebook.react.uimanager.ReactClippingViewGroupHelper;
* <p>Note that {@link ReactScrollView} and {@link ReactHorizontalScrollView} are exposed to JS
* as a single ScrollView component, configured via the {@code horizontal} boolean property.
*/
@ReactModule(name = ReactScrollViewManager.REACT_CLASS)
public class ReactScrollViewManager
extends ViewGroupManager<ReactScrollView>
implements ReactScrollViewCommandHelper.ScrollCommandHandler<ReactScrollView> {
private static final String REACT_CLASS = "RCTScrollView";
protected static final String REACT_CLASS = "RCTScrollView";
private @Nullable FpsListener mFpsListener = null;
public ReactScrollViewManager() {

Просмотреть файл

@ -4,13 +4,14 @@ android_library(
name = 'swiperefresh',
srcs = glob(['*.java']),
deps = [
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/scroll:scroll'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -19,18 +19,24 @@ import android.support.v4.widget.SwipeRefreshLayout.OnRefreshListener;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.ViewGroupManager;
import com.facebook.react.uimanager.ViewProps;
import com.facebook.react.uimanager.annotations.ReactProp;
import static com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager.REACT_CLASS;
/**
* ViewManager for {@link ReactSwipeRefreshLayout} which allows the user to "pull to refresh" a
* child view. Emits an {@code onRefresh} event when this happens.
*/
@ReactModule(name = REACT_CLASS)
public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefreshLayout> {
protected static final String REACT_CLASS = "AndroidSwipeRefreshLayout";
@Override
protected ReactSwipeRefreshLayout createViewInstance(ThemedReactContext reactContext) {
return new ReactSwipeRefreshLayout(reactContext);
@ -38,7 +44,7 @@ public class SwipeRefreshLayoutManager extends ViewGroupManager<ReactSwipeRefres
@Override
public String getName() {
return "AndroidSwipeRefreshLayout";
return REACT_CLASS;
}
@ReactProp(name = ViewProps.ENABLED, defaultBoolean = true)

Просмотреть файл

@ -10,11 +10,13 @@
package com.facebook.react.views.text;
import com.facebook.react.common.annotations.VisibleForTesting;
import com.facebook.react.module.annotations.ReactModule;
/**
* Manages raw text nodes. Since they are used only as a virtual nodes any type of native view
* operation will throw an {@link IllegalStateException}
*/
@ReactModule(name = ReactVirtualTextViewManager.REACT_CLASS)
public class ReactVirtualTextViewManager extends ReactRawTextManager {
@VisibleForTesting

Просмотреть файл

@ -13,8 +13,9 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/text:text'),
],
visibility = [

Просмотреть файл

@ -15,6 +15,7 @@ import android.view.View;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewManager;
@ -22,10 +23,11 @@ import com.facebook.react.uimanager.ViewManager;
* Manages Images embedded in Text nodes using Fresco. Since they are used only as a virtual nodes
* any type of native view operation will throw an {@link IllegalStateException}.
*/
@ReactModule(name = FrescoBasedReactTextInlineImageViewManager.REACT_CLASS)
public class FrescoBasedReactTextInlineImageViewManager
extends ViewManager<View, FrescoBasedReactTextInlineImageShadowNode> {
static final String REACT_CLASS = "RCTTextInlineImage";
protected static final String REACT_CLASS = "RCTTextInlineImage";
private final @Nullable AbstractDraweeControllerBuilder mDraweeControllerBuilder;
private final @Nullable Object mCallerContext;
@ -69,5 +71,4 @@ public class FrescoBasedReactTextInlineImageViewManager
@Override
public void updateExtraData(View root, Object extraData) {
}
}

Просмотреть файл

@ -9,9 +9,10 @@ android_library(
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/modules/core:core'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/imagehelper:imagehelper'),
react_native_target('java/com/facebook/react/views/text:text'),
react_native_target('java/com/facebook/react/views/view:view'),

Просмотреть файл

@ -36,6 +36,7 @@ import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.BaseViewManager;
import com.facebook.react.uimanager.LayoutShadowNode;
import com.facebook.react.uimanager.PixelUtil;
@ -55,9 +56,10 @@ import com.facebook.react.views.text.TextInlineImageSpan;
/**
* Manages instances of TextInput.
*/
@ReactModule(name = ReactTextInputManager.REACT_CLASS)
public class ReactTextInputManager extends BaseViewManager<ReactEditText, LayoutShadowNode> {
/* package */ static final String REACT_CLASS = "AndroidTextInput";
protected static final String REACT_CLASS = "AndroidTextInput";
private static final int[] SPACING_TYPES = {
Spacing.ALL, Spacing.LEFT, Spacing.RIGHT, Spacing.TOP, Spacing.BOTTOM,
@ -778,8 +780,7 @@ public class ReactTextInputManager extends BaseViewManager<ReactEditText, Layout
mReactEditText.getId(),
start,
end
)
);
));
mPreviousSelectionStart = start;
mPreviousSelectionEnd = end;

Просмотреть файл

@ -4,14 +4,15 @@ android_library(
name = 'viewpager',
srcs = glob(['**/*.java']),
deps = [
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/scroll:scroll'),
react_native_dep('third-party/android/support/v4:lib-support-v4'),
react_native_dep('third-party/java/infer-annotations:infer-annotations'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/views/scroll:scroll'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -16,6 +16,7 @@ import android.view.View;
import com.facebook.infer.annotation.Assertions;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.PixelUtil;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.ViewGroupManager;
@ -26,9 +27,10 @@ import javax.annotation.Nullable;
/**
* Instance of {@link ViewManager} that provides native {@link ViewPager} view.
*/
@ReactModule(name = ReactViewPagerManager.REACT_CLASS)
public class ReactViewPagerManager extends ViewGroupManager<ReactViewPager> {
private static final String REACT_CLASS = "AndroidViewPager";
protected static final String REACT_CLASS = "AndroidViewPager";
public static final int COMMAND_SET_PAGE = 1;
public static final int COMMAND_SET_PAGE_WITHOUT_ANIMATION = 2;
@ -43,7 +45,6 @@ public class ReactViewPagerManager extends ViewGroupManager<ReactViewPager> {
return new ReactViewPager(reactContext);
}
@ReactProp(name = "scrollEnabled", defaultBoolean = true)
public void setScrollEnabled(ReactViewPager viewPager, boolean value) {
viewPager.setScrollEnabled(value);
@ -59,8 +60,7 @@ public class ReactViewPagerManager extends ViewGroupManager<ReactViewPager> {
return MapBuilder.of(
PageScrollEvent.EVENT_NAME, MapBuilder.of("registrationName", "onPageScroll"),
PageScrollStateChangedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onPageScrollStateChanged"),
PageSelectedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onPageSelected")
);
PageSelectedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onPageSelected"));
}
@Override

Просмотреть файл

@ -5,11 +5,12 @@ android_library(
srcs = glob(['**/*.java']),
deps = [
react_native_dep('libraries/fbcore/src/main/java/com/facebook/common/logging:logging'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
react_native_target('java/com/facebook/react/bridge:bridge'),
react_native_target('java/com/facebook/react/common:common'),
react_native_target('java/com/facebook/react/module/annotations:annotations'),
react_native_target('java/com/facebook/react/uimanager:uimanager'),
react_native_target('java/com/facebook/react/uimanager/annotations:annotations'),
react_native_target('java/com/facebook/react/common:common'),
react_native_dep('third-party/java/jsr-305:jsr-305'),
],
visibility = [
'PUBLIC',

Просмотреть файл

@ -40,6 +40,7 @@ import com.facebook.react.bridge.ReadableMapKeySetIterator;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.MapBuilder;
import com.facebook.react.common.build.ReactBuildConfig;
import com.facebook.react.module.annotations.ReactModule;
import com.facebook.react.uimanager.SimpleViewManager;
import com.facebook.react.uimanager.ThemedReactContext;
import com.facebook.react.uimanager.UIManagerModule;
@ -76,9 +77,10 @@ import org.json.JSONException;
* - canGoBack - boolean, whether there is anything on a history stack to go back
* - canGoForward - boolean, whether it is possible to request GO_FORWARD command
*/
@ReactModule(name = ReactWebViewManager.REACT_CLASS)
public class ReactWebViewManager extends SimpleViewManager<WebView> {
private static final String REACT_CLASS = "RCTWebView";
protected static final String REACT_CLASS = "RCTWebView";
private static final String HTML_ENCODING = "UTF-8";
private static final String HTML_MIME_TYPE = "text/html; charset=utf-8";