litho icon indicating copy to clipboard operation
litho copied to clipboard

Add support for FlexboxLayoutManager

Open mnayef95 opened this issue 5 years ago • 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?

mnayef95 avatar Oct 17 '20 14:10 mnayef95

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 avatar Nov 05 '20 11:11 nicous

@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()

mnayef95 avatar Nov 05 '20 11:11 mnayef95

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.

nicous avatar Apr 06 '21 12:04 nicous