https://kotlinlang.org logo
#compose
Title
# compose
a

Alex Styl

03/17/2023, 1:36 PM
Copy code
Modifier.pointerInput(Unit) {
    detectTapGestures(
        onPress = { offset ->
            // pressed

            awaitRelease()
            // released
        }
    )
}
I am using the above code to detect when the user keeps holding on a
Box
. The issue is that when I tap and hold on the box and then move my finger outside the bounds of the Box, then
awaitRelease()
is never unblocked. is there a way for awaitRelease() to be done when the user releases their finger even outside the composable they started pressing on?
👀 1
a

Albert Chang

03/17/2023, 3:29 PM
In that case a
GestureCancellationException
will be thrown so you can just check that.
15 Views