I am trying to build a Compose Multiplatform App, ...
# compose-desktop
a
I am trying to build a Compose Multiplatform App, the nested scroll is working fine on Android and iOS but on Desktop, it is not working.
Copy code
val nestedScrollConnection = remember {
    object : NestedScrollConnection {
        override fun onPreScroll(
            available: Offset,
            source: NestedScrollSource
        ): Offset {
            imageRotation.value += (available.y * 0.5).toInt()
            return Offset.Zero
        }

        override fun onPostScroll(
            consumed: Offset,
            available: Offset,
            source: NestedScrollSource
        ): Offset {
            val delta = available.y
            imageRotation.value += ((delta * PI / 180) * 10).toInt()
            return super.onPostScroll(consumed, available, source)
        }

        override suspend fun onPreFling(available: Velocity): Velocity {
            imageRotation.value += available.y.toInt()
            return super.onPreFling(available)
        }
    }
}
Copy code
Box(
    modifier = Modifier.fillMaxSize()
) {
    LazyColumn(
        contentPadding = PaddingValues(64.dp),
        userScrollEnabled = true,
        verticalArrangement = Arrangement.Absolute.spacedBy(16.dp),
        modifier = Modifier.fillMaxSize().nestedScroll(nestedScrollConnection),
        state = listState
    ) {
        StepsAndDetails(recipe, chefImage)
    }
}
Currently, i am exploring https://github.com/JetBrains/compose-multiplatform/blob/master/tutorials/Mouse_Events/README.md mouse events for this.
s
I believe this is a long-outstanding bug. NestedScroll isn't implemented (properly?) on desktop. https://github.com/JetBrains/compose-multiplatform/issues/653
🥹 1
a
2 years 😢
a
it's a pity.
d
Hello! I will ask about this issue plans in our team
So, we plan to solve it in next 3 months. Hope, plans will comes true.
K 2
s
That's good news! Thanks for the heads-up. It's not particularly important (for me) but it's nice knowing things are happening 🎉