0

I have a fragment that implements RecyclerView that I have included in jetpack compose view via AndroidView. I have pager, one page is in compose and second is in the old style.

Example of whole screen

Column(
   modifier = Modifier
       .fillMaxSize()
       .verticalScroll(scrollState)
) {
    HorizontalPager(
         modifier = Modifier
             .fillMaxHeight()
             .nestedScroll(rememberNestedScroll(scrollState = scrollState)),
         count = pages.size,
         state = pagerState,
     ) { page ->
          when (val detailPage = pages[page]) {
            is oldlayout -> convertToCompose(
                  modifier = Modifier
                      .fillMaxSize()
                      .scrollable(scrollState, Orientation.Vertical)
             )
             is compose -> ....

}


convertToCompose(modifier: Modifier) {
    Box(modifier = modifier) {
        AndroidView(
            modifier = modifier,
            factory = { context ->
               ......
            ViewCompat.setNestedScrollingEnabled(this, true)

    }
}

It looks like compose and recyclerview scrolls are not compatible. Compose view scroll works with example of the above. When I'll remove verticalScroll(scrollState) compose scroll stops working and vica versa, the recyclerview starts working.

Is there any possible way how to forward NestedScroll from compose to old xml layout? I tried it according to official documentation and it didn't help me.

1 Answer 1

0

It is recommended to use coordinatorlayout + appbarlayout + RecycleView

Then Use : RecycleView Item to fill the compose view

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.