You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classDetailViewModel : ViewModel() {
val textState =MutableStateFlow("test")
init {
viewModelScope.launch {
delay(300)
textState.value ="this is a performance test"// skip frames when updating text
}
}
}
UI:
privatefunDetail() {
val vm:DetailViewModel= viewModel()
val text by vm.textState.collectAsState()
Column(
modifier =Modifier
.fillMaxSize()
.background(Color.Gray),
) {
for (i in1..100)
Text(text = text)
}
}
The text was updated successfully, but these errors were encountered:
version: 1.11.7
navigation-compose version: 2.8.3
Navigation animation is laggy when ui changes.
Here is a simple demo, when navigating to Detail from any destination, skip frames occur when updating the text.
Navigation animation is:
ViewModel:
UI:
The text was updated successfully, but these errors were encountered: