litho

A declarative framework for building efficient UIs on Android.

APACHE-2.0 License

Stars
7.7K
Committers
667

Bot releases are hidden (Show)

litho -

Published by mihaelao over 5 years ago

Additions

  • new codelabs with README instructions
  • interface for listening for changeset generation in Sections

Fixes

  • cleaning old code
litho - v0.27.0

Published by astreet over 5 years ago

BREAKING CHANGES

  • PerfEvents:
    • Remove FrameworkLogEvents. EVENT_CREATE_LAYOUT, FrameworkLogEvents. EVENT_CSS_LAYOUT , and FrameworkLogEvents. EVENT_COLLECT_RESULTS: these are replaced by the sub-spans "start_create_layout"/"end_create_layout", "start_measure"/"end_measure", and "start_collect_results"/"end_collect_results" under the existing top-level EVENT_CALCULATE_LAYOUT_STATE event. The PerfEvent#markerPoint API can be used to log these sub-spans (b859605258da6431b706d17c07df7bc8864396df)
    • Remove FrameworkLogEvents.PREPARE_MOUNT without replacement: this didn't provide much value (4917370d6a7405cddce01c13740f22e9ee736529)
    • Remove FrameworkLogEvents.DRAW without replacement: this was not free to maintain and didn't provide much value (9e548cbda5ad78d6f8d3a82ec42639439c118751)
  • Default Range Ratio: The default range ratio for Sections/RecyclerBinder is changed from 4 screens worth of content in either direction to 2. This should improve resource usage with minimal effects on scroll performance. (9b4fe95b8cd48a15046b0d39c4f4756e50f35772)
  • ComponentsSystrace.provide: ComponentsSystrace now assumes an implementation will be provided before any other litho operations occur (457a20f660f14e7132e16668c21b4cf1ce766b70)

Improvements

  • ComponentsLogger implementations can now return null for event types they don't care about (4075eb75c9a6f967111b451df6699d1b9b97671b)
  • Add RecyclerCollectionEventsController#requestScrollBy (0146857653e29cb24491cbb8bee9307e55187365)
  • Preliminary Robolectric v4 support (4c2f657f9e6edc45f78b9a8d82085025fa0fc86d, etc.)
  • More efficient code generation for state updates in Components and Sections (8c5c7e312fb7d1855caabc2fccbf5adc57e6e945, etc.)

Bugfixes

  • Remove usage of API 19+ Objects class in cached value API (aabb24a5e67d30e5b93eb43f6c37aae91f455369)
  • Unset Components scope when creating a new ComponentContext in ComponentTree (05f11a74a4a06b4abcb1e302f56201609acccad2)
  • Fix perf logging for dirty mounts (3ad8bfba12a43e108602bcd8c63fd2404e6203cb)
  • Fix crash when @OnCalculateCachedValue takes no args (2a0f5240bc8c711d8e45db0e5426517f8bfbf49a)
  • Reduce number of systrace markers in collectResults: these were skewing they perceived size of collectResults in production and weren't actionable (3107467a4e3fd649821757699a5adba683f47edd)

See all changes here: https://github.com/facebook/litho/compare/v0.26.0...v0.27.0

litho - v0.26.1

Published by passy over 5 years ago

Bugfix Release

Picks 513cf91b747bdf06c6bda78840a9195e900d4deb to fix an issue with the Flipper integration.

litho - Version 0.26.0

Published by colriot over 5 years ago

BREAKING CHANGES

Improvements

  • EXPERIMENTAL: Make state updates faster by only recreating the subtrees which are being updated and reuse (read clone) the untouched subtrees while calculating a new layout. You can try in out by setting ComponentsConfiguration.isReconciliationEnabled flag globally or using ComponentTree.Builder#isReconciliationEnabled for specific trees
  • Add a replaceAll(List<RenderInfo>) method to RecyclerBinder (#451)
  • Eliminate Gradle deprecated methods (#526)
  • Remove object pooling everywhere
  • Cleanup tests and unused code
  • Update documentation

Bugfixes

See all changes here: https://github.com/facebook/litho/compare/v0.25.0...v0.26.0

litho - Version 0.25.0

Published by muraziz over 5 years ago

BREAKING CHANGES

Improvements

Bugfixes

See all changes here: https://github.com/facebook/litho/compare/v0.24.0...v0.25.0

litho - Version 0.24.0

Published by mihaelao over 5 years ago

BREAKING CHANGES

  • The default for state updates has changed from sync to async. At Facebook this meant we ran a codemod script on the codebase and changed all state update methods to the explicit Sync variant (Sync is just appended to the end of the state update call), then changed the default. The reason for this is to not change existing behavior in case it breaks something, since there are many callsites. The script is committed and available at https://github.com/facebook/litho/blob/master/scripts/codemod-state-update-methods.sh . We recommend using it if you have any concerns about state update calls automatically becoming async. As a reminder, when you add a @OnUpdateState method, it generates three methods: updateState, updateStateSync, and updateStateAsync. Previously updateState == updateStateSync. Now, updateState == updateStateAsync
litho - Version 0.23.0

Published by passy almost 6 years ago

BREAKING CHANGES

Improvements

Bugfixes

See all changes here: https://github.com/facebook/litho/compare/v0.22.0...v0.23.0

litho - Version 0.22.0

Published by astreet almost 6 years ago

BREAKING CHANGES

  • transitionKey has changed default scope from GLOBAL to LOCAL: This means a transition key is local to the spec where it was declared and can only be reference from that spec. To restore previous behavior, 1) set .transitionKeyType to GLOBAL on your Component when you set a .transitionKey, and 2) update the corresponding Transition.create calls to specify a GLOBAL key type.
  • EditTextSpec is now deprecated in favor of TextInputSpec. TextInputSpec fixes bugs that could cause loss of text while typing and allows text to be preserved when scrolled off screen. Interface has changed slightly, text can no longer be provided as a prop but now must be set on the main thread using the setText trigger.
  • shouldClipChildren property on ComponentTree has been removed: use clipChildren common prop on Component instead.
  • We now verify all fields on a *Spec are static and final: this is to prevent correctness issues we've seen with using mutable, non-thread-safe data in specs. Use @State instead if necessary.

Improvements

  • Re-enable systrace blocks for async state update names: faa9a0a0266f03153ea615fa8d5dc8a78f6a635e

Bugfixes

  • Fix crash in TextDrawable: eb3fbc9b1df057b5edbda6e34ca05c8559fec426
  • Fix ComponentContext leak in TextInputSpec: 8bb9d76d54729f0c70cb4cf3fa2d780d8d5c6602
  • Fix incorrect handling of aspect ratio when combined with flex-stretch in Yoga: 6a9328d81b796a8d11fa0a184935f445824b07c6

See all changes here: https://github.com/facebook/litho/compare/v0.21.0...v0.22.0

litho - Version 0.21.0

Published by wujingwe almost 6 years ago

New Features

  • Add getAndroidContext method in ComponentContext
  • Introducing the Equivalence interface
  • Add fading edge support to VerticalScrollSpec
  • Support Hiding Top or Bottom Rounded Corners for CardSpec
  • Make TextInputSpec dynamically re-measure itself
  • Add multiline to the TextInputSpec
  • Add TextWatcher support to TextInputSpec
  • Add Comparable Drawable
  • Add DefaultComparableDrawable

Improvements

  • Raise background thread to high priority when it's running a layout
  • Add accessibility role for Header in bucket headers
  • Replaced default constructors with member assignments in YGConfig
  • Synchronize outside of for loops in RecyclerBinder to improve performance
  • Cache isAccessibilityEnabled Value
  • Use the generated Comparable types for the reflective isEquivalentTo method
  • Measure TextInputSpec height based on underlying EditText height
  • Report FATAL error when encounter transition key duplication instead of throwing an exception
  • Change ComponentContext to not extend Context
  • Schedule async layouts in parallel with initRange layout
  • Boost thread that is running LayoutStateFuture
  • Add dispatchOnFocusedVisibleEvent to ComponentTestHelper
  • Lazy init border color drawable

Bugfixes

  • Fix temporary enabling/disabling child clipping for animations
  • Fix releasing drawable order
  • Fix setting bounds to DLDrawable with underlying MatrixDrawable
  • Fix selecting a position before mounting a circular recycler and it either resets to middle or does not allow user to scroll to the left
  • Don't recursively calculate layout for released LayoutStateFutures
  • Never wrap RippleDrawables into DisplayListDrawables
  • Check if tree is valid before recomputing async layout
litho - Version 0.20.0

Published by muraziz about 6 years ago

New Features

  • Add API to request scroll to position that includes snapping in RecyclerCollectionComponent
  • Track crashes in stacktraces across threads.
  • Add ability to turn LithoView debug overlay mode to see whether layout was calculated on UI thread (green) or BG thread (red)

Improvements

  • Change traverse direction to backward if list is laid out from end in RecyclerBinder
  • Include accessibility services like SelectToSpeak in isAccessibilityEnabled check
  • Allow chaining of RecyclerBinderConfiguration setters
  • Add Litho architecture overview in the docs
  • Only find visible area for mounting if attached
  • Add clipChildren prop to the Component.Builder
  • Simplify displaylist handling and remove prefetching
  • Added Builder methods to RecyclerBinderConfiguration
  • Add disable clipping props to CardSpec

Bugfixes

  • ComponentHost should not delay press state of children
  • Fix LayoutStateFuture thread safety
  • Fix zero division crash in RecyclerBinder
  • Re-create DisplayList in LayoutState when device rotates
  • Unmount sticky header when hiding it
  • Fix the order in which the drawable is unmounted and released in DrawableComponent
litho - Version 0.19.0

Published by sergeynv about 6 years ago

New Features

  • Make CommonProps accessible from a Component
  • Add incremental mount prop to VerticalScroll
  • Add smooth scroll to center in RecyclerBinder
  • Make CardShadowSpec and CardShadowDrawable public

Improvements

  • Provide timestamp in @OnDataRendered callback
  • Make possible to animate Rotation on RT
  • Avoid delaying ComponentHost children pressed state
  • Add the ability to provide onScrollChangeListener to VerticalScroll

Bugfixes

  • Fix synchronization of event triggers
  • Add missing minHeight and minWidth attributes to theme parsing
  • Fix height/width calculation when the actual size is less than minHeight/minWidth
litho - Version 0.18.0

Published by passy over 6 years ago

New Features

  • Support for @OnDataRendered callback in RecyclerBinder (8da4867).
  • Transition.delay() API (35228cdf5e5c1ab4bd26be792bf62c8b79aac9d1).

Improvements

  • Perf improvements for VertialScroll (039c6a6a66fff3f71f044f3f6d29d56e9a566a60, eee0197, 3cc6574).
  • Ignore uninitialized LayoutParams from the RecyclerBinder (#395).
  • Prewarm ImageSpec layout (f7957828efabf31650deefec7ab6055dca06ce4a).
  • Add a getter for ComponentContext on Component.Builder (#398).
  • Updated to SoLoader 0.5.1 and Yoga 0.19.0.

Bugfixes

  • Fix out-of-bounds for text truncation (a226ccb25d52f629e471ed05ba3034d15a541d87).
  • Correct TextDrawable span click detection for bidirectional text. (3201eff).
  • Fix TreeProp persistence from Section to Component to Component (31318d0a8342897ef02361d1beb9cdc0ea37b27e).

For a full list of changes, check out the comparison view.

litho - Version 0.17.0

Published by wujingwe over 6 years ago

New Features

  • Add fillViewport to VerticalScroll (34dad312670bf613766bc13cf62267e23906ae2d)
  • Smooth scrolling alignment options. (fd60d1e43611f85d1bc6b2e997682328b42bd406)
  • Support smooth scrolling to child by key. (6438850765217614aba174f89bc1a1915e32b3c6)
  • Support smooth scrolling with offset. (62fa98eda0f014911620b370d8b535f0033715e8)
  • TextInput: a single-line text field (7a445f780062d96c6a92950bf84b6e26ef3495f2)
  • Add ability to clear focus on an EditText. (af3c86212f6043aa69f2fc537dc5bbdb2e8cf92c, ca9a073009f99bc7a2c8d4de669a1aefd7efdb42, f3e244e2f721eca76c762ec5c4171ac8fc0e6033, etc.)
  • Implements text truncation with custom ellipsis in litho TextSpec. (9bb5b83702dfe3da8c4784fdef0252aea29c6967)

Bug Fixes

  • Fix layout diffing when layout state is calculated twice before mount. (5508612c125559ea92dfcd2ccf04c264132184c3)
  • Fix race condition during tracing in sections setRoot. (b6b4006c733dcdf980c9cbfa57c9647e68a521bb)
  • Fix Android crash in VerticalScroll on pre-Lollipop versions. (19e3582b7dad764d7bf282bdfcc73fde79fab45c)
  • Clean-up parent / owner reference of children during clonning. (a444dc030f9de04544b29d1142a1307092671767)
  • Remove recycling from TreeProps. (e0c635da6a3162bf64146ee0491f135f21f4e69d)
  • Clear components in LayoutState.releaseRef() (481e4863b173d857386d52d087466a5616a0ac41)
  • Do not start already started renderthread animation. (dc123d0ddd61100ae24c0a4afdc207774737f15e)
  • Fix docs around shouldUpdate. (bda08a17e62317f28e16365a2d116abd205ad1c3)

Docs

  • Tooltip api doc (7c2b1cd5e4cde98c7569280b9bd042cc732999b9)

More

For a full list of changes, see https://github.com/facebook/litho/compare/v0.16.0...v0.17.0

litho - Version 0.16.0

Published by astreet over 6 years ago

New Features

  • New TTR (time-to-render) API, for tracking when components render in a Section. See RenderCompleteEvent and ComponentRenderInfo.Builder#renderCompleteHandler. (48c59c23af171731dd595556665267ee08d03e36, etc.)
  • Add ability to reference @CommonProps (e.g. layout props, and other props common to all components) from lifecycle methods (bdce0816714a42d4abff97dbc20d4a38697685b0)
  • @TreeProps are now passed along from Sections to their child Components. (4771b6435dede730746e406dcb59baa9297fb517)
  • Add ability to modify corner radius per corner. (5626084f32c60ad5857a5b622b02a167ae9cacef)
  • Support lineSpacingExtra from XML theme (cc5c99d8e6472a9deb1d7a4f9a8307089afc580f)
  • Default timing interpolator is now AccelerateDecelerate. (4f11da06120d72049c9b0b00af5940d53f880138)

Bug Fixes

  • Fixes for double measure bugs in AOSP (bb4dbd59c0eb9b5f63beb7c7dce6d7731ff0a828, db4adbbc44d2101d384d46a19af9d052654817bf)
  • Fix appear animations for width and height animations of a root LithoView. (031b11dd6812fbed209073493fe3d7ac8f4c8dbb)
  • Remove AccessibilityRole from Litho images to not conflict with new support library. (6a461918688f641ff384549b1cfac6ff9d16d872)
  • Fix bug where View enabled/clickable/etc flags were accidentally cleared on update. (99b13f7441e1a9b332f8a8b75e61132c0f5ceef6)
  • Fix race condition while copying TreeProps. (ae2bdf5ed9f148707a3185d197f393a607c37379)

More

For a full list of changes, see https://github.com/facebook/litho/compare/v0.15.0...v0.16.0

litho - Version 0.15.0

Published by passy over 6 years ago

New Features

  • Imperative animations are now possible with @OnUpdateStateWithTransition.
  • InterceptTouchEvent now provides a View param, bringing it in line with other events. (759948ef16720aed15ff3b994c96ed91f1b7f55b)
  • @CommonProp allows accessing shared props in components like margin/padding in the same way normal props work. (8535205e23a7bd1101af6c634ce8fe4036901b3b)
  • ComponentRenderInfo now accepts Builders alongside Components. (ab1b237376cea317c5ec4d9eb0710aaf4ce77561)
  • Add KeyUpEvent to EditText. (ad47d9c07437854ac5a94c4b639695c1466a259d)
  • Several operations in RecyclerBinder now have asynchronous counterparts.
  • litho-fresco has been upgraded to work with Fresco 1.9.0.
  • Many pool sizes can now be dynamically configured. (b6ada06803552af9be9ca51de700cabb5577069e)
  • Letter spacing support in Text. (cdb428b6cf5176d833cb2455175fba8f4a049e4a)

Bug Fixes

  • Several fixes regarding text rendering. (3b10ddc46ac2b008c509b19ce01d93b357daee41, 9efb2d6bb6e8b253b9f270eac76f6d2736845248)
  • Potential crash when inserting items during scroll. (2a4baa528142a6f8d294ce37a3dfe1a241e7cf5b)
  • Recycler scroll restoration. (60988311c63cd0b07233c66df25e91be24d32cd6)

More

For a full list of changes, see https://github.com/facebook/litho/compare/0.14.0...v0.15.0

litho - Version 0.13.1

Published by passy over 6 years ago

Minor Breaking Changes

Wait, what? Breaking changes in a patch release?
Yes, but it's really small and GitHub code search didn't show a single use of it out in the wild.

  • RecyclerConfiguration is no longer part of RecyclerCollectionComponentSpec but a top-level class. f2b00a819b4412a53020e3bbb46feb30e709eb5c
  • Don't override child layout params by @vinc3m1 (https://github.com/facebook/litho/pull/328)
litho - Version 0.13.0

Published by muraziz over 6 years ago

Breaking changes:

  • TextSpec bounds are clipped by default.

What's new:

  • Introducing Error Boundaries similar to React which helps to handle errors in lifecycle methods gracefully.
  • Added EventHandler support in TestSpecs.
  • Added StateValueAssert to be able to assert StateValues without unwrapping them.
  • Added support for specifying custom ViewTypes when using ViewRenderInfo.
  • Added rotation prop to Components (mainly used for animating rotation with Transition API).

Improvements/Fixes:

  • Fixed StartSnapHelper when child views are smaller than half the size of the RecyclerView.
litho - Version 0.12.0

Published by marco-cova over 6 years ago

Breaking changes:

  • StateUpdatesTestHelper has now its own testing.state package.
  • RowReverse and ColumnReverse got removed. Row and Column offer a reverse() property setter to achieve the same.
  • Stetho support, as already announced in v0.11.0, was removed.
  • Last but not least, onCreateLayout() now returns a Component and not a ComponentLayout!!
    buildWithLayout() is also gone.

What's new:

  • Litho now supports StateListAnimator.
  • Trigger APIs is now supported in Sections.
  • New LithoTooltip APIs to show a PopoverWindow.

Improvements/Fixes:

  • EditTextSpec accept now a TextView.OnEditorActionListener.
  • The corner effect for the border got fixes and we also improved the border radii APIs.
  • TextDrawable Span click detection got fixed for multi-line Spans.
  • HorisontalScrollSpec now supports RTL.
litho - Version v0.11.0

Published by passy almost 7 years ago

TestSpecs

TestSpecs offer a new way to test your components. Check out the post in our Facebook group or jump straight into the docs.

So long, Stetho, and thanks for all the fish

v0.11.0 is the last release of Litho that comes with Stetho support. We are removing the integration with the next release (v0.12.0). We are really sorry for the inconvenience that we know this will cause some people but we think that it will be good for the future as it allows us to move faster and provide a better debugging experience down the line. We have nothing to announce in that regard just yet.

litho - Version 0.10.0

Published by passy almost 7 years ago

What? Another release already? Yes, and there have been some interesting changes.

Breaking changes

Layout was renamed to Wrapper: 38837d74e6bdcf73d9bee6d8e5ffa5b7580711ba

The new API is more Component-y and takes your delegate as a prop rather as part of the constructor call. Instead of writing Layout.create(c, component), you now write Wrapper.create(c).delegate(component). @IanChilds wrote a handy codemod script to help you with the transition. You can use it like this: git grep "import com.facebook.litho.Layout;" -l | xargs -L1 python WrapperForLayout.py.

Other changes

  • #281: Generate "Sp" attribute builders for props. Thanks @pavlospt for the contribution! 77777d85d6456863bddf4f992f93dc4d83ec6ae7
  • Various Recycler changes (https://github.com/facebook/litho/commit/8457228376e18a75cc2cc6a233071fab8a74c1e7, fa3f78f701d17f187904c3b40858ecb605b4724d, 615830f8b18bc2c25ce71ff5188640f3e28467c8).
  • Performance improvements through pooling adjustments (cdb10be903a5aefb25d44d9a3dbc92e490298fe1, c33039f9fdca9434a4926dcea87d37b75179620a, a6821e1965e146f2f8a60b4cfdfcb52278c8e1e7, 8dd2abb18fca67670c2c80382501b2f497236595, 364bf845297da8cc0cb6ff4bc5caeafe31cf1288).
Package Rankings
Top 4.24% on Repo1.maven.org
Top 4.01% on Proxy.golang.org