我在windows10和Ubuntu 16.04上试用过。在这两种情况下,热重新加载只适用于jsx中的更改,但不适用于我在javascript中更改变量或函数或其他内容时的更改。热重新加载已启用。已禁用实时重新加载。当我在Visual Studio代码编辑器中保存更改时,虚拟设备(android studio)会重新加载,但更改不在那里。在世博会应用中的物理设备上也是如此。
首先,我没有安装watchman。热Relaod不工作。安装后,热重新加载也不能工作。
我使用create-react-native-app启动应用程序。它不会被弹出。
package.json:
{
"name": "NativeReduxSaga",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "25.0.0",
"react-native-debugger-open": "^0.3.17",
"react-native-scripts": "1.11.1",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js",
"postinstall": "rndebugger-open --expo"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@redux-offline/redux-offline": "^2.3.2",
"expo": "^25.0.0",
"prop-types": "^15.6.1",
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-autocomplete-input": "^3.5.0",
"react-navigation": "^1.5.2",
"react-redux": "^5.0.7",
"redux": "^3.7.2",
"redux-devtools-extension": "^2.13.2",
"redux-logger": "^3.0.6",
"redux-observable": "^0.18.0",
"redux-promise-middleware": "^5.0.0",
"redux-saga": "^0.16.0",
"redux-thunk": "^2.2.0",
"rxjs": "^5.5.7"
}
}守望者版本
{
"version": "4.9.1",
"buildinfo": "94e66865386e844f2cffe52e355a94c96562d2e3 2018-03-12T19:58:02.0000000Z"
}节点版本v6.13.1
我在这里的一些文章中读到,它可以在Windows上帮助提高MAX_WAIT_TIME。但是我没有\node_modules\react-native\node_modules\node-haste\lib\FileWatcher\ index.js文件。
为什么它不能在Ubuntu上运行呢?
我真的需要看守人吗?它应该如何配置?我的.watchmanconfig文件是一个空对象,如{}。
热重新加载通常与create-react-native-app一起工作吗?
有人知道我可以在这里尝试什么,让热重新加载工作吗?谢谢你的帮助!
发布于 2018-03-29 17:33:43
实际上,热重载和实时重载是有区别的。
热重载是即时重载,同时保持您的应用程序的状态不变。但是,它只在render方法内部工作,并且只在类React.Component和Component的扩展上触发
如下所示:
class A extends Component ...
class B extends React.Component ...另一方面,实时重新加载会重新构建应用程序并丢弃应用程序状态。它包含了所有内容,从变量和方法到最简单的字符串。这就是为什么总是从应用程序的开始屏幕开始(因为状态是丢失的)的原因。
希望它能帮上忙!
发布于 2019-05-02 16:04:05
删除git index.lock文件对我来说很有效
rm -rf .git/index.lock
发布于 2019-08-21 15:19:33
在安卓系统中,进入@Override public boolean getUseDeveloperSupport() { return true; }的MainApplication.Java搜索
确保它返回true。这可能是问题所在
https://stackoverflow.com/questions/49487768
复制相似问题