我是靠谱客的博主 糟糕花卷,最近开发中收集的这篇文章主要介绍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 native ignoredYellowBox所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部