bitsharesjs icon indicating copy to clipboard operation
bitsharesjs copied to clipboard

Cannot be used in "react native", will appear ”Unable to resolve module `stream`” and “can't find variable Buffer”

Open XJH0415 opened this issue 7 years ago • 3 comments

I'm working on a phone app to make "bitshares" available on the phone, but when I execute "npm install bitsharesjs," the program crashes every time I use "import {PublicKey} from / bitbitshares / s / es'".I think it may be that the "react native" running environment is inconsistent with the browser, resulting in incompatibility, which is my personal view, I hope the author can answer my question, thank you very much.

XJH0415 avatar Apr 08 '18 08:04 XJH0415

Any update here?

lesharadkovich avatar Jul 12 '18 15:07 lesharadkovich

@XJH0415 Same Question as @lesharadkovich 's.

Momtntu avatar Aug 26 '18 13:08 Momtntu

@XJH0415 @lesharadkovich

The reason:

Buffer is a core node module which bitsharesjs depends on.

Solution:

npm install rn-nodeify

./node_modules/.bin/rn-nodeify --install --hack

Reference:

  1. https://github.com/bitcoinjs/bitcoinjs-lib/issues/559
  2. https://github.com/tradle/rn-nodeify

CSeanXu avatar Aug 26 '18 16:08 CSeanXu