t4t5 / nostr-react

React Hooks for Nostr 🦤
MIT License
85 stars 14 forks source link

question about react native usage #2

Closed shobitb closed 1 year ago

shobitb commented 1 year ago

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?

dyegolara commented 1 year ago

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

shobitb commented 1 year ago

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

@dyegolara where's your react-native client?

dyegolara commented 1 year ago

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

t4t5 commented 1 year ago

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!