alp
01/04/2023, 11:18 PMandroidx.swiperefreshlayout.widget.SwipeRefreshLayout?
There are examples here with a fix using Modifier.nestedScroll(rememberNestedScrollInteropConnection()) for bottom sheet but it seems like it doesn’t work with hierarchy like:
<SwipeRefreshLayout>
<ComposeView> // LazyColumn with Modifier.nestedScroll(rememberNestedScrollInteropConnection()) here
</SwipeRefreshLayout>
scrolling up immediately triggers the swipe refresh.ephemient
01/04/2023, 11:28 PMSwipeRefreshLayout is a NestedScrollingParent3 like CoordinatorLayout)ephemient
01/05/2023, 12:01 AMval state = rememberLazyListState()
LaunchedEffect(listState) {
swipeRefreshLayout.setOnChildScrollUpCallback { _, _ -> listState.firstVisibleItemScrollOffset > 0 }
}
LazyColumn(state = state, ...)alp
01/05/2023, 12:35 AMNestedScrollingParent3 ViewGroups CoordinatorLayout for example?
In more real-world complex scenario, such as when compose code is encapsulated within a fragment, there is not way to propagate SwipeRefreshLayout reference to the compose code, as far as I understand, NestedScrollingParent3 abstraction should solve this issueephemient
01/05/2023, 1:45 AMephemient
01/05/2023, 1:48 AMSwipeRefreshLayout is a NestedScrollingParent3, but ComposeView is not a NestedScrollingChild3alp
01/05/2023, 1:50 AMNestedScrollInteropConnection makes it a NestedScrollingChild3ephemient
01/05/2023, 1:54 AMephemient
01/05/2023, 1:56 AMComposeView is returning false from canScrollVertically before a gesture starts, it seemsephemient
01/05/2023, 1:57 AMSwipeRefreshLayout doesn't delegate a pull down into ComposeView, but if you pull even a little bit first then it all worksalp
01/05/2023, 1:57 AMalp
01/05/2023, 1:57 AMephemient
01/05/2023, 1:59 AMalp
01/05/2023, 1:59 AM