Why does scalinglazycolumn constantly refresh the ...
# compose-wear
l
Why does scalinglazycolumn constantly refresh the item when the page scrolls? Thanks!
j
I am not sure exactly what you are seeing, can you give me more information/an example? At a high level as the list scrolls the ScalingLazyColumn will be working out the new scaling factors and then redrawing with the new values. It shouldn't be recomposing.
l
This is an example. The code is shown above. When I stopped scrolling, I found that I used log E ("Donghe", "log a tag") print the log, which will be called continuously.
j
What version are you using - I just tried to reproduce with the following code against alpha16, 18 and 20 and it is working exactly as I would expect and only logging when new items are being composed and stops when I stop scrolling.
Copy code
@Composable
fun WearApp(greetingName: String) {
  val state = rememberScalingLazyListState()
  ComposeTemplateTheme {
    ScalingLazyColumn(
      modifier = Modifier.fillMaxWidth(),
      verticalArrangement = <http://Arrangement.Top|Arrangement.Top>,
      horizontalAlignment = Alignment.CenterHorizontally,
      state = state,
      autoCentering = false
    ) {
      items(20) {
        Chip(onClick = {}, label = { Text("Item $it") })
        Log.i("Sample", "Composing $it")
      }
    }
  }
}
l
okay, thank you. I will run it again according to your example.