react-native - 终端上的 React Native 黄色警告

标签 react-native warnings

每次我运行我的 React 项目时,我的终端上都会收到数百条黄色警告。不可能看到任何 console.log()

我知道,我正在修复它们,但现在是通话时间,我需要在处理其他事情时看到一个干净的终端。

我的模拟设备上没有黄木,因为我使用 console.disableYellowBox = true;

禁用了它

我试过了

YellowBox.ignoreWarnings(['Warning: ReactNative.createElement'])
console.ignoredYellowBox = ['Warning: ReactNative.createElement'];

``` in my index.js without success


I am using 
react": "16.9.0",
   "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.0.tar.gz",

最佳答案

您是否尝试过通过 Google chrome 调试您的应用?

您可以通过摇动您的设备打开开发菜单,或者如果您使用的是模拟器,请在 iOS 上按 cmd+dctrl+cmd+z并在 Android 上双击 m,然后选择 Debug JS 选项。

这将在您的浏览器中打开一个指向 http://localhost:8081/debugger-ui/的选项卡

这基本上是将所有 JS 文件重定向到直接在您的浏览器引擎中运行,这样您就可以使用单词 debugger 在您的代码中添加断点,它们将显示在您的浏览器中就像他们在为网络开发时一样。

您还可以使用浏览器的控制台选项卡来可视化 console.* 仅使用终端时可能难以检查的消息和对象

不过有一点要注意,您不应该总是依赖远程调试,因为在调试过程中会使用 chrome JS 引擎,它与其他情况下使用的 JavaScriptCore 略有不同。这些差异主要与 Date() 对象有关,但您可以阅读有关该对象的更多信息 here

关于react-native - 终端上的 React Native 黄色警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65432819/

相关文章:

react-native - 缺少用于在 Windows React Native 上生成 APK 文件的 gradle.properties 文件

perl - 关于相等运算符的警告

php - Python 像 PHP 一样设置错误报告级别

Java:空比较总是产生错误:不正确的警告?

javascript - React Native 0.56 : bundle doesn't produce . 元文件 - 还需要吗?

react-native - react 原生 map : Custom Markers cause extreme lag and slow down on android

reactjs - ListView 删除数据源更新时的错误行

ios - 如何识别 iOS 应用程序是否连接到特定的 WiFi 网络?

xcode - 警告 : Scene is unreachable due to lack of entry point and does not have an identifier for runtime access. swift

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP