简体   繁体   English

Expo SDK 36,“componentWillReceiveProps 已重命名,不推荐使用”错误的通用解决方案

[英]Expo SDK 36, a generic resolution for "componentWillReceiveProps has been renamed, and is not recommended for use" errors

When I run expo start the warning I receive is:当我运行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
...

I know this is a warning and is not seen in production mode, but in order not to miss other possible warnings I want to get rid of this.我知道这是一个警告,在生产模式下看不到,但为了不错过其他可能的警告,我想摆脱这个。

I am not using componentWillReceiveProps but the dependencies expo has are using.我没有使用componentWillReceiveProps但依赖expo正在使用。

  • The suggested npx react-codemod rename-unsafe-lifecycles checks only the codes that I wrote, not the ones coming from node_modules .建议npx react-codemod rename-unsafe-lifecycles只检查我写的代码,而不是来自node_modules
  • And the suggestion Please update the following components: SafeView, Transitioner is not applicable because they are not from the components that I included but from expo and its dependencies where the major one is the react-native itself.并且建议Please update the following components: SafeView, Transitioner不适用,因为它们不是来自我包含的组件,而是来自expo及其依赖项,其中主要是react-native本身。

As a solution is there any method to get rid of this warning in a generic way?作为解决方案,是否有任何方法可以以通用方式摆脱此警告? Else, is there a method to get rid for only SafeView and Transitioner components (ie react-native-safe-area-view react-navigation react-navigation-stack packages) ?否则,是否有一种方法可以摆脱SafeViewTransitioner组件(即 react-native-safe-area-view react-navigation react-navigation-stack 包)?

Seems being (as of March 2nd, 2020) addressed within SDK 38.似乎(截至 2020 年 3 月 2 日)已在 SDK 38 中解决。

Pls refer to:请参考:

  1. https://github.com/expo/expo/issues/5763 https://github.com/expo/expo/issues/5763
  2. https://github.com/expo/expo/pull/7227 https://github.com/expo/expo/pull/7227
  3. https://github.com/orgs/expo/projects/6 https://github.com/orgs/expo/projects/6

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:componentWillReceiveProps 已重命名,不推荐使用 - Warning: componentWillReceiveProps has been renamed, and is not recommended for use 升级到 Expo SDK36 (RN 0.61) 后开始出现警告:componentWillMount 已重命名,不推荐用于天才聊天 - After upgrading to Expo SDK36 (RN 0.61) started getting Warning: componentWillMount has been renamed, and is not recommended for use for gifted-chat React Native:警告:componentWillReceiveProps 已重命名,不推荐使用。 SwipeOut 组件问题 - React Native: Warning: componentWillReceiveProps has been renamed, and is not recommended for use. SwipeOut component issue 将博览会项目移动到本机反应后,收到警告“componentWillReceiveProps 已被重命名” - get warning "componentWillReceiveProps has been renamed" after moving expo project to react native 警告:componentWillReceiveProps 已重命名,请更新以下组件:Motion - Warning: componentWillReceiveProps has been renamed and Please update the following components: Motion React Native Expo SDK 升级到 36 - React Native Expo SDK upgrade to 36 如何减小 expo sdk 36 版中的应用程序大小? - How to reduce app size in expo sdk version 36? expo sdk 22 和 36 的最小 android 和 ios 版本是什么? - which minimal android and ios versions for expo sdk 22 and 36? 获取 Expo SDK36 RN 0.61.4 返回未定义 - Fetch in Expo SDK36 RN 0.61.4 returns as undefined 更新到 SDK 36 后 Expo 应用程序在启动时崩溃 - Expo app crashing on start up after updating to SDK 36
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM