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',
])