There is something similar like swiperefreshlayout to pull to refresh in the jetpack compose
There is something similar like swiperefreshlayout to pull to refresh in the jetpack compose
You can use Google's Accompanist library for implementing swipe-to-refresh.
Sample usage:
val viewModel: MyViewModel = viewModel()
val isRefreshing by viewModel.isRefreshing.collectAsState()
SwipeRefresh(
state = rememberSwipeRefreshState(isRefreshing),
onRefresh = { viewModel.refresh() },
) {
LazyColumn {
items(30) { index ->
// TODO: list items
}
}
}
Documentation: https://google.github.io/accompanist/swiperefresh/