当我运行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
项。
作为解决方案,是否有任何方法可以以通用方式消除此警告?否则,是否有一种方法可以摆脱仅SafeView
和Transitioner
组件(即 react-native-safe-area-view react-navigation react-navigation-stack 包)?