In my multiplatform project I cant seem to find a ...
# multiplatform
m
In my multiplatform project I cant seem to find a solution for LocalOverscrollConfiguration. It shows up as unresolved. I want to disable the overscroll effect for lazycolumn.
👍 1
m
Ah thanks. That's unfortunate. Is there a solution for this at all then?
e
you could make an expect-actual function that configures overscroll on android and does nothing on desktop, for example
m
I am building for android and ios only, and I simply want to disable the overscroll effect. Would you be able to point me in the right direction on how to do that?
e
so something like
Copy code
// common
expect fun disableUiKitOverscroll()
expect fun provideNullAndroidOverscrollConfiguration(): Array<ProvidedValue<*>>

// iOS
@OptIn(ExperimentalFoundationApi::class)
actual fun disableUiKitOverscroll() = optOutOfCupertinoOverscroll()
actual fun provideNullAndroidOverscrollConfiguration() = emptyArray<ProvidedValue<*>>()

// Android
actual fun disableUiKitOverscroll() {}
@OptIn(ExperimentalFoundationApi::class)
actual fun provideNullAndroidOverscrollConfiguration(): Array<ProvidedValue<*>> = arrayOf(
    LocalOverscrollConfiguration provides null
)

// usage
fun main() {
    disableUiKitOverscroll()
    ...
}
@Composable
fun Main() {
    CompositionLocalProvider(*provideNullAndroidOverscrollConfiguration()) {
        ...
    }
}
🙌 1
m
This is gold. Thank you so much. Giving it a shot now.
152 Views