dimsuz
11/19/2021, 3:01 PMTest
composable in the snippet is not recomposed on state change, it's only called once. This seems to happen only if this Box is placed inside a sheetContent
of BottomSheetScaffold
:
Box {
var enable by remember { mutableStateOf(true) }
println("enable out=$enable")
Test(enable = enable)
Button(onClick = { enable = !enable })
}
@Composable
fun Test(enable: Boolean) {
println("enable in=$enable")
Text(text = enable.toString())
}
println
is called, but iner println is not called, it appears only onceAlbert Chang
11/19/2021, 6:29 PMdimsuz
11/19/2021, 7:47 PMenable
is boolean. I thought maybe boxing is involved, but it works for Int
, String
, whatever else. Only boolean
causes no further calls to Test()
to occur.SubcomposeLayout
-usage based bug, reproducible in both stable and beta.
Filed it to the issue tracker: https://issuetracker.google.com/issues/207107687
Though I still suspect that I might've done something I wasn't suppose to do during layout. Still I think it shouldn't produce those weird recomposition skips.
If anyone points out mistakes/fixes, would be grateful.Albert Chang
11/22/2021, 2:37 AMdimsuz
11/22/2021, 9:10 AM