Skip to content

Conversation

@Sunbreak
Copy link

Workaround for https://youtrack.jetbrains.com/issue/CMP-9250/iOSInteropView-handles-tap-when-scrollable-layout-flings

Testing

Just a workaround showcase. No test

Release Notes

Just a workaround showcase. No release notes

Google CLA

Sign the Google Contributor's License Agreement at https://cla.developers.google.com to let us upstream your code to Google's AOSP repository

@ASalavei
Copy link

ASalavei commented Nov 11, 2025

@Sunbreak , thank you for the contribution!
I've checked you solution on iOS Simulator and unfortunately it does not work for me. Here is the code I used for testing:

class MyButton: UIButton(frame = CGRectZero.readValue()) {
    override fun touchesEnded(touches: Set<*>, withEvent: UIEvent?) {
        super.touchesEnded(touches, withEvent)
        println(">> Ended: $touches")
    }
}

Row {
    LazyColumn(Modifier.weight(1f)) {
        items(100) {
            UIKitView({ MyButton() }, modifier = Modifier.height(40.dp).fillMaxWidth())
        }
    }
}

The approach to cancel all interop touches for 5 seconds after the fast pan gesture does not look very reliable. For instance, MKMapView can use such combination of gestures and it will be crucial if it does not work. I currently do not know the exact solution that can fix the problem, but it looks like we can check if the touch was consumed by Compose using UIKitInteropElementHolder.platformModifier and Modifier.onPointerEvent - that might work even better then handling the PointerEventResult.

Unfortunately we don't have contribution guidelines, but If you'd like to proceed with this MR, please be sure that your changes are covered by tests - see iOS Instrumented Tests and the corresponding Configuration.kt file.

Copy link

@ASalavei ASalavei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, see the comment above

@Sunbreak
Copy link
Author

Thanks for your advise. I'll try later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants