Expo SDK 36,针对“ componentWillReceiveProps的通用分辨率已重命名,不建议使用”错误

问题描述 投票:4回答:1

当我运行expo start时,收到的警告是:

Warning: componentWillReceiveProps has been renamed, and is not recommended for use. 
...

* 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: SafeView, Transitioner
- node_modules/expo/build/environment/muteWarnings.fx.js:18:23 in warn
...

我知道这是一个警告,在生产模式下不会看到,但为了不丢失其他可能的警告,我想摆脱此警告。

我未使用componentWillReceiveProps,但正在使用expo的依赖项。

  • 建议的npx react-codemod rename-unsafe-lifecycles仅检查我编写的代码,而不检查来自node_modules的代码。
  • 并且建议Please update the following components: SafeView, Transitioner不适用,因为它们不是来自我包括的组件,而是来自expo及其依赖项,其中主要的是react-native本身。

作为解决方案,有什么方法可以通用的方式消除此警告?另外,有没有一种方法可以只删除SafeViewTransitioner组件(即react-native-safe-area-viewreact-navigation react-navigation-stack包)?

react-native react-navigation expo componentwillreceiveprops react-native-safe-area-view
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.