I searched this group and on Google, but what is t...
# compose
t
I searched this group and on Google, but what is the replacement for ScrollableColumn again?
t
I have been using
Copy code
Column(modifier.verticalScroll(rememberScrollState())
t
nice, thanks!
j
LazyColumn { item { ... } }
☝️ 1
c
Weird that in beta01 this compiles but doesn't work:
Copy code
Column(Modifier.scrollable(rememberScrollState(), Orientation.Vertical))
t
I used the LazyColumn { item {} } as above, and works like a charm..
c
@tylerwilson there are cases where you might not want a LazyColumn though. According to @romainguy both a scrollable column and a lazyCol can achieve the same output, but there is a lot more going on under the hood to get LazyView working. Also, all of the composables scrolling off and on the screen in a lazyColumn are volatile meaning you can lose the state of the individual composable if the composable holds its own state.
j
From the api changes: ScrollableColumn/Row were deprecated. Using ScrollableColumn is less efficient comparing to LazyColumn when you have a large scrolling content because with LazyColumn we can only compose/measure/draw visible elements. To prevent users from going inefficient way we decided to deprecate ScrollableColumn and ScrollableRow and promote usages of LazyColumn and LazyRow instead. Users can still decide they don't need the lazy behaviour and use the modifiers directly like this: Column(Modifier.verticalScroll(rememberScrollState()))
👆 1
t
Yup. LazyColumn isn't a good choice if you have any other lazy list nested inside them. Your child lists would recompose, then you'd be refetching data, losing scroll position, etc 😬
t
In my case, I am not really doing anything ‘lazily’. I have a set of background element cells, and then another layer that contains items of varying sizes. Think a daily calendar type view. So I am setting up everything with absolute sizes and was using ScrollableColumn just because it was taller than the view I am in…