facebook / litho

A declarative framework for building efficient UIs on Android.
https://fblitho.com
Apache License 2.0
7.71k stars 764 forks source link

issue about viewpager component #1028

Closed zhengzhong1 closed 1 month ago

zhengzhong1 commented 1 month ago

Version

0.47.0

Issues and Steps to Reproduce

I need to dynamically adjust the height of the viewpager to achieve the effect shown in the following figure: image

In Viewpager2, I can dynamically calculate and refresh the height of viewpager2 by listening to ViewPager2.OnPageChangeCallback, calculating the difference between the current page and the target page, and sliding the differencer;

In litho, I did not find the ViewPager2.OnPageChangeCallback interface, only the lower-level RecyclerView.OnScrollListener interface, so I am wondering if there is an implementation similar to the native ScrollEventAdapter in litho;

Expected Behavior

Link to Code

Please show some code we can use to reproduce this issue. Consider using PlaygroundComponentSpec to provide a small example of the issue

zielinskimz commented 1 month ago

Hey, I don't think it is possible with the existing ViewPager component unfortunately. You'd have to try to build your own component based on the ViewPager2 and expose the APIs you need.