DEV Community

Cover image for React Native PSA - select and highlight text with custom context menus
Rob Sherling
Rob Sherling

Posted on

React Native PSA - select and highlight text with custom context menus

Image credit - realtime photo of me trying to update this library, thanks to @cookiethepom on unsplash.

Before I begin, huge shout out to the two repositories that this was forked from: @astrocoders with the original, and @alenToma. Without their work, this never would have happened.

What is this?

In short, you can now select text again in React Native, fixing a six year old issue.

You can select any text on iOS or Android and give custom context menu actions that you define.

In short, you can do this now (clicking play gif will unstretch the image):

demo

Repo

npm

GitHub

Relevant info

Basically, the libraries that this was forked from hadn't been maintained for iOS for years and required hacks and workarounds to even get working. I just removed old dependencies, updated the iOS code to compile correctly, and cleaned up the readme.

I tried to use ChatGPT to help, but honestly it was just analyzing iOS error messages and removing odd JS dependencies one-by-one.

If you see any problems with it, PRs welcome!

Top comments (2)

Collapse
 
alexmedyantsev profile image
AlexMedyantsev

Thank you for sharing your work! Really came in handy

Collapse
 
best_codes profile image
Best Codes

That is so cool!