facebook/litho

Add support for FlexboxLayoutManager

mnayef95 opened this issue · 3 comments

It's will be nice to support https://github.com/google/flexbox-layout, is there a way to use it now without official support?

Hey @mnayef95 , Litho uses https://yogalayout.com/ to build the UI. Not sure if I understand how would you want to use flexbox here, can you give an example?

@nicous Now I can use something like this

GridRecyclerConfiguration.create()
            .numColumns(3)
            .gridLayoutInfoFactory { c, _, _, _, _ ->
                GridLayoutInfo(GridLayoutManager(c, 3))
            }
            .build()

But I can't use something like this:

FlexboxRecyclerConfiguration.create()
            .flexboxLayoutInfoFactory { c, _, _, _, _ ->
                FlexboxLayoutInfo(FlexboxLayoutManager(c))
            }
            .build()

So I can use them like this:

val component = RecyclerCollectionComponent.create(componentContext)
                .section(ExampleSection.create(SectionContext(componentContext)).build())
                .recyclerConfiguration(Grid | Flexbox | Linear | etc...)
                .build()

Hey @mnayef95, sorry for the delay on this, tbh I did not see your response until now. As you said we don't have that but I think you can probably implement this by creating a configuration for it and the layout info factory.