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())
}
dimsuz
11/19/2021, 3:02 PMprintln
is called, but iner println is not called, it appears only oncedimsuz
11/19/2021, 3:03 PMAlbert 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.Albert Chang
11/22/2021, 2:37 AMdimsuz
11/22/2021, 9:10 AM