Hey! Can someone tell me why this is happening? Th...
# compose
m
Hey! Can someone tell me why this is happening? There’s snapping on the right side of the carousel. Thanks!
Copy code
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TodayGoalsCarousel(
    modifier: Modifier = Modifier,
    items: List<@Composable CarouselItemScope.(Int) -> Unit>,
    preferredItemWidth: Dp = 180.dp,
    itemSpacing: Dp = 8.dp,
    contentPadding: PaddingValues = PaddingValues(horizontal = 16.dp)
) {
    key(items.size) {
        val carouselState = rememberCarouselState(itemCount = { items.size })
        HorizontalMultiBrowseCarousel(
            state = carouselState,
            modifier = modifier
                .fillMaxWidth()
                .wrapContentHeight()
                .padding(vertical = 16.dp),
            preferredItemWidth = preferredItemWidth,
            itemSpacing = itemSpacing,
            contentPadding = contentPadding,
        ) { index ->
            items[index].invoke(this, index)
        }
    }
}
It turns out that the problem doesn’t appear with composeMultiplatform = "1.9.0-beta01". All the later versions I tried (1.9.1, 1.9.2, and 1.9.3) have this issue.