Hey <@UHAJKUSTU>, how can I make Pager look like a...
# decompose
v
Hey @Arkadii Ivanov, how can I make Pager look like a carousel, i mean the selected page should not fill whole screen height, and parts of prev and next page (or atleast the next page) to be displayed, with a spacing between pages?
a
You can try calling HorizontalPager manually with required parameters by specifying the pager argument.
v
I'm trying this, but the pages still occupy whole screen
Copy code
Pages(
    pages = pages,
    onPageSelected = { index ->
        component.onSelectPage(index)
        runCatching { news[index]?.let(component::recordViewed) }
    },
    pager = { modifier, state, key, pageContent ->
        VerticalPager(
            state = state,
            pageSpacing = 16.dp,
            modifier = modifier,
            key = key,
            contentPadding = PaddingValues(16.dp),
            pageContent = pageContent,
        )
    },
    modifier = Modifier.fillMaxSize(),
    scrollAnimation = PagesScrollAnimation.Default,
) { _, page ->
    when (page) {
        is NewsFeedPages.News -> NewsPage(page.component, Modifier.fillMaxWidth())
        is NewsFeedPages.Poll -> PollPage(page.component, Modifier.fillMaxWidth())
        is NewsFeedPages.Quiz -> QuizPage(page.component, Modifier.fillMaxWidth())
        NewsFeedPages.NotImplemented -> Unit
    }
}
a
I think it's more a question of using VerticalPager. Worth asking in #CJLTWPH7S. Maybe you should specify height for your pages.
v
I will try asking there i want to have pages occupy the height it needs Thanks
Also, is there any chance of Decompose Pages Navigation to support Paging3 As of now, its quite complex to achieve that First PagingData<T> has to be collected in Composable to make it LazyPagingItems then I have to use this to append pages to the pages navigator And manually trigger the page load for PagingData to loads more pages
a
I think that's the only way. It's a navigation model controlled imperatively. Maybe you don't need the navigation at all?
v
I need each page to be a decompose component mainly in a Pager UI, so the api calls and data in each component is correctly scoped My each page has a LazyList in itself, which is paginated and few more api calls
a
Yeah, that makes sense. I would try to avoid paging3 library in this case, and just call the API manually and append pages. Should be pretty easy to implement, taking into account that Child Pages is persistent.