4

当我运行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-view react-navigation react-navigation-stack 包)?

4

1 回答 1

0

似乎(截至 2020 年 3 月 2 日)在 SDK 38 中得到解决。

请参考:

  1. https://github.com/expo/expo/issues/5763
  2. https://github.com/expo/expo/pull/7227
  3. https://github.com/orgs/expo/projects/6
于 2020-03-02T16:37:16.860 回答