hoyong

导航

React Native Warning处理

While using the life-cycle methods in react-native, I have encountered the following warning messages in the console as well as in the emulator:

Warning: componentWillReceiveProps is deprecated and will be removed in the next major version. Use static getDerivedStateFromProps instead.

Warning: componentWillMount is deprecated and will be removed in the next major version. Use componentDidMount instead. As a temporary workaround, you can rename to UNSAFE_componentWillMount.

 

 

I think it does not affect your application, it's just annoying.

Hide it by add below into index.js:

import { YellowBox } from 'react-native';

YellowBox.ignoreWarnings([
  'Warning: componentWillMount is deprecated',
  'Warning: componentWillReceiveProps is deprecated',
  'Module RCTImageLoader requires',
]);

posted on 2019-08-07 14:41  hoyong  阅读(358)  评论(0)    收藏  举报