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内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复