EOSIO / eosjs

General purpose library for the EOSIO blockchain.
http://eosio.github.io/eosjs
MIT License
1.43k stars 463 forks source link

EOSJS - ReactNative -- undefined is not an object (evaluating 'self.fetch') #353

Closed amolmaid closed 6 years ago

amolmaid commented 6 years ago

Hi, I have been following instructions from link https://github.com/EvaCoop/eosjs-react-native , to setup eosjs on already-build react-native app. I have installed related dependencies as well like react-native-browser-polyfill and react-native-hockeyapp

My build completes successfully and runs fine But I am facing following error when I open my app in mobile. undefined is not an object (evaluating 'self.fetch')

Kindly guide for the same.

jcalfee commented 6 years ago

eosjs-api uses npm package isomorphic-fetch 2.2.1https://github.com/matthew-andrews/isomorphic-fetch

I don't see any RN issues .. When you create eosjs it tries to check the chainId and warn if it does not match. That is the first time it tries to fetch.

amolmaid commented 6 years ago

Currently I don't have any dependency for isomorphic-fetch in my package.json, so do I need to import it explicitly? uptil now I didn't write any code yet which uses eosjs, I just installed and imported eosjs and this error flagged.

jcalfee commented 6 years ago

You may need a RN version .. I don't know. Make sure you have a question opened in the EvaCoop/eosjs-react-native repository.

amolmaid commented 6 years ago

Sure I'll thanks, for direction. :)