Game-X-Coin / eosjs-rn

General purpose library for the EOS blockchain.
http://eosio.github.io/eosjs
MIT License
18 stars 5 forks source link

Uint8Array is not supported in React Native #11

Closed jadertao closed 5 years ago

jadertao commented 5 years ago

Version of EOSJS beta3

Describe the bug src/eosjs-numeric.ts Uint8Array is not supported in React Native

To Reproduce just use.

Uint8Array should be polyfilled.

jadertao commented 5 years ago

i am confusing now whether react native supports Uint8Array...😢 at least the latest version does not support

jadertao commented 5 years ago

core-js helps me out. just import 'core-js' in the 1st line of index.js.

jadertao commented 5 years ago

if maintainers have nothing to say, just close it.

indiev commented 5 years ago

When I tried it, Uint8Array was running without any problems.

jadertao commented 5 years ago

When I tried it, Uint8Array was running without any problems.

int the latest version?

indiev commented 5 years ago

When I tried it, Uint8Array was running without any problems.

int the latest version?

Yes. i used beta3 version. It worked well in beta2, but does beta3 have an error? How did you use JsSignatureProvider? A : import JsSignatureProvider from 'eosjs-rn/dist/eosjs-jssig'; or B : import { JsSignatureProvider } from 'eosjs-rn'

jadertao commented 5 years ago

both, failed.

and sry I mean the latest react-native.

indiev commented 5 years ago

both, failed.

and sry I mean the latest react-native.

I tried it in react-native 0.57 version, but it worked. Can I see the code that failed the error?

jadertao commented 5 years ago

https://github.com/Game-X-Coin/eosjs-rn/issues/10#issuecomment-450474065

here. thanks for patience.

indiev commented 5 years ago

I have seen it run successfully. Please follow the procedure below.

  1. remove eosjs module. 'npm uninstall eosjs' or 'yarn remove eosjs'
  2. install eosjs-rn module. 'npm install' eosjs-rn' or 'yarn add eosjs-rn'
  3. change module eosjs -> eosjs-rn to App.js
  4. run app.

If you have followed the steps above, but you can not do it, do the following:

  1. remove node_modules folder and remove *.lock file
  2. install module. yarn or npm install
jadertao commented 5 years ago

I have seen it run successfully. Please follow the procedure below.

  1. remove eosjs module. 'npm uninstall eosjs' or 'yarn remove eosjs'
  2. install eosjs-rn module. 'npm install' eosjs-rn' or 'yarn add eosjs-rn'
  3. change module eosjs -> eosjs-rn to App.js
  4. run app.

If you have followed the steps above, but you can not do it, do the following:

  1. remove node_modules folder and remove *.lock file
  2. install module. yarn or npm install

sry not described this issue properly.

i did the same steps. and and the mistake can only be reproduced in Android (without remote debugger)

indiev commented 5 years ago

I have seen it run successfully. Please follow the procedure below.

  1. remove eosjs module. 'npm uninstall eosjs' or 'yarn remove eosjs'
  2. install eosjs-rn module. 'npm install' eosjs-rn' or 'yarn add eosjs-rn'
  3. change module eosjs -> eosjs-rn to App.js
  4. run app.

If you have followed the steps above, but you can not do it, do the following:

  1. remove node_modules folder and remove *.lock file
  2. install module. yarn or npm install

sry not described this issue properly.

i did the same steps. and and the mistake can only be reproduced in Android (without remote debugger)

indiev commented 5 years ago

I also saw problems in android This issue appears to be caused by remote debugger of android (https://github.com/facebook/react-native/issues/16538#issuecomment-339536318)

If you put 'babel-polyfill', it may be solved.

However, in order to provide proper compatibility later on, Uint8Array must be replaced by another in the project.

jadertao commented 5 years ago

yes. and core-js can also help. just import 'core-js' in the 1st line of index.js.

ajitsen commented 5 years ago

you could also just do, to avoid global namespace pollution

import Int8Array from 'core-js/fn/typed/int8-array';