paralleldrive/cuid2

Documentation: Polyfill for "TextEncoder" required in react-native

timotgl opened this issue · 1 comments

So the only dependency of this package is https://github.com/paulmillr/noble-hashes which itselfs has no own dependencies.

In a react-native (v0.64) project running on iOS 14, I had to add this line

import * as fastTextEncoding from 'fast-text-encoding';

to avoid an error of TextEncoder not being defined. Should it maybe mentioned in this project's readme that you may run into this issue when using a JS runtime that doesn't support TextEncoder?

I couldn't find TextEncoder at all in this repo's sources though, so I could be way off. But https://github.com/paulmillr/noble-hashes/search?q=TextEncoder seems to use it.

Yes, it looks like it is required by noble-hashes. It is a good idea to mention this in the documentation for React Native projects.