How to use moralis SDK correctly in React Nativeļ¼Ÿ

Hi, i want to log in with Moralis in React Native, but the following code has an error

import { useMoralis } from "react-moralis";

error message:

error: Error: Unable to resolve module crypto from /Users/macbookpro/reactnative/node_modules/swarm-js/node_modules/eth-lib/lib/bytes.js: crypto could not be found within the project or in these directories:

I have done according to the forum, but the error is still there
Do you have any good suggestionsļ¼Ÿ

React Native support is here!

Follow this

Hello Everyone,
I am facing issue while connecting with react native app without expo. Error Like this
the localStorage does not exits

Property localStorage does not exits

Taken reference from this demo repo:
So, Please provide me the solution I am stuck here from last 3 days.

Malik is US time, will ask him to check this

1 Like


Which platform are you using to run the app, ios? or Android? And where are you getting this error? My best guess is that there is a linking problem with react native and pods but would keep my judgement after more details.


for now I am using Android. and while using the react-moralis authenicate method.
like the below

 const {
  } = useMoralis()
{!isAuthenticated && (
                  onPress={() => authenticate({ provider:'walletconnect', chainId:42, signingMessage: "Welcome!" })}
                  title="Authenticate With Crypto Wallet"></Button>

You would need to use the connector from the walletConnect hook that we built in. Your implementation is perfect for the web but has issues with react native.

Also, side note - there is more polishing to be done for the android implementation. We are working on it as we speak. Please try the ios version as that works perfectly as of now.

Let me know if you need more input.


Same error I am getting while using the above code snippet.
if you have alternate then you can share with me @malik.
Bcoz I have to deliver first android part after that i can start working on the ios one.