Michal Klimczak
04/17/2021, 1:03 PMcb
04/17/2021, 1:52 PMnestedScroll()
modifier on the LazyRow
and set the dispatcher
to an empty/no-op dispatchercb
04/17/2021, 1:53 PMscrollable()
?matvei
04/20/2021, 10:18 AMmatvei
04/20/2021, 10:20 AMModifier.scrollable(viewpagerState).nestedScroll(ConsumeAllPostFlingNestedScrollConnection)
. This approach is more scalable and flexible, although not that elegant on a first glanceMichal Klimczak
05/11/2021, 6:50 PMmatvei
05/12/2021, 9:42 AMMichal Klimczak
05/14/2021, 1:37 PMprivate class NoOpNestedScrollConnection : NestedScrollConnection {
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource) = Offset(available.x, 0f)
}
And it kinda works, but I feel like I should do it on the Pager side, but cannot quite get it right.matvei
05/16/2021, 12:00 PMHorizontalPager(modifier = Modifier.nestedScroll(remember { NoOpNestedScroll() } )) {}
And that's should do the trick. This is as close as you get it to the pagerMichal Klimczak
05/17/2021, 7:56 AMNoOpNestedScroll
right. Didn't know which method should return zero offset and which should consume. (I assume that NoOpNestedScroll
is not something that exists in compose lib, right?)Michal Klimczak
05/17/2021, 7:58 AMmatvei
05/17/2021, 10:35 AMMichal Klimczak
05/17/2021, 11:03 AMMichal Klimczak
05/17/2021, 11:09 AMclass NoOpNestedScrollConnection : NestedScrollConnection {
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource) = Offset(available.x, 0f)
override suspend fun onPostFling(consumed: Velocity, available: Velocity) = Velocity(available.x, 0f)
}
If I add this to the HorizontalPager, nothing changes, it still behaves like before (so a nested Row overscroll makes it scroll to the side).
However if I add the same thing to the nested Row, it behaves as expected - the overscroll is not proagated to the HorizontalPager (actually onPostScroll is enough, onPostFling not required, even for flings here).matvei
05/18/2021, 12:28 PMMichal Klimczak
05/18/2021, 12:33 PMmatvei
05/18/2021, 12:50 PMMichal Klimczak
05/18/2021, 1:00 PMcb
05/18/2021, 1:58 PMMichal Klimczak
05/18/2021, 2:38 PMjzeferino
11/15/2021, 4:20 PMLazyRow
and a ViewPager2
. any suggestion on how to workaround it?matvei
11/17/2021, 12:02 PMLazyRow
is in the view-based container like RecyclerView
or ViewPager2
as we don't have nested scroll interoperability yet. What's the issue you are observing?jzeferino
11/17/2021, 3:55 PMLazyRow
it swipes the pager
• when i reach the end of the LazyRow
the fling/swipe don’t move the pagerjzeferino
11/22/2021, 11:56 AMmatvei
11/22/2021, 12:49 PMif i fling fast in theDo you have a sample code that reproduces this problem with original ViewPager2? It should only happen when you have a HorizontalPager that is compose's pager and NOT with interop. For the second one, we have a bug filed (https://issuetracker.google.com/issues/192006539), but no ETA that I can provide yet.it swipes the pagerLazyRow
jzeferino
11/22/2021, 12:53 PMmatvei
11/22/2021, 1:55 PMAfzal Najam
03/29/2022, 2:49 AMRow
inside a HorizontalPager
scrolls the Pager after reaching the end of visible row items. Using the no-op NestedScreenConnection
doesn’t seem to work in this case.Ashutosh Gupta
03/06/2023, 10:19 AMHorizontalPager
inside ViewPager2
. When I fling fast over HorizontlPager
, the ViewPager2
takes the event and moves to next page. How to fix this?
@jzeferino were you able to fix that fling issue with lazyrow and viewpager2?