public final class RecyclerCollectionComponent extends Component
Component
that renders a Recycler
backed by a Section
tree. See recycler-collection-component
for details.
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 send commands to the
RecyclerCollectionComponentSpec
, such as scrollTo(position) and refresh().
To trigger scrolling from the Section use SectionLifecycle#requestFocus(SectionContext,
int)
. See communicating-with-the-ui
for details.
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.TransitionContainer
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) |
static EventHandler |
getPTRRefreshEventHandler(ComponentContext context) |
protected StateContainer |
getStateContainer() |
protected boolean |
hasAttachDetachCallback() |
protected boolean |
hasState() |
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. |
protected void |
onDetached(ComponentContext c)
Called when the component is detached from the
ComponentTree . |
static void |
onRecyclerConfigChanged(ComponentContext c,
Handle handle,
int commitPolicy) |
static void |
onRecyclerConfigChanged(ComponentContext c,
String key,
int commitPolicy) |
static void |
onRecyclerConfigChanged(EventTrigger trigger,
int commitPolicy) |
static EventTrigger |
onRecyclerConfigChangedTrigger(ComponentContext c,
String key)
Deprecated.
|
static EventHandler<PTRRefreshEvent> |
onRefresh(ComponentContext c,
SectionTree sectionTree) |
static void |
onScroll(ComponentContext c,
Handle handle,
int position,
boolean animate) |
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)
Deprecated.
|
void |
recordEventTrigger(EventTriggersContainer container) |
protected void |
transferState(StateContainer _prevStateContainer,
StateContainer _nextStateContainer)
|
protected static void |
updateLoadingState(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
protected static void |
updateLoadingStateAsync(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
protected static void |
updateLoadingStateSync(ComponentContext c,
RecyclerCollectionComponentSpec.LoadingState currentLoadingState) |
bindDynamicProp, canResolve, clearCachedLayout, copyInterStageImpl, getCommonProps, getDynamicProps, getEventDispatcher, getHandle, getId, getKey, getScopedContext, getSimpleName, getSimpleNameDelegate, hasBackgroundSet, hasClickHandlerSet, isEquivalentTo, measure, measureMightNotCacheInternalNode, registerWorkingRange, retrieveValue, setScopedContext, updateInternalChildState, willRender
applyPreviousRenderData, callsShouldUpdateOnMount, canMeasure, canPreallocate, createMountContent, dispatchErrorEvent, dispatchErrorEvent, dispatchOnEnteredRange, dispatchOnExitedRange, getEventTrigger, getEventTrigger, getExtraAccessibilityNodeAt, getExtraAccessibilityNodesCount, getMountType, getTreePropsForChildren, hasChildLithoViews, implementsAccessibility, implementsExtraAccessibilityNodes, isLayoutSpecWithSizeSpecCheck, isMountSizeDependent, isPureRender, needsPreviousRenderData, newEventHandler, newEventTrigger, onAttached, onBind, onBoundsDefined, onCreateLayoutWithSizeSpec, onCreateMountContent, onCreateMountContentPool, onCreateTransition, onError, onLoadStyle, onMeasure, onMeasureBaseline, onMount, onPopulateAccessibilityNode, onPopulateExtraAccessibilityNode, onPrepare, onShouldCreateLayoutWithNewSizeSpec, onUnbind, onUnmount, poolSize, populateTreeProps, recordRenderData, resolve, shouldAlwaysRemeasure, shouldUpdate, shouldUseGlobalPool
protected StateContainer getStateContainer()
getStateContainer
in class Component
public RecyclerCollectionComponent makeShallowCopy()
makeShallowCopy
in class Component
protected Component onCreateLayout(ComponentContext c)
ComponentLifecycle
ComponentLayout
representing the layout structure of the Component
and its sub-components.onCreateLayout
in class ComponentLifecycle
c
- The ComponentContext
to build a ComponentLayout
tree.protected void createInitialState(ComponentContext c)
createInitialState
in class ComponentLifecycle
protected void onDetached(ComponentContext c)
ComponentLifecycle
ComponentTree
.onDetached
in class ComponentLifecycle
c
- The ComponentContext
the Component was constructed with.protected boolean hasAttachDetachCallback()
hasAttachDetachCallback
in class ComponentLifecycle
OnAttached
or OnDetached
delegate
methods.public static EventHandler getPTRRefreshEventHandler(ComponentContext context)
public static EventHandler<PTRRefreshEvent> onRefresh(ComponentContext c, SectionTree sectionTree)
public Object dispatchOnEvent(EventHandler eventHandler, Object eventState)
dispatchOnEvent
in interface EventDispatcher
dispatchOnEvent
in class ComponentLifecycle
@Deprecated public static EventTrigger onScrollTrigger(ComponentContext c, String key)
@Deprecated public static EventTrigger onRecyclerConfigChangedTrigger(ComponentContext c, String key)
public static void onScroll(ComponentContext c, Handle handle, int position, boolean animate)
public static void onScroll(ComponentContext c, String key, int position, boolean animate)
public static void onScroll(EventTrigger trigger, int position, boolean animate)
public static void onRecyclerConfigChanged(ComponentContext c, Handle handle, int commitPolicy)
public static void onRecyclerConfigChanged(ComponentContext c, String key, int commitPolicy)
public static void onRecyclerConfigChanged(EventTrigger trigger, int commitPolicy)
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(StateContainer _prevStateContainer, StateContainer _nextStateContainer)
ComponentLifecycle
transferState
in class ComponentLifecycle
protected static void updateLoadingState(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void updateLoadingStateAsync(ComponentContext c, RecyclerCollectionComponentSpec.LoadingState currentLoadingState)
protected static void updateLoadingStateSync(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)