Does anyone have an idea why `detectTapGestures` m...
# compose
g
Does anyone have an idea why
detectTapGestures
might not detect taps when there’s an ongoing animation on the screen? I have a separate
pointerInput
modifier that just logs input events, and both the down&up events are being logged. Once the animation completes, taps are detected fine again. I also added a log to check that my composable wasn’t being re-composed on every frame of the animation, but it doesn’t seem to be 🤔
d
That's likely because animation was not `launch`ed from the coroutine scope, and instead suspended the
CoroutineScope
that
detectTapGestures
is in. Could you share a code snippet?
g
It’s a little chonky: https://gist.github.com/grandstaish/477a6f7103c949cac9204151383a2b19#file-bottomsheetdialog-kt-L177 (This very similar to
ModalBottomSheet
from Material, except that it lives inside a fullscreen Android Dialog window.)
d
That's odd,
SwipeableState
doesn't use suspend animation at the moment. Which alpha release/snapshot is this built against?
g
I copy/pasted
SwipeableState
into my app from main (we don’t have a dep on Material)
(Otherwise we’re just using alpha10)
d
g
ah yea, i see
hmm
i guess i’d need to intercept the tap?
d
The
startDraggingImmediately
flag in
swipeable
is to ensure any swiping during the animation gets handled immediately, rather than waiting for a touch slop. I'm not sure what the recommendation would be if you don't want that behavior. @matvei might be able to advise. You might be able to get the tap intercepted if you put the
.pointerInput
modifier before the
swipeable
, but you'll need to account for the swipe offset yourself.
🙏 1
g
Changing the flag to
false
does work around the problem i am facing. IDK how you figured that out by looking at my code dump mind blown
🤣 1