Questions tagged [litho]

A declarative, high-performance Android UI library by Facebook inspired by the React component model. Litho uses the Yoga layout library (an implementation of Flexbox) and is optimized for creating fast RecyclerView based interfaces.

Litho is a declarative, high-performance Android UI library by Facebook inspired by the React component model. Litho uses the Yoga layout library (an implementation of Flexbox) and is optimized for creating fast RecyclerView-based interfaces.

Links

  • Get Started: Integrate Litho into your Android app
  • Tutorial: Your first Litho components
  • Sections: An advanced API for heterogenous Recycler collections
  • API: JavaDoc

Community Resources

38 questions
15
votes
4 answers

Solution to build dynamic forms with Android

I am actually developing an Android application on which I should display dynamic forms based on metadata contained inside JSON documents. Basically the way it works (without the details) is that a JSON document represent the structure of a form: { …
MHogge
  • 5,408
  • 15
  • 61
  • 104
3
votes
1 answer

How to handle space between items of a RecyclerCollectionComponent

I have a RecyclerCollectionComponent where I am providing data using DataDiffSection. Now I want to have some margin (say x dp) for the first and last item and some margin among items (say y dp). My onRender Looks like…
n.arrow001
  • 1,090
  • 3
  • 10
  • 28
3
votes
1 answer

Using MountSpec component with "wrap_content" View - How to implement onMeasure()

I am building some Mount Spec components to render specific Views. All my Views are supposed to have height = "wrap_content". When I first started working on it I had not implemented the onMerasure() method (uses @OnMeasure annotation) so the…
thigobr
  • 51
  • 3
3
votes
1 answer

How to perform pagination with the Litho framework?

I am implementing a Retrofit APi for getting data from the server and showing this in a RecyclerView using the Litho framework, and it's doing well. As all of us know when we have infinite data to show in recyclerview we have to implement the…
Hussain Sherwani
  • 536
  • 5
  • 22
2
votes
2 answers

What are the alternatives to RecyclerView for a feed

An app includes a feed like Twitter or Instagram. Tried it with the RecyclerView. Would Litho (fblitho.com) be a good alternative to make a good feed with text, videos and pictures? Or maby other libraries?
Alex G
  • 317
  • 3
  • 4
  • 11
2
votes
1 answer

FB Litho: How to set custom font for Text

My question is how to set a custom font for Text component in Facebook's UI framework Litho? The following is my Text component: Text.create(componentContext) .flexGrow(1f) .verticalGravity(VerticalGravity.CENTER) …
Ugurcan Yildirim
  • 5,973
  • 3
  • 42
  • 73
1
vote
1 answer

Click Handler in Builder cannot be applied to void

I am working in mobile application (android) and start to learn litho framework, I write a click handler for particular widget inside component. But the error is displayed "Builder cannot be applied to void" why this issue is came for a…
1
vote
1 answer

Building UI using Litho and JSON

I was looking for Backend Driven UI libraries for Android and came across Litho for Declarative UI. I was wondering if there is any helper/extension library for Litho that can generate the UI based on JSON.
Ravindra Barthwal
  • 380
  • 2
  • 4
  • 16
1
vote
1 answer

Is there a way to easily propagate a Litho event from a child to the root parent?

Is it possible to propagate an event from an nth-child to the root parent? I have been looking out for a good guide that does not involve declaring the event at every node to the root of the tree. My ultimate objective is to expose and event to…
Bangonkali
  • 1,111
  • 9
  • 13
1
vote
1 answer

How to repeat a Litho animation

The Litho animation examples all begin when a user triggers an event. But I need an animation that begins right away and continues indefinitely. In other words, I have the same problem as How to run a Litho animation automatically? but I need a…
Michael Osofsky
  • 11,429
  • 16
  • 68
  • 113
1
vote
0 answers

How to set a component visible true or false when another component do a action

Now what I'm trying to do is that when my CustomCheckboxSpec component in the onCheckboxClicked event sends a true or false value for the isChecked parameter, it calls the CustomText component and through the setVisible function and by the…
1
vote
0 answers

Couldn't generate Android App Bundle version of my App

Is anyone else facing this problem? I can generate Debug and Release versions of my App in Bundle Package. No gradle erros during the Assemble. Dependencies: // Litho implementation 'com.facebook.litho:litho-core:0.19.0' implementation…
1
vote
1 answer

Litho ListRecyclerConfiguration Kotlin with linearLayoutInfoFactory

I'm new to Kotlin, and I want to use Facebook's litho library, I have found the java way to create a recycler configuration but I am unable to do the same in Kotlin. RecyclerCollectionComponent.create(c) …
Reedy
  • 1,866
  • 2
  • 20
  • 23
1
vote
1 answer

How to implement part of sections with LinearLayoutManager and part with GridLayoutManager?

I have many different types of views in recycler spec. @LayoutSpec object AdPageSpec { @OnCreateLayout fun onCreateLayout(c: ComponentContext, @Prop model: List): ComponentLayout { return…
ar-g
  • 3,417
  • 2
  • 28
  • 39
1
vote
1 answer

Litho, ViewPager and Tabs. How to load several Tab's layouts using Litho?

I'm trying to implement a ViewPager with Tabs just like this: The fragment's layouts are rendered with Facebook's Litho, but the problem here is that only the first item, in this case 'Look', is loaded. See the code: MainActivity: public class…
1
2 3