我启动了一个新的React Native项目,并不断收到以下警告:

远程调试器位于后台选项卡中,这可能会导致应用程序执行缓慢.通过突出选项卡(或在单独的窗口中打开)来修复此问题.

这有点烦人,所以我想知道如何摆脱它?我在Chrome上运行调试器,我把它移到了一个单独的窗口,但没有任何帮助.

推荐答案

如果调试器窗口中有Maintain Priority复选框,请在跳转到以下任何解决方案之前try 启用它.

要消除整个项目中的警告,请将以下内容添加到outermost Javascript文件中(大多数情况下,React Native为index.js)

for react-native v0.63+:

使用LogBox:

LogBox.ignoreLogs(['Remote debugger']);

for react-native v0.57 - v0.62:

import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings(['Remote debugger']);

参考官方文件:

https://facebook.github.io/react-native/docs/debugging.html

react-native v0.56 or below:

在代码的早期添加以下内容:

console.ignoredYellowBox = ['Remote debugger'];

简单,简单,针对那个错误.对我有用.可以替换任何你想要的文本.

React-native相关问答推荐

收到错误Constants.platform.ios.model已被弃用,以支持 expo-device

导出命名空间应首先由 `@babel/plugin-proposal-export-namespace-from` 转换

TypeError:未定义不是对象(判断'theme.spacing [radius]')

React Navigation v5 中的初始路由参数?

React Native - remount / reset / reload屏幕的最佳方式是什么?

react-native (expo)加载markdown 文件

create-react-native-app myproject和react-native init myproject之间的真正区别是什么

运行react应用程序时出错

react Navigation 在标题中使用图像?

React-native 解码 base64 编码字符串

Yarn 在哪里存储离线包?

在本react-native中具有异步和等待的箭头函数

在 React Native 视图上强制 onLayout

为什么,确切地说,我们需要 React.forwardRef?

更新 this.state.dataSource 不会更新 ListView

Ipad 上的 React Native - 错误 - could not connect to development server

使用来自另一个页面的 fetch 调用函数返回结果值

> 任务 :app:checkDebugAarMetadata 在运行 react-native run-android 时失败

react-native图像预取

如何在 React Native 中创建拖放操作?