Ethereum React Native Boilerplate Questions

Where do you have this code? In the boilerplate chainId from the useMoralisDapp hook can be used.

import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
...
const { chainId } = useMoralisDapp();

Did you find a solution to your previous wallet list issue?

I am struggling to the make lazymint code working.

I have to run this code in react-native.
web3.eth.getChainId()
web3.currentProvider.sendAsync
web3.currentProvider.isMetaMask

Provider not set or invalid
This is working in react.js with same moralis, react-moralis packages. but not working in react-native.

Still struggling to the make lazymint code working.

I have to run this code in react-native.
web3.eth.getChainId()

Provider not set or invalid
This is working in react.js with same moralis, react-moralis packages. but not working in react-native.

const web3 = new Web3(Web3.givenProvider);
var web3 = new Web3(); web3.setProvider(new Web3.providers.HttpProvider(“http://localhost:8545”));
var web3 = new Web3(web3.currentProvider);
const web3js = new Web3(Moralis.provider);
const { web3 } = useMoralis();

I a facing the same issue, Is there anyone who can help with this?

I have to run this code in react-native.
web3.eth.getChainId()

Where are you trying this code (which file)?

For the onAccountChangederror, see this.

1 Like

react-native web3 doesn’t support getChainId. This is my custom code - web3.eth.getChainId()

Try the boilerplate’s hook for getting the chainId.

import { useMoralisDapp } from "providers/MoralisDappProvider/MoralisDappProvider";
...
const { chainId } = useMoralisDapp();

Still not working, I have upgraded the moralis and react-moralis packages to the latest version.
But it’s breaking many things. I am getting other issues

~ Can’t find variable: localStorage ~
Even useMoralisQuery is not working properly. Can you help this?

Not working properly, I connected with Polygon Testnet Mumbai, but chainId gives me 0x1 all the time.

web3.currentProvider.isMetaMask is not working as well.

why NFT Assets not appearing in react native application… after connected my metamask test network wallet in my application… its always loading only…

~ Can’t find variable: localStorage ~
Even useMoralisQuery is not working properly. Can you help this?

I would revert back to the default Moralis and react-moralis versions, that would probably introduce many more issues like this one. To reiterate, this boilerplate is in alpha and not production ready so updating packages will likely break things.

Not working properly, I connected with Polygon Testnet Mumbai, but chainId gives me 0x1 all the time.

Possibly 0x1 has been hard set, try changing or removing the chainId in this provider to see if it changes the chainId from useMoralisDapp.

Where did you try using chainId (which file)? I’m not able to get any valid chainId when logged in.

This may be related to the issue the user is having above where the chain ID does not seem to be set properly.

can you please explain it briefly…

have find the any
solution?
@eugene

can you please explain it briefly.

It is discussed in the posts above.

Hey i am having an issue with the react-native boilerplate. On some devices the Login with wallet is working. But on some ex: ios i get the following error:

Non ethereum enabled browser 

and the Qr modal is shown.

Is that an error or a warning? If the app still works then it should be fine - that message would be expected on an iOS device.