LazyCollectionController
A controller that can be set on a LazyCollection to trigger external events. Most calls should be made on the main thread e.g. within a Style.onClick { } callback.
Properties
Tells if the refresh indicator is currently shown. Reflects the pending value when unbound.
Retrieve a reference to the RecyclerView. This should be avoided if possible, but may be necessary e.g. for custom animations.
A reference to the SnapHelper that is currently attached to the RecyclerView. If this LazyCollection isn't mounted or doesn't have an associated SnapHelper, returns null.
Functions
Scroll the LazyCollection by a given number of pixels. The Scroll is instant. For an animated scroll use smoothScrollBy.
Scroll the LazyCollection so that the child with the given id is fully visible. For an animated scroll use smoothScrollToId.
Scroll the LazyCollection so that the child at the given index is fully visible. For an animated scroll use smoothScrollToIndex.
Request a callback when a RecyclerView is bound or unbound. The listener is retained for the controller's lifetime and auto-re-attached on every underlying-controller (re)bind, so it keeps firing across rebinds — including when a retained ComponentTree is rehosted onto a new LithoView and the RecyclerView is re-mounted (tab-switch back, rotation). Callers no longer need to re-register from their own mount/lifecycle hook. Pass an empty lambda to detach.
Toggle the refresh indicator. Not needed inside LazyCollection's onPullToRefresh callback — triggered automatically. Calls made before the controller binds are stashed (latest-wins) and applied once on bind.
Perform and animated scroll on the LazyCollection by a given number of pixels. For an instantaneous scroll use scrollBy.
Perform an animated scroll on the LazyCollection so that the child with the given id is fully visible. For an animated scroll use smoothScrollToId.
Perform an animated scroll on the LazyCollection so that the child at the given index is fully visible. For an instantaneous scroll use scrollToIndex.