Skip to content

Litho Support

Eli Hart edited this page Jun 19, 2017 · 4 revisions

(Added in 2.1 release)

Epoxy provides basic and experimental support for working with Facebook's Litho framework. Feature support will be fleshed out over time. Feedback or help is welcome!

To enable Litho support, include the Epoxy Litho module:

dependencies {
  compile 'com.airbnb.android:epoxy-litho:2.2.0' // (or latest Epoxy version)
}

Generating Models from Layout Specs

Epoxy will automatically generate an EpoxyModel subclass for all classes annotated with Litho's @LayoutSpec annotation. A setter method will be added to the model for every @Prop in the layout spec. Additionally, the model will track the state of the props and only update them when they have changed on the model.

Models generated from layout specs can be used in an EpoxyController alongside regular EpoxyModels. This allows you to combine Litho component usage with traditional Android views in the same RecyclerView.

Currently Unsupported

  • You cannot yet use Litho models with a Litho Recycler, they can only be used with a normal Android RecyclerView.
  • Incremental mounting is not enabled
  • Async layout and incremental recycling are not used.
  • Mount Specs do not have an EpoxyModel generated for them.
  • Prop configurations (default values, marking a prop as optional, and resource types) are currently ignored.