Closed tom-pratt closed 5 months ago
The issue is with compose multiplatform 1.6.0. There's a dependency mismatch between compose animations 1.6.0 and 1.5.3. The best solution for you is to downgrade to multiplatform 1.5.10. Alternatively, you could wait for pullrefresh to be updated to latest compose.
Thank you very much for the quick reply! I'll wait for the update since im using some new stuff related to resources from 1.6 already.
@tom-pratt pullrefresh 1.4.0-beta01 released with compose-multiplatform 1.6.0-beta02 support, it should fix the crash. As for the indicator being behind the content, that might be because you're using DragRefreshLayout, try PullRefreshLayout.
Thank you! That fixes the crash. The indicator is still showing up behind though and im definitely using PullRefreshLayout
. I thought it might be related to elevation or something but double checked and its not that. Just using it like this.
val pullRefreshState = rememberPullRefreshState(
refreshing = calendarViewModel.refreshing.collectAsState().value,
onRefresh = { calendarViewModel.update() },
)
PullRefreshLayout(pullRefreshState) {
val competitions = calendarViewModel.competitions.collectAsState().value
LazyColumn {
items(competitions) { competition ->
CompetitionCard(navigator, competition)
}
}
}
I was able to fix it by moving the content()
in the PullRefreshLayout
@Composable
fun PullRefreshLayout2(
state: PullRefreshState,
modifier: Modifier = Modifier,
flipped: Boolean = false,
enabled: Boolean = true,
indicator: @Composable () -> Unit = {
PullRefreshIndicator(
state = state,
flipped = flipped
)
},
content: @Composable () -> Unit
) {
Box(
modifier = Modifier
.pullRefresh(
state = state,
inverse = flipped,
enabled = enabled
)
.then(modifier)
) {
content()
val indicatorAlignment = if (flipped) Alignment.BottomCenter else Alignment.TopCenter
Box(
modifier = Modifier
.fillMaxWidth()
.align(indicatorAlignment),
contentAlignment = Alignment.Center
) {
indicator()
}
// content() // Move to top
}
}
Oh, I see. Could you create a Pull Request so that we can properly credit you? No need to create PullRefreshLayout2, just update the existing PullRefreshLayout.
Just made the PR. Thanks for your help and great lib!
Im using compose multiplatform 1.6.0-beta01 and get the following crash when trying to pull to refresh. Also before it crashes I see the refresh indicator but its behind the content.