查看React Native Expo中的网络选项卡。

huangapple go评论117阅读模式
英文:

See Network Tab In React Native Expo

问题

我刚刚在Expo中开始了一个新的应用程序,因为我的RN CLI应用程序在Xcode更新后被清除了(对发生了什么事情还心有余悸/困惑)。

在CLI中,我可以毫无问题地使用[React Native Debugger][1]工具。但在Expo中,我无法使其正常工作。

我遵循了[问题][2]中的说明

```json
// 添加到app.json

"jsEngine": "hermes",
"ios": {
   "jsEngine": "jsc",
   "supportsTablet": true
}

这没有起作用。我尝试去掉ios对象,使我的jsEnginehermes,但这也没有起作用。

步骤:

  1. 使用 npx expo start --localhost 启动一个新的Expo项目
  2. app.json 中设置 "jsEngine": "hermes"
  3. 等待应用程序启动
  4. 运行 open "rndebugger://set-debugger-loc?host=localhost&port=19000"

我可以打开调试器UI,但它无法连接到我的应用程序。

我的应用程序正在运行Expo 48.x.x。我唯一的选择是降级到Expo <47 吗?不能看到我的网络请求是无法忍受的,也很惊讶RN中这还不是一个开箱即用的功能。


<details>
<summary>英文:</summary>

I just started a new app in Expo after my RN CLI app was wiped out from a Xcode update (still scarred/confused on what exactly happened).

In CLI I was able to use the [React Native Debugger][1] tool without issue. On Expo, I have not been able to get it working.

I followed the directions in [issue][2]

// Add to app.json

"jsEngine": "hermes",
"ios": {
"jsEngine": "jsc",
"supportsTablet": true
}


This did not work. I tried getting rid of the `ios` object so that my `jsEngine` is `hermes` but this also didn&#39;t work.

Steps:
1. Start a new Expo project using `npx expo start --localhost`
2. Set `&quot;jsEngine&quot;: &quot;hermes&quot;` in `app.json`
3. Wait for app to turn on
4. Run `open &quot;rndebugger://set-debugger-loc?host=localhost&amp;port=19000&quot;`

I get the debugger UI open, but it does not connect to my app.

My app is running Expo 48.x.x. Is my only option to downgrade to Expo &lt;47? Not being able to see my network requests is unbearable and very surprised that this is not an out of the box feature in RN yet.


  [1]: https://github.com/jhen0409/react-native-debugger
  [2]: https://github.com/jhen0409/react-native-debugger/issues/754#issuecomment-1469852938

</details>


# 答案1
**得分**: 1

Expo SDK 49现在内置了网络调试功能,但不幸的是,目前在Android上无法正确工作。更多信息如下。

要在修复后收到通知,请订阅[此问题](https://github.com/facebook/react-native/issues/38006#issuecomment-1612231371)

> 重要提示:由于React Native 0.72中Hermes调试器在Android上存在回归(请参考GitHub了解背景情况),如果这是您工作流程的重要部分,我们建议等待升级到SDK 49。此外,为确保新项目默认具有正常的调试体验,create-expo-app创建的默认项目将继续设置为SDK 48,直到此问题得到解决。
>
> 要使用SDK 49创建新项目:`npx create-expo-app@latest --template blank@sdk-49` 将“blank”替换为“tabs”以使用expo-router模板。

通过[Expo SDK 49](https://blog.expo.dev/expo-sdk-49-c6d398cdf740)获取。

<details>
<summary>英文:</summary>

Expo SDK 49 now has built-in Network debugging, but unfortunately it does not work correctly on Android at this time. More info below.

To get notified when it&#39;s fixed, subscribe to [this issue](https://github.com/facebook/react-native/issues/38006#issuecomment-1612231371)

&gt; Important: Due to a regression in the Hermes debugger for Android in React Native 0.72 (see GitHub for context), we recommend waiting before upgrading to SDK 49 if this is an important part of your workflow. Additionally, in order to ensure that new projects default to a working debugging experience, the default project created by create-expo-app will continue to be set to SDK 48 until this issue is resolved.
&gt;
&gt; To create a new project with SDK 49: `npx create-expo-app@latest --template blank@sdk-49` Replace “blank” with “tabs” for the expo-router template.

via [Expo SDK 49](https://blog.expo.dev/expo-sdk-49-c6d398cdf740)

</details>



huangapple
  • 本文由 发表于 2023年4月11日 11:25:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/75982186.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定