MoralisWeb3 / issue-tracker

25 stars 7 forks source link

Moralis React Native #36

Open rphansen91 opened 3 years ago

rphansen91 commented 3 years ago

I tried to install moralis for react native as described here https://www.npmjs.com/package/moralis But then I get the error message "Unable to resolve module crypto from D:\Programming\ReactNative\theCollector\node_modules\web3-eth-accounts\lib\index.js:"

Need to import https://www.npmjs.com/package/web3-react-native if react native

tomclassius commented 3 years ago

Hi, i had the same behavior. The workaround for this is install crypto-browserify and add a kind of rewrite rule in your babel config. npm i crypto-browserify and my babel.config.js is `module.exports = function (api) { api.cache(true); const presets = [ 'babel-preset-expo', ];

const plugins = [ ['module-resolver', moduleResolverConfig], ["babel-plugin-rewrite-require", { "aliases": { "crypto": "crypto-browserify" } }] ];

return { presets, plugins }; };` But you will face another issue i didn't find any solution yet: one of the dependencies of moralis requires the nodejs fs lib which of course doesn't work with React native....

InternalError Metro has encountered an error: While trying to resolve modulefsfrom file ...node_modules/@elrondnetwork/erdjs/out/smartcontracts/code.js

So im still stuck too...

dannyhchan commented 3 years ago

@rphansen91 were you able to find a solution? I'm having the same issue and I'm using Expo React Native.

ivan-liljeqvist commented 3 years ago

React Native official support coming soon we will share boilerplate and tutorials hopefully next week

dannyhchan commented 3 years ago

@ivan-liljeqvist Any news with the boilerplate and tutorials?

ivan-liljeqvist commented 3 years ago

@dannyhchan https://youtu.be/FRilwynjW1c

dannyhchan commented 3 years ago

@ivan-liljeqvist the repo doesn't have the .env.example file. What are the list of environment variables are needed?

ivan-liljeqvist commented 3 years ago

https://forum.Moralis.io for all questions and discussions please