记录一些在学习 RN 中遇到的问题
issue 1:undefined is not a function ( reactDevTools.connectToDevTools )
- 相关配置
{
"name": "MyApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.6.1",
"react-native": "0.57.7"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.50.0",
"react-devtools-core": "^3.4.2",
"react-test-renderer": "16.6.1"
},
"jest": {
"preset": "react-native"
}
}
复制代码
- 问题描述:
在工作目录下执行npm install
后,run-ios
启动模拟器报错,但是使用 yarn install
安装后运行正常。
- 解决方法:
在RN的issue 22863中找到了不过是使用的 react-devtools-core@3.4.2
版本
npm install --save-dev react-devtools-core@3.4.2
复制代码