Skip to main content

Cheatsheet

note

The following cheatsheet provides a set of links for the migration of individual aspects of existing code from the Spec API to the Kotlin API.

Spec APIKotlin API
@LayoutSpecKComponent and Props
@OnCreateLayoutComponentScope.render()
@OnCreateTransitionuseTransition()
@OnCreateInitialState / @OnUpdateStateuseState()
Lazy StateuseRef()
@OnErroruseErrorBoundary()
@OnAttached / @OnDetacheduseEffect()
@OnEventEvent Handling
@OnCalculateCachedValueuseCached()
@TreePropgetTreeProp()
@OnCreateTreePropTreePropProvider
Common PropsStyle
Column.create(c)Column(); see Flexbox Properties Cheatsheet
Row.create(c)Row(); see Flexbox Properties Cheatsheet
Manual Keyskey()
Handlehandle()
@OnCreateLayoutWithSizeSpecSizeConstraintsAwareComponent
@MountSpecPrimitiveComponent()
@OnTriggerControllers pattern
@OnBind / @OnUnbindbindTo() / bind() / bindWithLayoutData() + onUnbind()
@OnMount / @OnUnmountbindTo() / bind() / bindWithLayoutData() + onUnbind()
@OnBindDynamicValuebindDynamic() - Dynamic Values API
@ShouldUpdateshouldUpdate()
@OnCreateMountContentcreateContent()
@OnCreateMountContentPoolViewAllocator / DrawableAllocator
@OnMeasurelayout()
@OnBoundsDefinedlayout()
@OnPreparePrimitiveComponentScope.render()
@OnLoadStylePrimitiveComponentScope.render()
AccessibilityAccessibility (see: AccessibilityStyles)
hasChildLithoViewsdoesMountRenderTreeHosts
isPureRenderNot needed in Kotlin APIs, isPureRender=true is the only mode.
RecyclerCollectionComponentLazyList / LazyGrid
@GroupSectionSpecLazyList / LazyGrid
SingleComponentSectionLazyListScope.child()
DataDiffSectionLazyListScope.children()