如何在 react-native 项目中启动 watchman
How start watchman in react-native project
我已经在我的 android 模拟器中使用 react-native init myProject
和 运行ning 创建了我的第一个 react-native 应用程序。
但是,如果我编辑 index.js,我的应用程序不会刷新(我需要按双 R)。
我 运行 我的应用 react-native run-android
和服务器 npm start
.
watchman 安装在我的 Ubuntu, watchman -v
return :
4.9.0
谁能帮帮我?
感谢社区!
您需要启用'Live Reload'。
在物理设备上:
摇晃设备,然后从菜单中选择'Enable Live Reload'。
在模拟器上:
当 Android 模拟器打开时:
cmd (ctrl on Windows) + m
ios模拟器:
cmd + d
然后从菜单中选择 'Enable Live Reload'。
万一其他人无法解决 watchman 是否 运行 正确与否的问题,在我的情况下,问题是我的 .git
目录。虽然根据文档 .git/
是默认忽略的,但每当我保存文件时,Watchman 显然会挂起,随后实时重新加载不起作用。将此添加到我的 .watchmanconfig
修复了它:
{
"ignore_dirs": [".git"]
}
我已经在我的 android 模拟器中使用 react-native init myProject
和 运行ning 创建了我的第一个 react-native 应用程序。
但是,如果我编辑 index.js,我的应用程序不会刷新(我需要按双 R)。
我 运行 我的应用 react-native run-android
和服务器 npm start
.
watchman 安装在我的 Ubuntu, watchman -v
return :
4.9.0
谁能帮帮我?
感谢社区!
您需要启用'Live Reload'。
在物理设备上:
摇晃设备,然后从菜单中选择'Enable Live Reload'。
在模拟器上:
当 Android 模拟器打开时:
cmd (ctrl on Windows) + m
ios模拟器:
cmd + d
然后从菜单中选择 'Enable Live Reload'。
万一其他人无法解决 watchman 是否 运行 正确与否的问题,在我的情况下,问题是我的 .git
目录。虽然根据文档 .git/
是默认忽略的,但每当我保存文件时,Watchman 显然会挂起,随后实时重新加载不起作用。将此添加到我的 .watchmanconfig
修复了它:
{
"ignore_dirs": [".git"]
}