algorand/js-algorand-sdk

Support React-Native

Eric-Warehime opened this issue · 2 comments

Problem

Let's support running the SDK in react-native. There are a few issues which are known that I'll try to list below, and probably a bunch of things that might break.
#738
#643 (although this one in particular looks fixed)
Others?

Dependencies

N/A

Urgency

3.0.0 release

The tweetnacl package uses some functions that are not provided in React Native. There is a React Native-specific tweetnacl package that fixes this somehow, so we may wish to switch to that instead. Or we could polyfill?

Moving crypto dependencies is delicate and we are not JS experts. Work TBD.

Attempts at polyfilling crypto for react-native resulted in both a huge amount of needed code changes, and more importantly having to pull in all of react-native as a dependency because it's listed as a peer-dependency. This made our webpack build more complex because of wanting to remove it, and also caused failures when running w/ CJS because it seems like react-native is only compatible with ES for some reason.

I've opened #798 to give users more visibility into failures in react-native when they do hit them, but at this point they will need to polyfill crypto themselves unless react-native decides to implement it in their core modules.