saket / telephoto

Building blocks for designing media experiences in Compose UI
https://saket.github.io/telephoto/
Apache License 2.0
935 stars 29 forks source link

OnClick stops being called after rapidly clicking #38

Closed MV-GH closed 1 year ago

MV-GH commented 1 year ago

I have a few cases where onClick stopped being called. This case, where I rapidly click the ZoomableAsyncImage is the one I can reliable reproduce.

I have a onClick functionality that enables immersive mode. In some weird cases it gets stuck in this mode.

code if relevant ```kt ZoomableAsyncImage( contentScale = ContentScale.Fit, model = image, imageLoader = imageGifLoader, contentDescription = null, onClick = { showTopBar = !showTopBar systemUiController.isSystemBarsVisible = showTopBar // Default behavior is that if navigation bar is hidden, the system will "steal" touches // and show it again upon user's touch. We just want the user to be able to show the // navigation bar by swipe, touches are handled by custom code -> change system bar behavior. // Alternative to deprecated SYSTEM_UI_FLAG_IMMERSIVE. systemUiController.systemBarsBehavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE }, modifier = Modifier.fillMaxSize(), ) ``` (v1.0.0-alpha02) https://github.com/MV-GH/jerboa/blob/feb5954c6c0d96763aef4822b4623a66c620713e/app/src/main/java/com/jerboa/ui/components/imageviewer/ImageViewerActivity.kt#L153

The video below illustrates the problem:

In the first part I show the correct behaviour.

In the second part, It attempt to reproduce the problem. You cant really see it but i am rapidly clicking until it gets stuck.

In the third part I am stuck in immersive mode.

https://github.com/saket/telephoto/assets/67873169/93ae68b3-fb04-454b-9fe7-d0b040a3e0d0

saket commented 1 year ago

Are you able to reproduce this in the sample app by any chances? I can't seem to run into this. I'll try building your project to see if something else is affecting this.

MV-GH commented 1 year ago

I can no longer reproduce this, you can close it. I think it was because i was using that old version.

saket commented 1 year ago

Awesome, thanks for confirming.