You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I integrate web3.js with react-native,and web3.js use xhr2-cookies to initiate a network request. but it counldn't run ,do you have any fixes on it. web3/web3.js#2054 (comment)
and I found in react-native ,use the buildt-in function XMLHttpRequest to replace require('xhr2-cookies').XMLHttpRequest and the code can do well.
and my solution as follow:
node_modules\web3-providers-http\src\index.js
// var XHR2 = require('xhr2-cookies').XMLHttpRequest // jshint ignore: line
I found this in the compiled code, which led to my HTTP request not being sent because there was no location in the global, which led to my code catching directly.
So I came up with a temporary solution, which is to manually inject location or change the compiled code. Of course, the former is more flexible.
I integrate web3.js with react-native,and web3.js use xhr2-cookies to initiate a network request. but it counldn't run ,do you have any fixes on it.
web3/web3.js#2054 (comment)
and I found in react-native ,use the buildt-in function
XMLHttpRequest
to replacerequire('xhr2-cookies').XMLHttpRequest
and the code can do well.and my solution as follow:
node_modules\web3-providers-http\src\index.js
// var XHR2 = require('xhr2-cookies').XMLHttpRequest // jshint ignore: line
The text was updated successfully, but these errors were encountered: