Oh, also in the release above ^ Nested Scrolling i...
# compose
m
Oh, also in the release above ^ Nested Scrolling is available! I remember people in this channel asked about collapsing toolbars, collapsing calendars and proper backdrop supports. You can do all that right now in alpha09. check it out, the entrance point for this APIs is
Modifier.nestedScroll
. Basic components like
LazyColumn
and
BackdropScaffold
already support this, but you can do even more yourself! Let me know if you have any feedback or feature requests πŸ™‚
πŸ“œ 4
πŸŽ‰ 14
p
Copy code
nestedScroll works great, thanks. Why is PreUpPostDownNestedScrollConnection defined as internal?
c
New to compose. Nested scrolling didn't work before this? So you couldn't put a scroll view inside of a scrollview? Or am I missing something? Just curious to see how this nestedScrolling support is applicable to me. Thanks @matvei
m
Previously we had nested drag supported that was build in (so scrollview in scrollview worked with drag and that's pretty much it); It wasn't giving much control if you want smth more sophisticated (like scrolling backdrop first when you scroll the list inside or hide toolbar when scrolling) -- and now we have a new system that allows that all
If you don't plan to develop custom components with custom UI, ScrollableColumn/ Lazycolumn (or regular scrollview/recyclerview-like components) already work out of the box. Same with material bottom sheets and backdrop. If you plan to develop custom collapsing behaviours or smth like that -- you might find new Modifier.nestedScroll useful.
πŸ‘ 1
Why is PreUpPostDownNestedScrollConnection defined as internal?
Few reasons: β€’ It's temporary. We yet to make a proper detailed nested scroll per components (probably backdrop, bottomsheet, extendedbottomsheet, etc will have slightly different logic). β€’ It's an implementation detail of the few components and not intended for an external usage. β€’ It's build on top of public API so you could easily make your own that is similar or just a copy paste and iterate on that. This way you have more control and we won't break you when we remove it. I hope that makes sense. Same idea that in LazyColumn we don't expose it, as it's just an internal detail of a scroll.
βœ”οΈ 1
s
Very nice! Will this also work if I have my scrolling
@Composable
nested inside of a
<NestedScrollView />
out of the box? If not, is there a way to make that work now with some
Modifier.nestedScroll()
magic?
Actually, I found a way to get rid of the parent
<NestedScrollView />
and clean up some stuff along the say. But I'm leaving the question up there in case someone else is looking for an answer to the same question.
However, is it possible to hook my
LazyColumn
up to a
<CoordinatorLayout />
further up in the hierarchy with a behaviour like we do in XML? Looking for an equivalent to this:
Copy code
layout_behavior="@string/appbar_scrolling_view_behavior"
m
view-compose-view cases are yet to be covered by default, it's possible but I wasn't able to get my hand this year to do this πŸ™‚
Not sure if we will go as deep as compose-coordinator specific tuning, but it should just work if there's no magic inside the coordinator layout. I hope we will be able to cover recycler-view in compose or compose in recyclerview cases at least, we'll see
s
Yeah, that's totally understandable. πŸ™‚ Hmm, AFAICT, there's not much magic in the coordinator layout, unless using it together with an
<AppBarLayout />
and
<CollapsingToolbarLayout />
is considered magic. (I'll be the first to admit that it is a little bit magical to me. πŸ˜…) Our
@Composable
is inside of a
<FrameLayout id="container" />
, which wraps the tab content, essentially, and that one's got a
layout_behaviour
, but our
LazyColumn()
doesn't seem to trigger it. If it's supposed to just work, I can see if I can make a minimal app to reproduce and report a bug. πŸ™‚
m
If it's a
container
, my first guess is that it should just work, so please go ahead a file a minimal code that you want to get working and when we'll approach view-compose nested scroll I will take this into account as well πŸ˜‰
πŸ™Œ 1
s
I've made a showcase small showcase for the issue, and I see there's this issue here (made by you?): https://issuetracker.google.com/issues/174348612 Do you prefer if I comment on that, or create a new issue specifically for what I'm facing? Showcase: https://github.com/sindrenm/compose-view-nested-scroll-issue
m
Resurrecting that πŸ™‚ Please comment on that ticket, we could collect all cases there and tackle them later
s
Alright. simple smile
f
Did you end up figuring out this? Im facing that same issue of having a
LazyColumn
inside an
AppBarLayout
not working correctly.