https://kotlinlang.org logo
#compose
Title
# compose
a

agrosner

02/13/2023, 3:51 PM
We have a bunch of legacy fragment screens with a
CoordinatorLayout
, where we have an inner composable fragment contained inside of that. What happens is that the
CoordinatorLayout
gives the content size a bunch of extra height below the visible, scrollable size of a compose
LazyVerticalGrid
. We’ve turned on the nested scrolling interop, but the coordinator layout is two levels up, so overridding the
LocalView.current
feels wrong. Also, a compose fragment can appear in other composable hierarchies if the content hierarchy above the composable shifts, it will break again. Anyone have a good solve for this? Im thinking of walking up the parent tree to find the nearest coordinatorlayout or wrapping the composeview in a
NestedScrollinParent3
implementation
this is an image of the hierarchy
k

kenkyee

02/13/2023, 3:54 PM
"wrapping the composeview in a
NestedScrollinParent3
implementation" Sounds like the right thing to do. Scrollable in a scrollable sounds like a super weird thing to do though...
a

agrosner

02/13/2023, 4:29 PM
yeah im copying code from the compose
AndroidViewHolder
which does nested scrolling interop too…so ill see if that works.
actually so the issue is that the lazyverticalgrid size is wrong when the content is pushed down. It seems that the issue isnt the coordinator layout but the use of relative layout or constraint layout to push its content below the app bar. the grid seems to not realize it can continue scrolling in visible space
ok so yeah confirmed its not actually any of coordinator layout. its actually some sort of expectations in compose. If we push the compose content below app bar, the bottom is cut off, but if we let it overlap, then the content fully scrolls down, even if the bottom bar is visible
k

kenkyee

02/13/2023, 7:55 PM
if you can create a small repro, it's probably worth reporting it as a bug..others will probably hit it...
a

agrosner

02/13/2023, 7:56 PM
yeah good call.
ill try it!
im surprised others havent yet
5 Views