我是靠谱客的博主 糟糕花卷,这篇文章主要介绍react native ignoredYellowBox,现在分享给大家,希望可以做个参考。

react-ntaive经常在运行的时候报黄色警告,特别影响开发体验与效率,为了隐藏部分警告,之前在项目根目录的index.js内配置:

​​​​​​​console.ignoredYellowBox = [
'Warning: componentWillMount is deprecated',
'Warning: componentWillReceiveProps is deprecated',
'Warning: componentWillUpdate is deprecated',
'Warning: isMounted(...) is deprecated',
]

但是最近react-native升到0.60,发现上述代码失效了,需要改成:

import { YellowBox } from 'react-native';
YellowBox.ignoreWarnings([
'Warning: componentWillMount is deprecated',
'Warning: componentWillReceiveProps is deprecated',
'Warning: componentWillUpdate is deprecated',
'Warning: isMounted(...) is deprecated',
])

 

最后

以上就是糟糕花卷最近收集整理的关于react native ignoredYellowBox的全部内容,更多相关react内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(116)

评论列表共有 0 条评论

立即
投稿
返回
顶部