public final class RCTViewManager extends ViewGroupManager<com.facebook.react.flat.FlatViewGroup>
NativeModule.NativeMethodPROP_NATIVE_ID, PROP_TEST_IDMETHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC| Constructor and Description |
|---|
RCTViewManager() |
| Modifier and Type | Method and Description |
|---|---|
com.facebook.react.flat.RCTView |
createShadowNodeInstance()
This method should return a subclass of
ReactShadowNode which will be then used for
measuring position and size of the view. |
protected com.facebook.react.flat.FlatViewGroup |
createViewInstance(ThemedReactContext reactContext)
Subclasses should return a new View instance of the proper type.
|
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() |
java.lang.Class<com.facebook.react.flat.RCTView> |
getShadowNodeClass()
This method should return
Class instance that represent type of shadow node that this
manager will return from ViewManager.createShadowNodeInstance(). |
void |
receiveCommand(com.facebook.react.flat.FlatViewGroup view,
int commandId,
ReadableArray args)
Subclasses may use this method to receive events/commands directly from JS through the
UIManager. |
void |
removeAllViews(com.facebook.react.flat.FlatViewGroup parent) |
void |
setBackgroundColor(com.facebook.react.flat.FlatViewGroup view,
int backgroundColor) |
void |
setHitSlop(com.facebook.react.flat.FlatViewGroup view,
ReadableMap hitSlop) |
void |
setHotspot(com.facebook.react.flat.FlatViewGroup view,
ReadableMap bg) |
void |
setNeedsOffscreenAlphaCompositing(com.facebook.react.flat.FlatViewGroup view,
boolean needsOffscreenAlphaCompositing) |
void |
setPointerEvents(com.facebook.react.flat.FlatViewGroup view,
java.lang.String pointerEventsStr) |
void |
setRemoveClippedSubviews(com.facebook.react.flat.FlatViewGroup view,
boolean removeClippedSubviews) |
addView, addViews, getChildAt, getChildCount, getViewZIndex, needsCustomLayoutForChildren, removeView, removeViewAt, setViewZIndex, shouldPromoteGrandchildren, updateExtraDatasetAccessibilityComponentType, setAccessibilityLabel, setAccessibilityLiveRegion, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setTestId, setTransform, setTranslateX, setTranslateY, setZIndexaddEventEmitters, createShadowNodeInstance, createView, getExportedCustomBubblingEventTypeConstants, getExportedCustomDirectEventTypeConstants, getExportedViewConstants, getNativeProps, onAfterUpdateTransaction, onDropViewInstance, updatePropertiescanOverrideExistingModule, getConstants, hasConstants, initialize, onCatalystInstanceDestroypublic java.lang.String getName()
getName in interface NativeModulegetName in class ViewManager<com.facebook.react.flat.FlatViewGroup,LayoutShadowNode>public java.util.Map<java.lang.String,java.lang.Integer> getCommandsMap()
ViewManagerViewManager 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<com.facebook.react.flat.FlatViewGroup,LayoutShadowNode>public com.facebook.react.flat.RCTView createShadowNodeInstance()
ViewManagerReactShadowNode which will be then used for
measuring position and size of the view. In most of the cases this should just return an
instance of ReactShadowNodecreateShadowNodeInstance in class ViewGroupManager<com.facebook.react.flat.FlatViewGroup>public java.lang.Class<com.facebook.react.flat.RCTView> getShadowNodeClass()
ViewManagerClass instance that represent type of shadow node that this
manager will return from ViewManager.createShadowNodeInstance().
This method will be used in the bridge initialization phase to collect properties exposed using
ReactProp (or ReactPropGroup) annotation from the ReactShadowNode
subclass specific for native view this manager provides.getShadowNodeClass in class ViewGroupManager<com.facebook.react.flat.FlatViewGroup>Class object that represents type of shadow node used by this view manager.public void setHotspot(com.facebook.react.flat.FlatViewGroup view,
@Nullable
ReadableMap bg)
public void receiveCommand(com.facebook.react.flat.FlatViewGroup view,
int commandId,
@Nullable
ReadableArray args)
ViewManagerUIManager. 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<com.facebook.react.flat.FlatViewGroup,LayoutShadowNode>view - View instance that should receive the commandcommandId - code of the commandargs - optional arguments for the commandpublic void setNeedsOffscreenAlphaCompositing(com.facebook.react.flat.FlatViewGroup view,
boolean needsOffscreenAlphaCompositing)
public void setPointerEvents(com.facebook.react.flat.FlatViewGroup view,
@Nullable
java.lang.String pointerEventsStr)
public void setRemoveClippedSubviews(com.facebook.react.flat.FlatViewGroup view,
boolean removeClippedSubviews)
public void setHitSlop(com.facebook.react.flat.FlatViewGroup view,
@Nullable
ReadableMap hitSlop)
protected com.facebook.react.flat.FlatViewGroup createViewInstance(ThemedReactContext reactContext)
ViewManagercreateViewInstance in class ViewManager<com.facebook.react.flat.FlatViewGroup,LayoutShadowNode>public void setBackgroundColor(com.facebook.react.flat.FlatViewGroup view,
int backgroundColor)
setBackgroundColor in class BaseViewManager<com.facebook.react.flat.FlatViewGroup,LayoutShadowNode>public void removeAllViews(com.facebook.react.flat.FlatViewGroup parent)
removeAllViews in class ViewGroupManager<com.facebook.react.flat.FlatViewGroup>