且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在React Native上仅禁用setState消息警告

更新时间:2021-12-08 02:03:13

警告
警告将以黄色背景显示在屏幕上。这些警报称为YellowBoxes。单击警报以显示更多信息或将其消除。
与RedBox一样,您可以使用console.warn()触发YellowBox。可以在开发期间通过使用 console.disableYellowBox = true; 禁用
YellowBoxes。可以通过设置应忽略的前缀数组来以编程方式忽略特定的警告: console.ignoredYellowBox = ['Warning:...'];。
在CI / Xcode中,YellowBoxes可以也可以通过设置IS_TESTING环境变量来禁用它。

Warnings Warnings will be displayed on screen with a yellow background. These alerts are known as YellowBoxes. Click on the alerts to show more information or to dismiss them. As with a RedBox, you can use console.warn() to trigger a YellowBox. YellowBoxes can be disabled during development by using console.disableYellowBox = true;. Specific warnings can be ignored programmatically by setting an array of prefixes that should be ignored: console.ignoredYellowBox = ['Warning: ...'];. In CI/Xcode, YellowBoxes can also be disabled by setting the IS_TESTING environment variable.

http://facebook.github.io/react-native/docs/debugging.html#yellowbox-redbox