android 如何导入eth-lightwallet包到react-native项目?

lokaqttq  于 2023-04-10  发布在  Android
关注(0)|答案(1)|浏览(93)

首先,我创建了一个项目:react-native init project,当我在react-native项目中尝试import * as lightwallet from 'eth-lightwallet'时,我得到错误see this image
找到了解决方案at github,但这并没有为我解决问题。
我的包。json:

{
  "name": "androidWallet",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "asn1": "^0.2.3",
    "buffer": "^5.2.0",
    "eth-lightwallet": "^3.0.1",
    "history": "^4.7.2",
    "native-base": "^2.7.2",
    "node-libs-browser": "^2.1.0",
    "node-libs-react-native": "^1.0.2",
    "react": "16.4.1",
    "react-native": "0.55.2",
    "react-native-table-component": "^1.1.8",
    "react-navigation": "^2.9.3",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.3.1",
    "react-router-redux": "^4.0.8",
    "redux": "^4.0.0",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "web3": "^0.20.6"
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-jest": "23.4.2",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react-native": "4",
    "jest": "23.4.2",
    "react-test-renderer": "16.4.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
lyr7nygr

lyr7nygr1#

问题是eth-lightwallet依赖于React Native开箱即用不支持的节点核心模块。当前的解决方案涉及使用rn-nodeify,以便为React Native提供垫片。请参阅this issue for react nativethis open issue from eth-lightwallet

相关问题