LithoRenderer

class LithoRenderer(val context: Context, val id: Int = LithoTree.generateComponentTreeId(), val componentsConfig: ComponentsConfiguration = ComponentsConfiguration.defaultInstance, val renderUnitIdGenerator: RenderUnitIdGenerator = RenderUnitIdGenerator(id), val treeState: TreeState? = TreeState(), val parentTreePropContainer: TreePropContainer? = TreePropContainer(), val treePropContainer: TreePropContainer? = TreePropContainer(), val visibilityController: LithoVisibilityEventsController? = null, val synchronizer: UpdateSynchronizer? = null) : TreeStateProvider, StateUpdater, StateUpdateRequester, MountedViewReference, ErrorComponentReceiver

A renderer for Litho components that handles RESOLVE and LAYOUT.

Constructors

Link copied to clipboard
constructor(context: Context, id: Int = LithoTree.generateComponentTreeId(), componentsConfig: ComponentsConfiguration = ComponentsConfiguration.defaultInstance, renderUnitIdGenerator: RenderUnitIdGenerator = RenderUnitIdGenerator(id), treeState: TreeState? = TreeState(), parentTreePropContainer: TreePropContainer? = TreePropContainer(), treePropContainer: TreePropContainer? = TreePropContainer(), visibilityController: LithoVisibilityEventsController? = null, synchronizer: UpdateSynchronizer? = null)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
val id: Int
Link copied to clipboard
open override var isFirstMount: Boolean
Link copied to clipboard
open override val mountedView: View?
Link copied to clipboard

Callback that is invoked when a state update is completed

Link copied to clipboard
var sizeConstraints: SizeConstraints?

The size constraints used for layout calculations.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val treeState: TreeState?

The default TreeState needed by the StateProvider.

Link copied to clipboard

Functions

Link copied to clipboard
open override fun applyLazyStateUpdatesForContainer(globalKey: String, container: StateContainer, isLayoutState: Boolean): StateContainer
Link copied to clipboard
fun bind(host: Host)
Link copied to clipboard
open override fun <T> canSkipStateUpdate(stateId: StateId, newValue: T?, isLayoutState: Boolean): Boolean
open override fun <T> canSkipStateUpdate(newValueFunction: (T) -> T, stateId: StateId, isLayoutState: Boolean): Boolean
Link copied to clipboard

Cleans up any pending resolve or layout operations and resets the renderer state.

Link copied to clipboard
open override fun getCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, isLayoutState: Boolean): Any?

Returns a Cached value that is accessible across all re-render operations.

Link copied to clipboard
open override fun getEventTrigger(key: String): EventTrigger<*>?
open override fun getEventTrigger(handle: Handle, id: Int): EventTrigger<*>?
Link copied to clipboard
fun layout(constraints: SizeConstraints)

Performs an asynchronous layout calculation with the given constraints. Uses the current resolve result if available, otherwise performs an async resolve first.

Link copied to clipboard
fun layoutSync(constraints: SizeConstraints): LayoutState

Performs a synchronous layout calculation with the given constraints. Uses the current resolve result if available, otherwise performs an inline resolve.

Link copied to clipboard

Promotes the committed layout state to the UI thread.

Link copied to clipboard
open override fun onErrorComponent(component: Component?)
Link copied to clipboard
open override fun putCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, cachedValue: Any?, isLayoutState: Boolean)

Stores a Cached value that will be accessible across all re-render operations.

Link copied to clipboard
open override fun removePendingStateUpdate(key: String, isLayoutState: Boolean)

Removes a state update that was previously enqueued if the state update has not been processed yet.

Link copied to clipboard
fun render(root: Component, constraints: SizeConstraints)

Performs an asynchronous resolution and layout in one call, which is a non-blocking operation.

Link copied to clipboard
fun renderSync(root: Component, constraints: SizeConstraints): LayoutState

Performs a synchronous resolution and layout in one call. This is a blocking operation that completes the entire rendering pipeline.

Link copied to clipboard
open override fun request(update: PendingStateUpdate<*>)
Link copied to clipboard
fun resolve(root: Component)

Initiates an asynchronous resolution process for a component.

Link copied to clipboard
Link copied to clipboard
open override fun updateHookStateAsync(stateId: StateId, updateBlock: HookUpdater, attribution: String?, isLayoutState: Boolean)

Same as updateStateAsync but for Hook State.

Link copied to clipboard
open override fun updateHookStateSync(stateId: StateId, updateBlock: HookUpdater, attribution: String?, isLayoutState: Boolean)

Same as updateStateSync but for Hook State.

Link copied to clipboard
open override fun updateStateAsync(globalKey: String, stateUpdate: StateContainer.StateUpdate, attribution: String?, isLayoutState: Boolean)

Enqueues a state update that will schedule a new render on a Thread controlled by the Litho infrastructure.

Link copied to clipboard
open override fun updateStateLazy(globalKey: String, stateUpdate: StateContainer.StateUpdate, isLayoutState: Boolean)

Enqueues a state update that will not schedule a new render. The new state will immediately be visible in Event Handlers and it will be visible in the next render phase.

Link copied to clipboard
open override fun updateStateSync(globalKey: String, stateUpdate: StateContainer.StateUpdate, attribution: String?, isLayoutState: Boolean)

Enqueues a state update that will schedule a new render on the calling thread at the end of its current run-loop. It is expected that the calling thread has an active Looper.