Hello, I've placed a MapView within a LazyColumn, ...
# compose
j
Hello, I've placed a MapView within a LazyColumn, and the scrolling is interfering with being able to move up or down on the mapview. I've tried disabling scrolling, but I am unable to interact with the screen after. Code below
Copy code
LazyColumn(
                state = scrollState,
                modifier = Modifier
                    .fillMaxSize()
                    .padding(16.dp)
            ) {
              

                item {
                    Map(
                        zoneViewModel.lat,
                        zoneViewModel.lon,
                        focusRequester,
                        isScrollingEnabled
                    ) {
                        isScrollingEnabled = !isScrollingEnabled
                        if (isScrollingEnabled) {
                            scrollState.reenableScrolling(scope)
                        }
                        else {
                            scrollState.disableScrolling(scope)
                            focusRequester.requestFocus()
                        }
                    }
                }
fun LazyListState.disableScrolling(scope: CoroutineScope) { scope.launch { scroll(MutatePriority.PreventUserInput) { awaitCancellation() } } } fun LazyListState.reenableScrolling(scope: CoroutineScope) { scope.launch { scroll(MutatePriority.PreventUserInput) { } } }
I ended up finding a solution where I created a new class that extended the MapView class and overrided one of its methods.
Copy code
class CustomMapView(
    context: Context
): MapView(context) {

    override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {
        parent.requestDisallowInterceptTouchEvent(true)
        return super.dispatchTouchEvent(ev)
    }
}
As a result, I was able to remove all my code that disabled scrolling