public final class RecyclerCollectionComponent extends Component
Component
that renders a Recycler
backed by a Section
tree.
This Component
handles the loading events from the Section
hierarchy and shows
the appropriate error,loading or empty Component
passed in as props. If either the empty
or the error components are not passed in and the RecyclerCollectionComponent
is in one
of these states it will simply not render anything.
The RecyclerCollectionComponent
also exposes a LoadEventsHandler
and a OnScrollListener
as Prop
s so its users can receive events about the state of the loading
and about the state of the Recycler
scrolling.
clipToPadding, clipChildren, itemDecoration, scrollBarStyle, horizontalPadding,
verticalPadding and recyclerViewId Prop
s will be directly applied to the Recycler
component.
The RecyclerCollectionEventsController
Prop
is a way to sent commands to the
RecyclerCollectionComponentSpec
, such as scrollTo(position) and refresh().
com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec
Modifier and Type | Class and Description |
---|---|
static class |
RecyclerCollectionComponent.Builder |
Component.ContainerBuilder<T extends Component.ContainerBuilder<T>>
ComponentLifecycle.MountType, ComponentLifecycle.RenderData, ComponentLifecycle.StateContainer, ComponentLifecycle.StateUpdate, ComponentLifecycle.TransitionContainer
mSplitChildrenLayoutInThreadPool
Modifier and Type | Method and Description |
---|---|
Object |
acceptTriggerEvent(EventTrigger eventTrigger,
Object eventState,
Object[] params) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context,
int defStyleAttr,
int defStyleRes) |
protected void |
createInitialState(ComponentContext c) |
Object |
dispatchOnEvent(EventHandler eventHandler,
Object eventState) |
protected ComponentLifecycle.StateContainer |
getStateContainer() |
protected boolean |
hasState() |
boolean |
isEquivalentTo(Component other)
Compares this component to a different one to check if they are the same
This is used to be able to skip rendering a component again.
|
protected static void |
lazyUpdateHasSetSectionTreeRoot(ComponentContext c,
boolean lazyUpdateValue) |
RecyclerCollectionComponent |
makeShallowCopy() |
protected Component |
onCreateLayout(ComponentContext c)
Generate a tree of
ComponentLayout representing the layout structure of the Component and its sub-components. |
static EventHandler<PTRRefreshEvent> |
onRefresh(ComponentContext c,
SectionTree sectionTree) |
static void |
onScroll(ComponentContext c,
String key,
int position,
boolean animate) |
static void |
onScroll(EventTrigger trigger,
int position,
boolean animate) |
static EventTrigger |
onScrollTrigger(ComponentContext c,
String key) |
void |
recordEventTrigger(EventTriggersContainer container) |
protected void |
transferState(ComponentContext context,
ComponentLifecycle.StateContainer _prevStateContainer)
|
protected static void |
updateLoadingState(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
protected static void |
updateLoadingStateAsync(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
clearCachedLayout, copyInterStageImpl, getEventDispatcher, getId, getScopedContext, getSimpleName, measure, registerWorkingRange, releaseCachedLayout, setScopedContext, updateInternalChildState, updateInternalChildState, willRender
acquireDiff, acquireOutput, applyPreviousRenderData, callsShouldUpdateOnMount, canMeasure, canMountIncrementally, canPreallocate, createMountContent, dispatchErrorEvent, dispatchErrorEvent, dispatchOnEnteredRange, dispatchOnExitedRange, getEventTrigger, getExtraAccessibilityNodeAt, getExtraAccessibilityNodesCount, getMountType, getTreePropsForChildren, implementsAccessibility, implementsExtraAccessibilityNodes, isMountSizeDependent, isPureRender, needsPreviousRenderData, newEventHandler, newEventHandler, newEventTrigger, onBind, onBoundsDefined, onCreateLayoutWithSizeSpec, onCreateMountContent, onCreateMountContentPool, onCreateTransition, onError, onLoadStyle, onMeasure, onMeasureBaseline, onMount, onPopulateAccessibilityNode, onPopulateExtraAccessibilityNode, onPrepare, onUnbind, onUnmount, poolSize, populateTreeProps, recordRenderData, releaseDiff, releaseOutput, resolve, shouldUpdate, shouldUseDisplayList
protected ComponentLifecycle.StateContainer getStateContainer()
getStateContainer
in class Component
public boolean isEquivalentTo(Component other)
Component
Object.equals(Object)
so we can optimize the code better over time since we don't have
to adhere to the contract required for a equals method.isEquivalentTo
in class Component
other
- the component to compare topublic RecyclerCollectionComponent makeShallowCopy()
makeShallowCopy
in class Component
protected Component onCreateLayout(ComponentContext c)
ComponentLifecycle
ComponentLayout
representing the layout structure of the Component
and its sub-components. You should use ComponentContext.newLayoutBuilder(int, int)
to
build the layout tree.onCreateLayout
in class ComponentLifecycle
c
- The ComponentContext
to build a ComponentLayout
tree.protected void createInitialState(ComponentContext c)
createInitialState
in class ComponentLifecycle
public static EventHandler<PTRRefreshEvent> onRefresh(ComponentContext c, SectionTree sectionTree)
public Object dispatchOnEvent(EventHandler eventHandler, Object eventState)
dispatchOnEvent
in interface EventDispatcher
dispatchOnEvent
in class ComponentLifecycle
public static EventTrigger onScrollTrigger(ComponentContext c, String key)
public static void onScroll(ComponentContext c, String key, int position, boolean animate)
public static void onScroll(EventTrigger trigger, int position, boolean animate)
public Object acceptTriggerEvent(EventTrigger eventTrigger, Object eventState, Object[] params)
acceptTriggerEvent
in interface EventTriggerTarget
acceptTriggerEvent
in class ComponentLifecycle
public void recordEventTrigger(EventTriggersContainer container)
recordEventTrigger
in interface HasEventTrigger
recordEventTrigger
in class Component
protected boolean hasState()
hasState
in class ComponentLifecycle
protected void transferState(ComponentContext context, ComponentLifecycle.StateContainer _prevStateContainer)
ComponentLifecycle
transferState
in class ComponentLifecycle
protected static void updateLoadingStateAsync(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void updateLoadingState(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void lazyUpdateHasSetSectionTreeRoot(ComponentContext c, boolean lazyUpdateValue)
public static RecyclerCollectionComponent.Builder create(ComponentContext context)
public static RecyclerCollectionComponent.Builder create(ComponentContext context, int defStyleAttr, int defStyleRes)