PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

Dragging gesture is consumed when used in scrollable composable

Open haluzpav opened this issue 3 years ago • 5 comments

🐛 Bug Report

When the PhotoView is used in a scrollable composable, the PhotoView and Compose don't communicate the dragging events properly, and so the composable doesn't scroll as it should. When dragging some other part of the composable, scrolling works.

TBH, this sounds like a Compose issue, so I also made a ticket for them: https://issuetracker.google.com/issues/220919265

Expected behavior

When dragging on PhotoView which is in scrollable composable, the composable can be scrolled.

Reproduction steps

You can checkout this minimal repo.

The problem lies in this:

Column(modifier = Modifier.verticalScroll(...)) {
     AndroidView(factory = { context -> PhotoView(context) })
}

Also, a video. The problematic Compose behavior starts at 0:16. Before that, you can see the expected behavior in Views.

https://user-images.githubusercontent.com/24211726/155380978-0ea22f31-5557-4940-9a79-94a396ed0696.mp4

Configuration

Version: 2.3.0

Platform: :robot: Android 11

haluzpav avatar Feb 23 '22 18:02 haluzpav

I've exactly got the same problem

Hessam-Emami avatar Apr 07 '22 11:04 Hessam-Emami

@haluzpav have you found a workaround for this? or maybe other libraries that work better with compose?

Hessam-Emami avatar Apr 07 '22 11:04 Hessam-Emami

@Hessam-Emami nope, but TBH I did not try very much. I just don't use Compose in the Activity where I need the PhotoView. :man_shrugging:

haluzpav avatar Apr 07 '22 19:04 haluzpav

Please fix this issue!

minas1 avatar Oct 20 '22 19:10 minas1

Since this doesn't get any attention and probably never will, I'll mention that there's now Compose implementation of basically the same thing to PhotoView - https://saket.github.io/telephoto/. It has no scrolling issues, even when used inside of scrolling Views.

haluzpav avatar Jun 06 '23 09:06 haluzpav