issue-tracker icon indicating copy to clipboard operation
issue-tracker copied to clipboard

Moralis React Native

Open rphansen91 opened this issue 4 years ago • 7 comments

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

rphansen91 avatar Apr 08 '21 18:04 rphansen91

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 module fs from file ...node_modules/@elrondnetwork/erdjs/out/smartcontracts/code.js

So im still stuck too...

tomclassius avatar Apr 22 '21 12:04 tomclassius

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

dannyhchan avatar Oct 21 '21 04:10 dannyhchan

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

ivan-liljeqvist avatar Oct 21 '21 07:10 ivan-liljeqvist

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

dannyhchan avatar Oct 27 '21 22:10 dannyhchan

@dannyhchan https://youtu.be/FRilwynjW1c

ivan-liljeqvist avatar Oct 27 '21 22:10 ivan-liljeqvist

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

dannyhchan avatar Oct 27 '21 23:10 dannyhchan

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

ivan-liljeqvist avatar Oct 28 '21 07:10 ivan-liljeqvist