facebook / facebook/litho

SNAP_TO_CENTER not working when sticky property is true

Open
#620 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
7.8k
Forks
768
PR merge metrics
No merged PRs in 30d

Description

- [x] I have searched [existing issues](https://github.com/facebook/litho/issues?utf8=%E2%9C%93&q=sticky) and this is not a duplicate

## Version
ext.litho_version = '0.33.0'

## Issues and Steps to Reproduce
I'm using [tutorial code](https://fblitho.com/docs/sections-tutorial) and at the end there is summary:

> Some more fun things you can try:
> - SingleComponentSection has a few interesting props. See if you can make the horizontal scrolling row stick to the top

I'm just added sticky(true) to SingleComponentSection
```
@GroupSectionSpec
object ListSectionSpec {
@OnCreateChildren
fun onCreateChildren(c: SectionContext): Children {
return Children.create()
.child(
SingleComponentSection.create(c)
**.sticky(true)**
...
.recyclerConfiguration(ListRecyclerConfiguration.create()
.orientation(LinearLayout.HORIZONTAL)
.reverseLayout(false)
**.snapMode(SNAP_TO_CENTER)**
.build())
...
```
it sticks but don't snaps any more to the center of a list item.

## Expected Behavior
I guess it should snap properly regardless of sticky prop state

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.