public class ReactViewPagerManager extends ViewGroupManager<ReactViewPager>
ViewManager
that provides native ViewPager
view.NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static int |
COMMAND_SET_PAGE |
static int |
COMMAND_SET_PAGE_WITHOUT_ANIMATION |
static java.lang.String |
REACT_CLASS |
PROP_NATIVE_ID, PROP_TEST_ID
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
ReactViewPagerManager() |
Modifier and Type | Method and Description |
---|---|
void |
addView(ReactViewPager parent,
android.view.View child,
int index) |
protected ReactViewPager |
createViewInstance(ThemedReactContext reactContext)
Subclasses should return a new View instance of the proper type.
|
android.view.View |
getChildAt(ReactViewPager parent,
int index) |
int |
getChildCount(ReactViewPager parent) |
java.util.Map<java.lang.String,java.lang.Integer> |
getCommandsMap()
Subclasses of
ViewManager that expect to receive commands through
UIManagerModule.dispatchViewManagerCommand(int, int, com.facebook.react.bridge.ReadableArray) should override this method returning the
map between names of the commands and IDs that are then used in ViewManager.receiveCommand(T, int, com.facebook.react.bridge.ReadableArray) method
whenever the command is dispatched for this particular ViewManager . |
java.util.Map |
getExportedCustomDirectEventTypeConstants()
Returns a map of config data passed to JS that defines eligible events that can be placed on
native views.
|
java.lang.String |
getName() |
boolean |
needsCustomLayoutForChildren()
Returns whether this View type needs to handle laying out its own children instead of
deferring to the standard css-layout algorithm.
|
void |
receiveCommand(ReactViewPager viewPager,
int commandType,
ReadableArray args)
Subclasses may use this method to receive events/commands directly from JS through the
UIManager . |
void |
removeViewAt(ReactViewPager parent,
int index) |
void |
setPageMargin(ReactViewPager pager,
float margin) |
void |
setPeekEnabled(ReactViewPager pager,
boolean peekEnabled) |
void |
setScrollEnabled(ReactViewPager viewPager,
boolean value) |
addViews, createShadowNodeInstance, getShadowNodeClass, getViewZIndex, removeAllViews, removeView, setViewZIndex, shouldPromoteGrandchildren, updateExtraData
onAfterUpdateTransaction, setAccessibilityComponentType, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLiveRegion, setAccessibilityRole, setBackgroundColor, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setTestId, setTransform, setTranslateX, setTranslateY, setViewStates, setZIndex
addEventEmitters, createShadowNodeInstance, createView, getExportedCustomBubblingEventTypeConstants, getExportedViewConstants, getNativeProps, measure, onDropViewInstance, updateLocalData, updateProperties
canOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroy
public static final java.lang.String REACT_CLASS
public static final int COMMAND_SET_PAGE
public static final int COMMAND_SET_PAGE_WITHOUT_ANIMATION
public java.lang.String getName()
getName
in interface NativeModule
getName
in class ViewManager<ReactViewPager,LayoutShadowNode>
protected ReactViewPager createViewInstance(ThemedReactContext reactContext)
ViewManager
createViewInstance
in class ViewManager<ReactViewPager,LayoutShadowNode>
public void setScrollEnabled(ReactViewPager viewPager, boolean value)
public boolean needsCustomLayoutForChildren()
ViewGroupManager
needsCustomLayoutForChildren
in class ViewGroupManager<ReactViewPager>
public java.util.Map getExportedCustomDirectEventTypeConstants()
ViewManager
getExportedCustomDirectEventTypeConstants
in class ViewManager<ReactViewPager,LayoutShadowNode>
public java.util.Map<java.lang.String,java.lang.Integer> getCommandsMap()
ViewManager
ViewManager
that expect to receive commands through
UIManagerModule.dispatchViewManagerCommand(int, int, com.facebook.react.bridge.ReadableArray)
should override this method returning the
map between names of the commands and IDs that are then used in ViewManager.receiveCommand(T, int, com.facebook.react.bridge.ReadableArray)
method
whenever the command is dispatched for this particular ViewManager
.
As an example we may consider ReactWebViewManager
that expose the following commands:
goBack, goForward, reload. In this case the map returned from ViewManager.getCommandsMap()
from
ReactWebViewManager
will look as follows:
{
"goBack": 1,
"goForward": 2,
"reload": 3,
}
Now assuming that "reload" command is dispatched through UIManagerModule
we trigger
ReactWebViewManager#receiveCommand
passing "3" as commandId
argument.getCommandsMap
in class ViewManager<ReactViewPager,LayoutShadowNode>
public void receiveCommand(ReactViewPager viewPager, int commandType, ReadableArray args)
ViewManager
UIManager
. Good example of such a command would be scrollTo
request with
coordinates for a ScrollView
or goBack
request for a WebView
instance.receiveCommand
in class ViewManager<ReactViewPager,LayoutShadowNode>
viewPager
- View instance that should receive the commandcommandType
- code of the commandargs
- optional arguments for the commandpublic void addView(ReactViewPager parent, android.view.View child, int index)
addView
in class ViewGroupManager<ReactViewPager>
public int getChildCount(ReactViewPager parent)
getChildCount
in class ViewGroupManager<ReactViewPager>
public android.view.View getChildAt(ReactViewPager parent, int index)
getChildAt
in class ViewGroupManager<ReactViewPager>
public void removeViewAt(ReactViewPager parent, int index)
removeViewAt
in class ViewGroupManager<ReactViewPager>
public void setPageMargin(ReactViewPager pager, float margin)
public void setPeekEnabled(ReactViewPager pager, boolean peekEnabled)