您当前的位置: 首页 >  ar

ITKEY_

暂无认证

  • 0浏览

    0关注

    732博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

React Native0.63.2选择性忽略一些Warning

ITKEY_ 发布时间:2020-09-17 16:44:18 ,浏览量:0

有没有人像我一样,看到Warning特别难受,跟吃了苍蝇一样,如果是自己写的代码中有Warning我肯定想尽办法处理掉。但是有的时候是自己引用的一些组件中的Warning天天看到就难受了。解决办法跟大家分享一下。

 版本

"react": "16.13.1",
"react-native": "0.63.2",

比如说,我的警告信息如下:

[Thu Sep 17 2020 16:40:46.170]  WARN     Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate. * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: %s Popover  

import {LogBox} from 'react-native';
LogBox.ignoreLogs(['Warning: componentWillReceiveProps has been renamed']);

这下整个世界都清净了,好舒服。眼不见为净。

关注
打赏
1665243900
查看更多评论
立即登录/注册

微信扫码登录

0.0363s