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 |
---|---|
protected java.lang.Object |
acceptTriggerEventImpl(EventTrigger eventTrigger,
java.lang.Object eventState,
java.lang.Object[] params) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context) |
static RecyclerCollectionComponent.Builder |
create(ComponentContext context,
int defStyleAttr,
int defStyleRes) |
protected void |
createInitialState(ComponentContext c) |
protected com.facebook.litho.sections.widget.RecyclerCollectionComponent.RecyclerCollectionComponentStateContainer |
createStateContainer() |
protected java.lang.Object |
dispatchOnEventImpl(EventHandler eventHandler,
java.lang.Object eventState) |
static EventHandler<PTRRefreshEvent> |
getPTRRefreshEventHandler(ComponentContext context) |
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)
This will send the onRecyclerConfigChanged trigger to the component with the given handle.
|
static void |
onRecyclerConfigChanged(ComponentContext c,
java.lang.String key,
int commitPolicy)
Deprecated.
Use
#onRecyclerConfigChanged(ComponentContext, Handle) instead. |
static void |
onRecyclerConfigChanged(EventTrigger trigger,
int commitPolicy)
Deprecated.
Use
#onRecyclerConfigChanged(ComponentContext, Handle) instead. |
static EventTrigger |
onRecyclerConfigChangedTrigger(ComponentContext c,
java.lang.String key)
Deprecated.
Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use
#onRecyclerConfigChanged(ComponentContext, Handle) . |
static EventHandler<PTRRefreshEvent> |
onRefresh(ComponentContext c,
SectionTree sectionTree) |
static void |
onScroll(ComponentContext c,
Handle handle,
int position,
boolean animate)
This will send the onScroll trigger to the component with the given handle.
|
static void |
onScroll(ComponentContext c,
java.lang.String key,
int position,
boolean animate)
Deprecated.
Use
#onScroll(ComponentContext, Handle) instead. |
static void |
onScroll(EventTrigger trigger,
int position,
boolean animate)
Deprecated.
Use
#onScroll(ComponentContext, Handle) instead. |
static EventTrigger |
onScrollTrigger(ComponentContext c,
java.lang.String key)
Deprecated.
Do not use this method to get a EventTrigger to use later. Instead give the component a Handle and use
#onScroll(ComponentContext, Handle) . |
void |
recordEventTrigger(ComponentContext c,
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, createInterStagePropsContainer, getCommonProps, getDynamicProps, getErrorHandler, getEventDispatcher, getInterStagePropsContainer, getScopedContext, getSimpleName, getSimpleNameDelegate, getStateContainer, hasClickHandlerSet, isEquivalentTo, markLayoutStarted, measure, measureMightNotCacheInternalNode, registerWorkingRange, retrieveValue, setInterStagePropsContainer, setScopedContext, setStateContainer, toString, updateInternalChildState, willRender
acceptTriggerEvent, applyPreviousRenderData, callsShouldUpdateOnMount, canMeasure, canPreallocate, createMountContent, dispatchErrorEvent, dispatchErrorEvent, dispatchOnEnteredRange, dispatchOnEvent, dispatchOnExitedRange, getEventTrigger, getEventTrigger, getExtraAccessibilityNodeAt, getExtraAccessibilityNodesCount, getMountType, getTreePropsForChildren, hasChildLithoViews, hasOwnErrorHandler, implementsAccessibility, implementsExtraAccessibilityNodes, isLayoutSpecWithSizeSpecCheck, isMountSizeDependent, isPureRender, needsPreviousRenderData, newEventHandler, newEventTrigger, 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
protected com.facebook.litho.sections.widget.RecyclerCollectionComponent.RecyclerCollectionComponentStateContainer createStateContainer()
createStateContainer
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<PTRRefreshEvent> getPTRRefreshEventHandler(ComponentContext context)
public static EventHandler<PTRRefreshEvent> onRefresh(ComponentContext c, SectionTree sectionTree)
protected java.lang.Object dispatchOnEventImpl(EventHandler eventHandler, java.lang.Object eventState)
dispatchOnEventImpl
in class ComponentLifecycle
@Deprecated public static EventTrigger onScrollTrigger(ComponentContext c, java.lang.String key)
#onScroll(ComponentContext, Handle)
.@Deprecated public static EventTrigger onRecyclerConfigChangedTrigger(ComponentContext c, java.lang.String key)
#onRecyclerConfigChanged(ComponentContext, Handle)
.public static void onScroll(ComponentContext c, Handle handle, int position, boolean animate)
@Deprecated public static void onScroll(ComponentContext c, java.lang.String key, int position, boolean animate)
#onScroll(ComponentContext, Handle)
instead.@Deprecated public static void onScroll(EventTrigger trigger, int position, boolean animate)
#onScroll(ComponentContext, Handle)
instead.public static void onRecyclerConfigChanged(ComponentContext c, Handle handle, int commitPolicy)
@Deprecated public static void onRecyclerConfigChanged(ComponentContext c, java.lang.String key, int commitPolicy)
#onRecyclerConfigChanged(ComponentContext, Handle)
instead.@Deprecated public static void onRecyclerConfigChanged(EventTrigger trigger, int commitPolicy)
#onRecyclerConfigChanged(ComponentContext, Handle)
instead.protected java.lang.Object acceptTriggerEventImpl(EventTrigger eventTrigger, java.lang.Object eventState, java.lang.Object[] params)
acceptTriggerEventImpl
in class ComponentLifecycle
public void recordEventTrigger(ComponentContext c, 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)