From 919cb22eb7372f8907e257171f77bbd7abbf6348 Mon Sep 17 00:00:00 2001 From: Tyler Date: Tue, 9 May 2017 13:40:33 +0800 Subject: [PATCH] Use the prop-types package from npm instead of React.PropTypes (#6057) * Use the prop-types package from npm instead of React.PropTypes * Remove using of PropTypes from React in docs and site --- components/badge/index.tsx | 3 ++- components/breadcrumb/BreadcrumbItem.tsx | 2 +- components/calendar/index.tsx | 2 +- components/checkbox/Checkbox.tsx | 3 ++- components/form/Form.tsx | 2 +- components/grid/col.tsx | 2 +- components/locale-provider/injectLocale.tsx | 3 ++- components/progress/progress.tsx | 2 +- components/radio/group.tsx | 3 ++- components/radio/radio.tsx | 3 ++- components/radio/radioButton.tsx | 3 ++- components/rate/index.tsx | 2 +- components/spin/index.tsx | 2 +- components/steps/index.tsx | 2 +- components/switch/index.tsx | 3 ++- components/transfer/index.tsx | 3 ++- docs/react/practical-projects.en-US.md | 3 ++- docs/react/practical-projects.zh-CN.md | 3 ++- site/theme/template/Content/MainContent.jsx | 3 ++- site/theme/template/Layout/Header.jsx | 3 ++- 20 files changed, 32 insertions(+), 20 deletions(-) diff --git a/components/badge/index.tsx b/components/badge/index.tsx index 40d822c9c..885953745 100644 --- a/components/badge/index.tsx +++ b/components/badge/index.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import Animate from 'rc-animate'; import ScrollNumber from './ScrollNumber'; import classNames from 'classnames'; diff --git a/components/breadcrumb/BreadcrumbItem.tsx b/components/breadcrumb/BreadcrumbItem.tsx index e97aaf016..7b3a5ec3a 100644 --- a/components/breadcrumb/BreadcrumbItem.tsx +++ b/components/breadcrumb/BreadcrumbItem.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; export interface BreadcrumbItemProps { prefixCls?: string; diff --git a/components/calendar/index.tsx b/components/calendar/index.tsx index 5d29e16fc..66909be9e 100644 --- a/components/calendar/index.tsx +++ b/components/calendar/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import moment from 'moment'; import FullCalendar from 'rc-calendar/lib/FullCalendar'; import { PREFIX_CLS } from './Constants'; diff --git a/components/checkbox/Checkbox.tsx b/components/checkbox/Checkbox.tsx index 9e6b39616..0d7e58c59 100644 --- a/components/checkbox/Checkbox.tsx +++ b/components/checkbox/Checkbox.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import RcCheckbox from 'rc-checkbox'; import shallowEqual from 'shallowequal'; diff --git a/components/form/Form.tsx b/components/form/Form.tsx index 7136ce4e9..3daa2b445 100755 --- a/components/form/Form.tsx +++ b/components/form/Form.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import createDOMForm from 'rc-form/lib/createDOMForm'; import PureRenderMixin from 'rc-util/lib/PureRenderMixin'; diff --git a/components/grid/col.tsx b/components/grid/col.tsx index cd071dda3..7f9a4cc85 100644 --- a/components/grid/col.tsx +++ b/components/grid/col.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import assign from 'object-assign'; diff --git a/components/locale-provider/injectLocale.tsx b/components/locale-provider/injectLocale.tsx index b3efbe0df..c33982544 100644 --- a/components/locale-provider/injectLocale.tsx +++ b/components/locale-provider/injectLocale.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; export interface ComponentProps { locale?: any; diff --git a/components/progress/progress.tsx b/components/progress/progress.tsx index b9e2689ef..3167902b6 100644 --- a/components/progress/progress.tsx +++ b/components/progress/progress.tsx @@ -1,4 +1,4 @@ -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import React from 'react'; import Icon from '../icon'; import { Circle } from 'rc-progress'; diff --git a/components/radio/group.tsx b/components/radio/group.tsx index fd2104585..50ffa01db 100644 --- a/components/radio/group.tsx +++ b/components/radio/group.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import shallowEqual from 'shallowequal'; import Radio from './radio'; diff --git a/components/radio/radio.tsx b/components/radio/radio.tsx index cec63609f..c369f7cfa 100644 --- a/components/radio/radio.tsx +++ b/components/radio/radio.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import RcRadio from 'rc-radio'; import classNames from 'classnames'; import shallowEqual from 'shallowequal'; diff --git a/components/radio/radioButton.tsx b/components/radio/radioButton.tsx index d7403eac8..f2b95c46c 100644 --- a/components/radio/radioButton.tsx +++ b/components/radio/radioButton.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { AbstractCheckboxProps } from '../checkbox/Checkbox'; import Radio from './radio'; diff --git a/components/rate/index.tsx b/components/rate/index.tsx index 12465c4d0..331c0b5c8 100644 --- a/components/rate/index.tsx +++ b/components/rate/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import RcRate from 'rc-rate'; import Icon from '../icon'; diff --git a/components/spin/index.tsx b/components/spin/index.tsx index f2ed42ad8..6ab46ac12 100644 --- a/components/spin/index.tsx +++ b/components/spin/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import { findDOMNode } from 'react-dom'; import classNames from 'classnames'; import Animate from 'rc-animate'; diff --git a/components/steps/index.tsx b/components/steps/index.tsx index 15279870b..c65a6d288 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { PropTypes } from 'react'; +import PropTypes from 'prop-types'; import RcSteps from 'rc-steps'; export interface StepsProps { diff --git a/components/switch/index.tsx b/components/switch/index.tsx index d329138e3..2c5035070 100755 --- a/components/switch/index.tsx +++ b/components/switch/index.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import RcSwitch from 'rc-switch'; import classNames from 'classnames'; diff --git a/components/transfer/index.tsx b/components/transfer/index.tsx index 53d028ccd..f66566bc8 100644 --- a/components/transfer/index.tsx +++ b/components/transfer/index.tsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import classNames from 'classnames'; import List, { TransferListProps } from './list'; import Operation from './operation'; diff --git a/docs/react/practical-projects.en-US.md b/docs/react/practical-projects.en-US.md index fe7b422b6..38be23a0e 100644 --- a/docs/react/practical-projects.en-US.md +++ b/docs/react/practical-projects.en-US.md @@ -108,7 +108,8 @@ Let's create a `ProductList` component that we can use in multiple places to sho Create `components/ProductList.js` and typing: ```javascript -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { Table, Popconfirm, Button } from 'antd'; const ProductList = ({ onDelete, products }) => { diff --git a/docs/react/practical-projects.zh-CN.md b/docs/react/practical-projects.zh-CN.md index 2d0c9e545..51461e9f7 100644 --- a/docs/react/practical-projects.zh-CN.md +++ b/docs/react/practical-projects.zh-CN.md @@ -108,7 +108,8 @@ export default Products; 新建 `components/ProductList.js` 文件: ```javascript -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { Table, Popconfirm, Button } from 'antd'; const ProductList = ({ onDelete, products }) => { diff --git a/site/theme/template/Content/MainContent.jsx b/site/theme/template/Content/MainContent.jsx index 09ba1f106..7a046d364 100644 --- a/site/theme/template/Content/MainContent.jsx +++ b/site/theme/template/Content/MainContent.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { Link } from 'bisheng/router'; import { Row, Col, Menu, Icon } from 'antd'; import classNames from 'classnames'; diff --git a/site/theme/template/Layout/Header.jsx b/site/theme/template/Layout/Header.jsx index a652bae8c..dbf80bbb5 100644 --- a/site/theme/template/Layout/Header.jsx +++ b/site/theme/template/Layout/Header.jsx @@ -1,4 +1,5 @@ -import React, { PropTypes } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import { Link } from 'bisheng/router'; import { FormattedMessage } from 'react-intl'; import classNames from 'classnames';