如何在 React Native 中禁用警告?
How to disable warning in React Native ?
我知道警告很重要。但出于特定原因,我不想让它们出现在屏幕上。如何禁用 screen
上出现的那些黄色警告
请注意,这不会出现在发布版本中...但是如果您想删除警告,您可以设置 console.disableYellowBox = true
文档中的更多信息:
https://facebook.github.io/react-native/docs/debugging.html#warnings
console.disableYellowBox = true;
到 index.js .enjoy
console.disableYellowBox
已被弃用,取而代之的是 LogBox.ignoreAllLogs()
在index.js中设置:
import { LogBox } from "react-native"
LogBox.ignoreAllLogs(true)
或
import { YellowBox } from "react-native"
YellowBox.ignoreWarnings(["Warning: ..."])
写得不错!
我知道警告很重要。但出于特定原因,我不想让它们出现在屏幕上。如何禁用 screen
请注意,这不会出现在发布版本中...但是如果您想删除警告,您可以设置 console.disableYellowBox = true
文档中的更多信息:
https://facebook.github.io/react-native/docs/debugging.html#warnings
console.disableYellowBox = true;
到 index.js .enjoy
console.disableYellowBox
已被弃用,取而代之的是 LogBox.ignoreAllLogs()
在index.js中设置:
import { LogBox } from "react-native"
LogBox.ignoreAllLogs(true)
或
import { YellowBox } from "react-native"
YellowBox.ignoreWarnings(["Warning: ..."])
写得不错!