public class ReactViewManager extends ViewGroupManager<ReactViewGroup>
NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REACT_CLASS |
PROP_NATIVE_ID, PROP_TEST_ID
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
ReactViewManager() |
Modifier and Type | Method and Description |
---|---|
void |
addView(ReactViewGroup parent,
android.view.View child,
int index) |
ReactViewGroup |
createViewInstance(ThemedReactContext context)
Subclasses should return a new View instance of the proper type.
|
android.view.View |
getChildAt(ReactViewGroup parent,
int index) |
int |
getChildCount(ReactViewGroup 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.lang.String |
getName() |
void |
receiveCommand(ReactViewGroup root,
int commandId,
ReadableArray args)
Subclasses may use this method to receive events/commands directly from JS through the
UIManager . |
void |
removeAllViews(ReactViewGroup parent) |
void |
removeViewAt(ReactViewGroup parent,
int index) |
void |
setAccessible(ReactViewGroup view,
boolean accessible) |
void |
setBorderColor(ReactViewGroup view,
int index,
java.lang.Integer color) |
void |
setBorderRadius(ReactViewGroup view,
int index,
float borderRadius) |
void |
setBorderStyle(ReactViewGroup view,
java.lang.String borderStyle) |
void |
setBorderWidth(ReactViewGroup view,
int index,
float width) |
void |
setCollapsable(ReactViewGroup view,
boolean collapsable) |
void |
setHitSlop(ReactViewGroup view,
ReadableMap hitSlop) |
void |
setNativeBackground(ReactViewGroup view,
ReadableMap bg) |
void |
setNativeForeground(ReactViewGroup view,
ReadableMap fg) |
void |
setNeedsOffscreenAlphaCompositing(ReactViewGroup view,
boolean needsOffscreenAlphaCompositing) |
void |
setOverflow(ReactViewGroup view,
java.lang.String overflow) |
void |
setPointerEvents(ReactViewGroup view,
java.lang.String pointerEventsStr) |
void |
setRemoveClippedSubviews(ReactViewGroup view,
boolean removeClippedSubviews) |
void |
setTVPreferredFocus(ReactViewGroup view,
boolean hasTVPreferredFocus) |
addViews, createShadowNodeInstance, getShadowNodeClass, getViewZIndex, needsCustomLayoutForChildren, removeView, setViewZIndex, shouldPromoteGrandchildren, updateExtraData
setAccessibilityComponentType, setAccessibilityLabel, setAccessibilityLiveRegion, setBackgroundColor, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setTestId, setTransform, setTranslateX, setTranslateY, setZIndex
addEventEmitters, createShadowNodeInstance, createView, getExportedCustomBubblingEventTypeConstants, getExportedCustomDirectEventTypeConstants, getExportedViewConstants, getNativeProps, onAfterUpdateTransaction, onDropViewInstance, updateProperties
canOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroy
public static final java.lang.String REACT_CLASS
public void setAccessible(ReactViewGroup view, boolean accessible)
public void setTVPreferredFocus(ReactViewGroup view, boolean hasTVPreferredFocus)
public void setBorderRadius(ReactViewGroup view, int index, float borderRadius)
public void setBorderStyle(ReactViewGroup view, @Nullable java.lang.String borderStyle)
public void setHitSlop(ReactViewGroup view, @Nullable ReadableMap hitSlop)
public void setPointerEvents(ReactViewGroup view, @Nullable java.lang.String pointerEventsStr)
public void setNativeBackground(ReactViewGroup view, @Nullable ReadableMap bg)
public void setNativeForeground(ReactViewGroup view, @Nullable ReadableMap fg)
public void setRemoveClippedSubviews(ReactViewGroup view, boolean removeClippedSubviews)
public void setNeedsOffscreenAlphaCompositing(ReactViewGroup view, boolean needsOffscreenAlphaCompositing)
public void setBorderWidth(ReactViewGroup view, int index, float width)
public void setBorderColor(ReactViewGroup view, int index, java.lang.Integer color)
public void setCollapsable(ReactViewGroup view, boolean collapsable)
public void setOverflow(ReactViewGroup view, java.lang.String overflow)
public java.lang.String getName()
getName
in interface NativeModule
getName
in class ViewManager<ReactViewGroup,LayoutShadowNode>
public ReactViewGroup createViewInstance(ThemedReactContext context)
ViewManager
createViewInstance
in class ViewManager<ReactViewGroup,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<ReactViewGroup,LayoutShadowNode>
public void receiveCommand(ReactViewGroup root, int commandId, @Nullable 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<ReactViewGroup,LayoutShadowNode>
root
- View instance that should receive the commandcommandId
- code of the commandargs
- optional arguments for the commandpublic void addView(ReactViewGroup parent, android.view.View child, int index)
addView
in class ViewGroupManager<ReactViewGroup>
public int getChildCount(ReactViewGroup parent)
getChildCount
in class ViewGroupManager<ReactViewGroup>
public android.view.View getChildAt(ReactViewGroup parent, int index)
getChildAt
in class ViewGroupManager<ReactViewGroup>
public void removeViewAt(ReactViewGroup parent, int index)
removeViewAt
in class ViewGroupManager<ReactViewGroup>
public void removeAllViews(ReactViewGroup parent)
removeAllViews
in class ViewGroupManager<ReactViewGroup>