# pointerInteropFilter

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/pointerInteropFilter.modifier#(androidx.compose.ui.Modifier).pointerInteropFilter(androidx.compose.ui.input.pointer.RequestDisallowInterceptTouchEvent,kotlin.Function1)( requestDisallowInterceptTouchEvent: https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/RequestDisallowInterceptTouchEvent?, onTouchEvent: (https://developer.android.com/reference/android/view/MotionEvent.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` A special PointerInputModifier that provides access to the underlying `https://developer.android.com/reference/android/view/MotionEvent.html`s originally dispatched to Compose. | android |

## Functions

### Modifier.pointerInteropFilter

android Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/input/pointer/PointerInteropFilter.android.kt+function:pointerInteropFilter)

```
fun Modifier.pointerInteropFilter(
    requestDisallowInterceptTouchEvent: RequestDisallowInterceptTouchEvent? = null,
    onTouchEvent: (MotionEvent) -> Boolean
): Modifier
```

A special PointerInputModifier that provides access to the underlying `https://developer.android.com/reference/android/view/MotionEvent.html`s originally dispatched to Compose. Prefer `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/pointerInput.modifier#(androidx.compose.ui.Modifier).pointerInput(kotlin.coroutines.SuspendFunction1)` and use this only for interoperation with existing code that consumes `https://developer.android.com/reference/android/view/MotionEvent.html`s.

While the main intent of this Modifier is to allow arbitrary code to access the original `https://developer.android.com/reference/android/view/MotionEvent.html` dispatched to Compose, for completeness, analogs are provided to allow arbitrary code to interact with the system as if it were an Android View.

This includes 2 APIs,

1. `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.Modifier).pointerInteropFilter(androidx.compose.ui.input.pointer.RequestDisallowInterceptTouchEvent,kotlin.Function1)` has a Boolean return type which is akin to the return type of `https://developer.android.com/reference/android/view/View.html#onTouchEvent(android.view.MotionEvent)`. If the provided `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.Modifier).pointerInteropFilter(androidx.compose.ui.input.pointer.RequestDisallowInterceptTouchEvent,kotlin.Function1)` returns true, it will continue to receive the event stream (unless the event stream has been intercepted) and if it returns false, it will not.

2. `https://developer.android.com/reference/kotlin/androidx/compose/ui/input/pointer/package-summary#(androidx.compose.ui.Modifier).pointerInteropFilter(androidx.compose.ui.input.pointer.RequestDisallowInterceptTouchEvent,kotlin.Function1)` is a lambda that you can optionally provide so that you can later call it (yes, in this case, you call the lambda that you provided) which is akin to calling `https://developer.android.com/reference/android/view/ViewParent.html#requestDisallowInterceptTouchEvent(boolean)`. When this is called, any associated ancestors in the tree that abide by the contract will act accordingly and will not intercept the even stream.

| See also |
|---|---|
| `https://developer.android.com/reference/android/view/View.html#onTouchEvent(android.view.MotionEvent)` |   |
| `https://developer.android.com/reference/android/view/ViewParent.html#requestDisallowInterceptTouchEvent(boolean)` |   |