【问题标题】:React Native - How do you hide warning in Android Device Monitor?React Native - 如何在 Android 设备监视器中隐藏警告?
【发布时间】:2018-10-26 03:11:46
【问题描述】:

我对@9​​87654327@ 中的警告感到困惑,即向我显示有关View 的错误需要一些独特的keyYellow Box 没有出现在我的屏幕上,

警告错误让我对调试应用感到困惑,

有没有办法隐藏警告信息?

编辑

我的问题完全关于This

原因:

console.disableYellowBox = true 只是在我的屏幕上隐藏警告,而不是像这样在Android Device Monitor 中:

【问题讨论】:

  • @Revansiddh 我用它来隐藏警告在我的屏幕上而不是在 Android 设备管理器上
  • 你的意思是你不想要console上的那些警告?
  • @Revansiddh 是的,我的标题不够清楚吗?

标签: android debugging react-native console.log


【解决方案1】:

在 index.js 文件中添加以下代码

console.disableYellowBox = true

【讨论】:

    【解决方案2】:

    // 将这些行放入index.js

    import {YellowBox} from 'react-native';
    
    YellowBox.ignoreWarnings(['Warning: ...']);
    
    console.disableYellowBox = true;
    

    【讨论】:

    猜你喜欢
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-22
    • 2020-06-20
    相关资源
    最近更新 更多