ComponentScope
The implicit receiver for KComponent.render call. This class exposes the ability to use hooks, like useState, and convenience functions, like dp.
Inheritors
Functions
Return a android.graphics.drawable.Drawable for a ColorInt value as a Drawable instance.
Called by compiler-injected code before a dynamically repeated @Hook function call. Creates a HookKey from the compile-time assigned callSiteId and a runtime index that counts how many times this call site has been entered within its parent hook invocation.
Called for a hook call site whose index the compiler determined statically.
A utility function to find the View with a given tag under the current Component's LithoView. To set a view tag, use Style.viewTag. An appropriate time to call this is in your Component's onVisible callback.
Retrieves a styled attribute value for provided {@param id}.
Returns the instance registered for the type T in this hierarchy, and null if no value was registered. Tree props are registered for a sub-hierarchy via TreePropProvider or com.facebook.litho.annotations.OnCreateTreeProp in the Spec API.
Returns the instance registered for the type T in this hierarchy, throws if no value was registered. Tree props are registered for a sub-hierarchy via TreePropProvider or com.facebook.litho.annotations.OnCreateTreeProp in the Spec API.
A layout component that stacks its children on top of each other. Each child is positioned absolutely within the container, allowing them to overlap.
Creates an Animatable for imperative animation control.
Animates a Color value with per-channel interpolation, automatically starting a new animation whenever targetValue changes.
Animates a Dimen value, automatically starting a new animation whenever targetValue changes.
Animates a Float value, automatically starting a new animation whenever targetValue changes.
Animates an Int value, automatically starting a new animation whenever targetValue changes.
Animates a value of type T, automatically starting a new animation whenever targetValue changes.
Coordinates multiple animated properties that respond to a shared targetState.
Creates a DynamicValue with a static initial value. This DynamicValue can be passed to the variants of Style properties that take DynamicValue, like Style.backgroundColor or Style.translationY. You can then imperatively set a new value on the main thread to update that property without a state update, or use the collection of Animated APIs to drive animations on this DynamicValue, which will in turn animate the property.
Creates a DynamicValue deriving from an existing binding param, with modifications applied by transform function.
Create a CachedValue variable within a Component. The calculator will provide the calculated value if it hasn't already been calculated or if the inputs have changed since the previous calculation.
useCallback allows a parent to pass a child component a callback which: 1) maintains referential equality across multiple layout passes 2) is updated to have the latest parent props and state, even if the child doesn't re-render.
1-parameter overload of useCallback: refer to docs there.
2-parameter overload of useCallback: refer to docs there.
3-parameter overload of useCallback: refer to docs there.
4-parameter overload of useCallback: refer to docs there.
5-parameter overload of useCallback: refer to docs there.
6-parameter overload of useCallback: refer to docs there.
7-parameter overload of useCallback: refer to docs there.
Registers a callback to perform side-effects when this Component is attached/detached from the tree.
Registers a callback to perform error handling for exceptions that might happen in child components down in the tree.
Provides a persistent FirstDrawReporter instance to trigger onDrawn callback immediately after the first draw for a given component. To bind returned reporter with a component, pass it via the Style.reportFirstContentDraw prop.
This hook creates a set of references, one for each focusable component that can be used for changing the default focus order. Use with Style.focusOrder
Creates an InfiniteAnimationGroup container for continuous, lifecycle-owned looping animations — shimmer, pulse, spinners, breathing effects, loading dots. Each child loops between an explicit from and to, starts with the component, and stops when it unmounts.
Returns a stable AnimationTrigger.Lazy instance for explicit manual triggering.
Declares a mutable, main-thread confined reference that will be persisted across renders with an initial value provided by the initializer. It's similar to useState, except that the returned reference is mutable and updating it will not cause a re-render.
Declares component state that can be restored by a lifecycle-backed host.
Declares a state within a Component. The initializer will be invoked to provide the initial value of state. The initializer will be invoked again if the deps change when the Component is rendered again.
Defines one or more Transition animations for the given component
Defines single or multiple Transition animations for the given component.
Defines one or more Transition animations for the given component and allows for the Transition to be re-evaluated based on changes in the deps
Declares a ViewModel scoped to the store supplied by the tree's host. Root trees supply a LithoViewModelStore through ComponentTree.Builder.withLithoViewModelStore, while nested trees receive their current inherited store through TreeProps.
Gives every hook called by block an identity nested under key. Use this when the same source hook call renders several logical items whose order can change. The key must be immutable, stable across renders, and unique among invocations of this withNewScope call site under the same parent scope. Duplicate sibling keys are reported and disambiguated by their order. Two different call sites may use the same key without colliding.