Dmitry Berdnikov
05/04/2022, 2:45 PMdata class State(val snackMessage: String? = null) // hoisted in ViewModel
//show snackbars inside root Composable
LaunchedEffect(state.snackMessage) {
if (state.snackMessage != null) {
snackbarHostState.showSnackbar(state.snackMessage)
viewModel.shackbarShown() // this make a copy of the state with snackMessage = null
}
}
So then I emit a new instance of state with snackMessage = null
, I expect that I see animation but instead it’s just gone.
I’ve made some experiment and removed the line viewModel.shackbarShown()
and then the exit animation was played…