I have many different types of views in recycler spec.
@LayoutSpec
object AdPageSpec {
@OnCreateLayout
fun onCreateLayout(c: ComponentContext, @Prop model: List<AdPageItem>): ComponentLayout {
return RecyclerCollectionComponent.create(c)
.disablePTR(true)
.section(
DataDiffSection.create<AdPageItem>(SectionContext(c))
.data(model)
.renderEventHandler(AdPage.onRender(c))
.build()
)
.buildWithLayout()
}
@OnEvent(RenderEvent::class)
fun onRender(c: ComponentContext, @FromEvent model: AdPageItem): RenderInfo {
when (model) {
is TopDetailsItem -> ...
is DescrItem -> ...
is ParamItem -> ...
is GridItem -> ...
}
Everything works fine but at some point I need items to be laid in GridLayoutManager fashion.
Does anybody knows how to achieve this with litho?