如何在React Native iOS模拟器中隐藏警告? [英] How do you hide the warnings in React Native iOS simulator?

查看:85
本文介绍了如何在React Native iOS模拟器中隐藏警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚升级了我的React Native,现在iOS模拟器有很多警告.除了修复它们之外,我如何隐藏这些警告,以便可以看到下面的内容?

I just upgraded my React Native and now the iOS simulator has a bunch of warnings. Besides fixing them, how do I hide these warnings so that I can see what's underneath?

推荐答案

根据React Native 文档,您可以通过将 disableYellowBox 设置为 true 来隐藏警告消息,如下所示:

According to React Native Documentation, you can hide warning messages by setting disableYellowBox to true like this:

console.disableYellowBox = true;

更新:React Native 0.63 +

console.disableYellowBox 已删除,现在您可以使用:

Update: React Native 0.63+

console.disableYellowBox is removed and now you can use:

import { LogBox } from 'react-native';
LogBox.ignoreLogs(['Warning: ...']); // Ignore log notification by message
LogBox.ignoreAllLogs();//Ignore all log notifications

忽略所有日志通知

这篇关于如何在React Native iOS模拟器中隐藏警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆