StateHandler

Holds information about the current State of the components in a Component Tree.

Constructors

Link copied to clipboard
constructor(initialStateContainer: InitialStateContainer, stateHandler: StateHandler? = null)
constructor(stateHandler: StateHandler? = null)

Types

Link copied to clipboard
object Companion

Properties

Functions

Link copied to clipboard

Maps a component key to a component object that retains the current state values for that key.

Link copied to clipboard
fun applyStateUpdatesEarly(context: ComponentContext, component: Component?, prevTreeRootNode: LithoNode?)
Link copied to clipboard
fun commit()

fun commit(stateHandler: StateHandler)

Removes a list of state updates that have been applied from the pending state updates list and updates the map of current components with the given components.

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

StateContainer in this StateHandler should be accessed using this method as it will also ensure that the state is marked as needed

Link copied to clipboard

Gets a state container with all applied updates for the given key without committing the updates to a state handler.

Link copied to clipboard
fun putCachedValue(globalKey: String, index: Int, cachedValueInputs: Any, cachedValue: Any?)
Link copied to clipboard

Registers the given block to be run before the next layout calculation to update hook state.

Link copied to clipboard
fun queueStateUpdate(key: String, stateUpdate: StateContainer.StateUpdate, isLazyStateUpdate: Boolean)

Adds a state update to the list of the state updates that will be applied for the given component key during the next layout pass.