A declarative framework for building efficient UIs on Android.
Java C++ Kotlin Python Haskell C Other
Clone or download
passy and facebook-github-bot Fix links to Yoga docs
Summary: Per title.

Reviewed By: muraziz

Differential Revision: D8942017

fbshipit-source-id: 938909adad68f0d43f13e0c4706bac9cc73a812c
Latest commit ae6465a Jul 22, 2018
Permalink
Failed to load latest commit information.
.circleci Bump Circle Cache keys (#399) Jul 17, 2018
.github Encourage users to post the library version they use Jul 7, 2017
config Run oss tests in both release and debug mode Oct 26, 2017
docs Fix links to Yoga docs Jul 22, 2018
gradle Misc improvements May 21, 2018
lib Replace `YG_NODE_STYLE_PROPERTY_IMPL` macro with template Jul 19, 2018
litho-annotations Add ability to choose to override a common prop Jun 26, 2018
litho-core Increase S/N ratio for MOUNT events Jul 20, 2018
litho-espresso add screenshot tests for delay animations Jul 17, 2018
litho-fresco Change callsites to use android Context in onCreateMountContent Jun 1, 2018
litho-instrumentation-tests Preserve TreeProps through S->C->C Jul 16, 2018
litho-it-powermock Replace include_defs with load. Jun 16, 2018
litho-it Increase S/N ratio for MOUNT events Jul 20, 2018
litho-processor Always make required props builder fields non-static Jul 6, 2018
litho-sections-annotations Provide @OnDataRendered delegate method for Section Jul 5, 2018
litho-sections-core Pass isDataChanged to RecyclerBinder and prevernt calling `maybeUpdat… Jul 16, 2018
litho-sections-processor Add isMounted as third parameter in @OnDataRendered method Jul 12, 2018
litho-sections-widget Pass isDataChanged to RecyclerBinder and prevernt calling `maybeUpdat… Jul 16, 2018
litho-stubs Use HardwareCanvas instead of DisplayListCanvas prior to API 23 Jun 28, 2018
litho-testing Pass isDataChanged to RecyclerBinder and prevernt calling `maybeUpdat… Jul 16, 2018
litho-widget Expand EditText to take a TextWatcher Jul 20, 2018
sample-barebones-kotlin Misc improvements May 21, 2018
sample-barebones Replace include_defs with load. Jun 16, 2018
sample-codelab Replace include_defs with load. Jun 16, 2018
sample-kotlin Return Map instead of MutableMap on SampleComponentsLogger (#394) Jun 30, 2018
sample add sample RenderThreadAnimationActivity Jul 19, 2018
scripts Fix circle ci setup script May 16, 2018
.buckconfig Bump Buck Android target Apr 13, 2018
.gitignore Extend gitignore May 15, 2017
BUCK Replace include_defs with load. Jun 16, 2018
CONTRIBUTING.md Let there be Apache-2 Apr 13, 2018
LICENSE Let there be Apache-2 Apr 13, 2018
LICENSE-examples Lines authored by rspencer Mar 29, 2017
LITHO_DEFS.bzl Fix linter crash for LITHO_DEFS.bzl. Jul 9, 2018
README.md Let there be Apache-2 Apr 13, 2018
THIRD_PARTY_NOTICES.txt Add THIRD_PARTY_NOTICES.txt Apr 18, 2017
build.gradle Update yoga deps Jul 19, 2018
gradle.properties v0.18.1-SNAPSHOT Jul 19, 2018
gradlew Misc improvements May 21, 2018
gradlew.bat Initial gradle build Apr 5, 2017
settings.gradle Add integration test for Section tree props May 22, 2018

README.md

Litho CircleCI Join the chat at https://gitter.im/facebook/litho

Litho is a declarative framework for building efficient UIs on Android.

  • Declarative: Litho uses a declarative API to define UI components. You simply describe the layout for your UI based on a set of immutable inputs and the framework takes care of the rest.
  • Asynchronous layout: Litho can measure and layout your UI ahead of time without blocking the UI thread.
  • View flattening: Litho uses Yoga for layout and automatically reduces the number of ViewGroups that your UI contains.
  • Fine-grained recycling: Any component such as a text or image can be recycled and reused anywhere in the UI.

To get started, check out these links:

Installation

Litho can be integrated either in Gradle or Buck projects. Read our Getting Started guide for installation instructions.

Quick start

1. Initialize SoLoader in your Application class.

public class SampleApplication extends Application {
  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, false);
  }
}

2. Create and display a component in your Activity

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ComponentContext context = new ComponentContext(this);

    final Component component = Text.create(context)
        .text("Hello World")
        .textSizeDip(50)
        .build();

    setContentView(LithoView.create(context, component));
}

Run sample

You can find more examples in our sample app.

To build and run (on an attached device/emulator) the sample app, execute

$ buck fetch sample
$ buck install -r sample

or, if you prefer Gradle,

$ ./gradlew :sample:installDebug

Contributing

For pull requests, please see our CONTRIBUTING guide.

See our issues page for ideas on how to contribute or to let us know of any problems.

Please also read our Coding Style and Code of Conduct before you contribute.

Getting Help

  • Post on StackOverflow using the #litho tag.
  • Chat with us on Gitter.
  • Join our Facebook Group to stay up-to-date with announcements.
  • Please open GitHub issues only if you suspect a bug in the framework or have a feature request and not for general questions.

License

Litho is licensed under the Apache 2.0 License.