【发布时间】:2018-05-11 13:38:42
【问题描述】:
我知道警告很重要。但出于特定原因,我不希望它们出现在屏幕上。如何禁用出现在screen上的黄色警告
【问题讨论】:
-
哪些警告?
-
不推荐使用
invalid props type或netInfo等警告
标签: react-native warnings
我知道警告很重要。但出于特定原因,我不希望它们出现在屏幕上。如何禁用出现在screen上的黄色警告
【问题讨论】:
invalid props type 或 netInfo 等警告
标签: react-native warnings
console.disableYellowBox 已被弃用,取而代之的是 LogBox.ignoreAllLogs()
在 index.js 中刚刚设置:
import { LogBox } from "react-native"
LogBox.ignoreAllLogs(true)
或
import { YellowBox } from "react-native"
YellowBox.ignoreWarnings(["Warning: ..."])
编码不错!
【讨论】:
建议注意这不会显示在发布版本中...但如果您想删除警告,您可以设置console.disableYellowBox = true
文档中的更多信息:
https://facebook.github.io/react-native/docs/debugging.html#warnings
【讨论】:
console.disableYellowBox = true; 转 index.js .enjoy
【讨论】: