-
- All Implemented Interfaces:
-
com.facebook.react.bridge.NativeModule
,com.facebook.react.uimanager.BaseViewManagerInterface
,com.facebook.react.uimanager.IViewManagerWithChildren
public abstract class ViewGroupManager<T extends ViewGroup> extends BaseViewManager<T, LayoutShadowNode> implements IViewManagerWithChildren
Class providing children management API for view managers of classes extending ViewGroup.
-
-
Method Summary
Modifier and Type Method Description LayoutShadowNode
createShadowNodeInstance()
This method should return a subclass of ReactShadowNode which will be then used formeasuring position and size of the view. Class<out LayoutShadowNode>
getShadowNodeClass()
This method should return Class instance that represent type of shadow node that thismanager will return from createShadowNodeInstance. void
updateExtraData(T root, Object extraData)
Subclasses can implement this method to receive an optional extra data enqueued from thecorresponding instance of ReactShadowNode in . void
addView(T parent, View child, int index)
void
addViews(T parent, List<View> views)
Convenience method for batching a set of addView calls Note that this adds the views to thebeginning of the ViewGroup static void
setViewZIndex(View view, int zIndex)
static Integer
getViewZIndex(View view)
int
getChildCount(T parent)
View
getChildAt(T parent, int index)
void
removeViewAt(T parent, int index)
void
removeView(T parent, View view)
void
removeAllViews(T parent)
boolean
needsCustomLayoutForChildren()
Returns whether this View type needs to handle laying out its own children instead of deferringto the standard css-layout algorithm. boolean
shouldPromoteGrandchildren()
Returns whether or not this View type should promote its grandchildren as Views. -
Methods inherited from class com.facebook.react.uimanager.BaseViewManager
getExportedCustomBubblingEventTypeConstants, getExportedCustomDirectEventTypeConstants, setAccessibilityActions, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLabelledBy, setAccessibilityLiveRegion, setAccessibilityRole, setAccessibilityValue, setBackgroundColor, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setElevation, setImportantForAccessibility, setMoveShouldSetResponder, setMoveShouldSetResponderCapture, setNativeId, setOpacity, setPointerEnter, setPointerLeave, setPointerMove, setRenderToHardwareTexture, setResponderEnd, setResponderGrant, setResponderMove, setResponderReject, setResponderRelease, setResponderStart, setResponderTerminate, setResponderTerminationRequest, setRotation, setScaleX, setScaleY, setShadowColor, setShouldBlockNativeResponder, setStartShouldSetResponder, setStartShouldSetResponderCapture, setTestId, setTouchCancel, setTouchEnd, setTouchMove, setTouchStart, setTransform, setTranslateX, setTranslateY, setViewState, setZIndex
-
Methods inherited from class com.facebook.react.uimanager.ViewManager
createShadowNodeInstance, createShadowNodeInstance, createView, getCommandsMap, getExportedViewConstants, getName, getNativeProps, getShadowNodeClass, measure, measure, onDropViewInstance, receiveCommand, receiveCommand, setPadding, updateExtraData, updateProperties, updateState
-
Methods inherited from class com.facebook.react.bridge.BaseJavaModule
canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
-
Methods inherited from class com.facebook.react.uimanager.BaseViewManagerInterface
setAccessibilityActions, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLabelledBy, setAccessibilityLiveRegion, setAccessibilityRole, setBackgroundColor, setElevation, setImportantForAccessibility, setNativeId, setOpacity, setRenderToHardwareTexture, setRotation, setScaleX, setScaleY, setShadowColor, setTestId, setTransform, setTranslateX, setTranslateY, setViewState, setZIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
createShadowNodeInstance
LayoutShadowNode createShadowNodeInstance()
This method should return a subclass of ReactShadowNode which will be then used formeasuring position and size of the view. In most of the cases this should just return aninstance of ReactShadowNode
-
getShadowNodeClass
Class<out LayoutShadowNode> getShadowNodeClass()
This method should return Class instance that represent type of shadow node that thismanager will return from createShadowNodeInstance.
This method will be used in the bridge initialization phase to collect properties exposedusing ReactProp (or ReactPropGroup) annotation from the ReactShadowNode subclass specific for native view this manager provides.
-
updateExtraData
void updateExtraData(T root, Object extraData)
Subclasses can implement this method to receive an optional extra data enqueued from thecorresponding instance of ReactShadowNode in .
Since css layout step and ui updates can be executed in separate thread apart of settingx/y/width/height this is the recommended and thread-safe way of passing extra data from cssnode to the native view counterpart.
TODO T7247021: Replace updateExtraData with generic update props mechanism after D2086999
-
addViews
void addViews(T parent, List<View> views)
Convenience method for batching a set of addView calls Note that this adds the views to thebeginning of the ViewGroup
- Parameters:
parent
- the parent ViewGroupviews
- the set of views to add
-
setViewZIndex
static void setViewZIndex(View view, int zIndex)
-
getViewZIndex
@Nullable() static Integer getViewZIndex(View view)
-
getChildCount
int getChildCount(T parent)
-
getChildAt
View getChildAt(T parent, int index)
-
removeViewAt
void removeViewAt(T parent, int index)
-
removeView
void removeView(T parent, View view)
-
removeAllViews
void removeAllViews(T parent)
-
needsCustomLayoutForChildren
boolean needsCustomLayoutForChildren()
Returns whether this View type needs to handle laying out its own children instead of deferringto the standard css-layout algorithm. Returns true for the layout to *not* be automaticallyinvoked. Instead onLayout will be invoked as normal and it is the View instance'sresponsibility to properly call layout on its children. Returns false for the default behaviorof automatically laying out children without going through the ViewGroup's onLayout method. Inthat case, onLayout for this View type must *not* call layout on its children.
-
shouldPromoteGrandchildren
boolean shouldPromoteGrandchildren()
Returns whether or not this View type should promote its grandchildren as Views. This is anoptimization for Scrollable containers when using Nodes, where instead of having one ViewGroupcontaining a large number of draw commands (and thus being more expensive in the case of aninvalidate or re-draw), we split them up into several draw commands.
-
-
-
-