Replies: 2 comments 1 reply
-
For pager you definitely don't need val children: List<...> =
listOf(
ComponentA(childContext(key = "childA")),
ComponentB(childContext(key = "childB")),
)
...
HorizontalPager(count = children.size) { index ->
// Render children[index]
} |
Beta Was this translation helpful? Give feedback.
-
Pager is neither a classic stack nor a basic list, it's something in between. A classic stack creates and renders 1 component at a time. A pager however only needs a max of 3 created and rendered components. If we have for example 50 items we don't want all those items to be created if we just need 3 of them. In my example it's totally fine to use a list, however maybe it's worth to think about an implementation where you can specify the amount of created components |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to create a viewpager in compose (using Accompanist-Pager) with decompose children?
I got a parent screen for example with a childStack of two views.
So the main screen either displays the first or the second child.
Main screen compose
Now I want to have a horizontal viewpager of these children.
Beta Was this translation helpful? Give feedback.
All reactions