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

Rob Sherling @rob117

About: I work in Japan and am fluent in Japanese. Open DMs on twitter if you any questions about language or programming!

Location:
Tokyo, Japan
Joined:
Mar 23, 2017

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

Publish Date: Dec 18 '23
7 3

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!

Comments 3 total

  • Best Codes
    Best CodesDec 18, 2023

    That is so cool!

  • AlexMedyantsev
    AlexMedyantsevFeb 20, 2024

    Thank you for sharing your work! Really came in handy

  • Sisko
    SiskoAug 13, 2024

    *UPDATED : i solve it i should run app on dev mode *
    he bro
    when i install it on react native expo and follow guide on npm and try to run app i got this problem :

    ERROR Invariant Violation: requireNativeComponent: "RNSelectableText" was not found in the UIManager.

Add comment