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

Madhava

07/13/2020, 2:41 AM
Does anyone know how to disable androidx.ui.foundation.Text from being selected? I don't see any mention or properties anywhere talking about say "Disabling selection"
👍 1
v

Vinay Gaba

07/13/2020, 2:50 AM
The current workaround is to use
Modifier.longPressGestureFilter
m

Madhava

07/13/2020, 2:54 AM
I did this:
Copy code
Text(
    text = title,
    style = typography.h1,
    color = primaryColor,
    modifier = Modifier.longPressGestureFilter {
        Log.i("PageView", "Text long press")
    }
)
I saw the log but then when i did it again i saw the text selected, do i need to filter the gestures somehow
the return type is Unit?
it seems harder, but if i drag i can still select sometimes, do i need to maybe also override:
Copy code
longPressDragGestureFilter
?
m

Madhava

07/13/2020, 11:36 PM
Thanks, it seems to take care of it most of the time which is enough. 🙂
v

Vinay Gaba

07/14/2020, 3:10 AM
great to hear! 🙂
3 Views