Jorge Castillo
12/11/2022, 9:28 AM@Composable
fun UploadBox() {
var loadingState by mutableStateOf(false)
if (loadingState) {
Progress()
} else {
Content() // this is simplified, it is a big composable that contains a button
}
}
The The content has a button that on click, it sets loadingState = true
, performs an action in a coroutine CoroutineScope.launch
, then toggles it back to false
. For some reason the UploadBox
does not seem to recompose and show the Progress
while the state is true
. It always goes to the else
branch. The action on click is done using the CoroutineScope
obtained via rememberCoroutineScope()
. Not sure what's happening hereJorge Castillo
12/11/2022, 9:31 AMremember
Jorge Castillo
12/11/2022, 9:31 AM