[英]Debugging react native Apps
I run into serious trouble debugging a react native
app. 我在调试
react native
应用程序时遇到了麻烦。
xCode
as well as expo
. xCode
以及expo
。 iOS Simulator
in xCode
xCode
启动iOS Simulator
expo
(the one with the navbar) expo
(带有导航栏的一个)创建一个新的App / Project。 iOS Simulator
which then opens the App. iOS Simulator
,然后打开该应用程序。 When I click Debug JS Remotely
GoogleChrome opens and with the dev Tools
I can work just as I am used to. 当我单击“
Debug JS Remotely
将打开GoogleChrome,并使用dev Tools
可以像以前一样工作。 However, when I add an error into the code, ie deleting a {
, and then save the file, the App reloads (Hot Reloading) and I get an error (in the Simulator). 但是,当我在代码中添加错误(即删除
{
,然后保存文件)时,应用程序将重新加载(热重新加载),并且在模拟器中出现错误。 The error does not appear in the console of my GoogleChrome Browser. 该错误没有出现在我的GoogleChrome浏览器的控制台中。
Even worse, when I remove the error (here: adding the {
where it belongs), and save the file, the App does not reload. 更糟糕的是,当我删除错误(此处:添加
{
所在的位置)并保存文件时,该应用程序不会重新加载。 I get errors like __fbBatchedBridge
which are totally unrelated to the {
-error. 我收到像
__fbBatchedBridge
这样的错误,它们与{
__fbBatchedBridge
完全无关。 In order to get rid of these error I have to create a new Project with expo
(which contains the code without the {
-error) and send this to the iOS Simulator
. 为了摆脱这些错误,我必须使用
expo
创建一个新项目(其中包含不带{
-error的代码),并将其发送到iOS Simulator
。 Only then, the error (ie _fbBatchedBridge
) goes away. 只有这样,错误(即
_fbBatchedBridge
) _fbBatchedBridge
消失。
I don't know exactly what kind of issue you are facing right now related to google chrome. 我不知道您目前面对的是与Google Chrome相关的问题。 But as you said the error
_fbBatchedBrdige
you don't need to create project again and again. 但是正如您所说的
_fbBatchedBrdige
错误,您不需要一次又一次地创建项目。 You have to comment the code in packager.sh
file. 您必须注释
packager.sh
文件中的代码。
Check below path in your project 检查项目中的以下路径
node_modules/react-native/packager/packager.sh
node_modules /反应天然/打包器/ packager.sh
Check for below code in packager.sh 检查packager.sh中的以下代码
if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
echo "Skipping bundling for Simulator platform"
exit 0;
fi
replace it with: 替换为:
# if [[ "$PLATFORM_NAME" = "iphonesimulator" ]]; then
# echo "Skipping bundling for Simulator platform"
# exit 0;
# fi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.