compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

On iOS platforms, Compose gestures(scroll or drag) conflict with native gestures.

Open Gaubee opened this issue 1 year ago • 2 comments

Describe the bug The gestures discussed here include scrolling and dragging. I haven't tested in other scenarios yet.

Regarding dragging: I implemented a native listener (using addGestureRecognizer attached to a UIView, which is rendered in Compose by UIKitView) and received one time UIGestureRecognizerStateBegan, two to three times UIGestureRecognizerStateChanged, and one time UIGestureRecognizerStateCancelled event. However, I didn't perform any cancelled operation, yet it was triggered.

Additionally, there's scrolling: For this, I've prepared reproducible code. I suspect it's the same issue, so I'm raising it in this issue together. But if you think these are two separate problems, please feel free to split this issue.

I'm rendering Compose content in a UIKitSheet, which has its own scrolling behavior, and this scrolling seems to interrupt Compose's scrolling. This issue is particularly noticeable in the new version, but it also occurs occasionally in the old version.

BugGestureDemo.zip

you can toggle the compose version in libs.versions.toml

compose-plugin = "1.6.11"
#compose-plugin = "1.7.0-dev1686"

Their behavior is similar: the finger clearly hasn't left the screen, but the code thinks it has.

You can add clickable to the demo I provided, and you'll see that it's triggered click-event during scroll dragging.

Affected platforms

  • iOS

Versions

  • Libraries:
    • Compose Multiplatform version: 1.7.0-dev1686/1.7.0-dev1698
  • Kotlin version: 2.0.0
  • OS version(s) (required for Desktop and iOS issues): 17.5.1
  • OS architecture (x86 or arm64): arm64
  • Device (model or simulator for iOS issues): iphone 12

To Reproduce Steps to reproduce the behavior:

  1. Click on 'Click Me'
  2. Scroll the UIKit-Sheet
  3. See error

Screenshots

  • 1.6.11

https://github.com/JetBrains/compose-multiplatform/assets/2151644/eed91e2c-376d-4225-b26d-b44a28fa9f99

  • 1.7.0-dev1686/1.7.0-dev1698

https://github.com/JetBrains/compose-multiplatform/assets/2151644/2d87c18a-e119-4c15-81a6-44d33eb7d976

Gaubee avatar Jun 25 '24 09:06 Gaubee

@Levi-Moreira

Gaubee avatar Jun 25 '24 09:06 Gaubee

It's a part of meta issue for proper touch interop with native gesture recognizers. The reported problem is just a single facet of it:

https://github.com/JetBrains/compose-multiplatform/issues/3806 https://github.com/JetBrains/compose-multiplatform/issues/4818 https://github.com/JetBrains/compose-multiplatform/issues/3525

elijah-semyonov avatar Jun 25 '24 09:06 elijah-semyonov

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov