在 React-Native 中使用 PropTypes.string

Using PropTypes.string in React-Native

我正在尝试在我的应用程序中使用 react-native-gifted-chat,但是当我构建该应用程序时出现以下错误。

当我在 Chat.js 中查看第 46 行时,它看起来像这样。

45 Chat.propTypes = {
46   name: React.PropTypes.string,
47 };

知道这有什么问题吗?

提前致谢。

根据 React 的最新文档,您需要使用 PropTypes in the following way as mentioned here,因为此包已与 React 模块分离

import PropTypes from 'prop-types'

Chat.propTypes = {
   name: PropTypes.string,
 };