Hello, I’m looking for something equivalent for An...
# compose
f
Or something where we can customize the actions on selected text (if possible)
f
when selecting a text/input the contextual menu is automatically displayed, so I can’t use the dropdown
i
@Alexander Maryanovsky sorry for pinging you, but probably you're the best person to answer here
a
I don’t know of anything like that for iOS/Android, and I even think there isn’t such a thing, but maybe someone in #C0346LWVBJ4 or #C04TPPEQKEJ knows.
f
On native way, it’s possible to customize the contextual menu of a selected text. Just I wanted to know if it was implemented on compose multiplatform.
So by the issue you add (and the linked), it’s not possible at the moment. So I move away from compose (for now).
a
You can probably implement your own context menu without too much difficulty.
That’s one of Compose’s strengths.
f
For this, I need to override the behavior of the default contextual menu, someone has an idea?
a
Roughly, add a long-press listener to the textfield, and open a context menu.
return
true
in the listener to consume the event, to prevent the default menu from opening.
f
I guess, I will give it a try, but it will be a long journey to override the behavior of a selected text.
a
If you’re not familiar with Compose, you’ll have a bit of a learning curve ahead of you.
But if that’s what makes or breaks using Compose for you, then it’s worth it.
f
Digging inside the API to understand how the contextual menu is working, this is managed on foundation level (See SelectionToolbarAndHandles) just beside the cursor behaviour. Thanks, I don’t have time for overriding that, I’m going to find another solution.
Nevermind, I found something https://stackoverflow.com/questions/68956792/floating-toolbar-for-text-selection-jetpack-compose It works well on Compose multiplaform for Android but not well at all for iOS.