t4t5/nostr-react

question about react native usage

shobitb opened this issue · 4 comments

Hi @t4t5, thank you for making this! I have a question — can I use this library in a react-native package? I'm running into a "ReferenceError: Property 'TextDecoder' doesn't exist, js engine: hermes" when I do use it (as described in the README), but I'm not sure if that's an issue from nostr-react, or something else. Thoughts?

for websockets to work in hermes you just npm install text-encoding and then at the top of your entry file (in expo it is App.js) you add import "text-encoding";.

I'm working on a react-native client for nostr too, maybe we could join forces :)

let me know if the trick worked for you

Thank you! I had to add text-encoding-polyfill to get it to work.

@dyegolara where's your react-native client?

@shobitb its a work in progress, but colab is open https://github.com/dyegolara/nostr-attached

t4t5 commented

Hey @shobitb! I haven't really considered React Native usage tbh, but if it works with some tweaks, feel free to open a PR with some updated instructions in the README! 👍 Thanks for being early adopters!