Skip to content

Commit

Permalink
Fix React v15.5.0 new deprecation warnings (ant-design#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
u9lyfish authored and lixiaoyang1992 committed Apr 26, 2018
1 parent 62f9f63 commit 55965c4
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 20 deletions.
3 changes: 2 additions & 1 deletion components/carousel/index.web.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import createReactClass from 'create-react-class';
import classNames from 'classnames';
import ReactCarousel from 'nuka-carousel';
import assign from 'object-assign';
Expand Down Expand Up @@ -46,7 +47,7 @@ export default class Carousel extends React.Component<CarouselProps, any> {
const current = this.state.selectedIndex;
if (props.dots) {
Decorators = [{
component: React.createClass({
component: createReactClass({
render() {
const { slideCount, slidesToScroll } = this.props;
const arr: number[] = [];
Expand Down
3 changes: 2 additions & 1 deletion components/date-picker/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import PopupDatePicker from 'rmc-date-picker/lib/Popup';
import PopupStyles from '../picker/styles';
import { formatFn, getProps as getDefaultProps, getDefaultDate } from './utils';
Expand All @@ -16,7 +17,7 @@ export default class DatePicker extends React.Component<tsPropsType, any> {
}, getDefaultProps());

static contextTypes = {
antLocale: React.PropTypes.object,
antLocale: PropTypes.object,
};

render() {
Expand Down
3 changes: 2 additions & 1 deletion components/date-picker/index.web.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint no-console:0 */
import React from 'react';
import PropTypes from 'prop-types';
import PopupDatePicker from 'rmc-date-picker/lib/Popup';
import RCDatePicker from 'rmc-date-picker/lib/DatePicker';
import { formatFn, getProps, getDefaultDate } from './utils';
Expand All @@ -20,7 +21,7 @@ export default class DatePicker extends React.Component<tsPropsType, any> {
static defaultProps = getDefaultProps();

static contextTypes = {
antLocale: React.PropTypes.object,
antLocale: PropTypes.object,
};

render() {
Expand Down
5 changes: 3 additions & 2 deletions components/locale-provider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';

export interface LocaleProviderProps {
locale: {
Expand All @@ -10,11 +11,11 @@ export interface LocaleProviderProps {

export default class LocaleProvider extends React.Component<LocaleProviderProps, any> {
static propTypes = {
locale: React.PropTypes.object,
locale: PropTypes.object,
};

static childContextTypes = {
antLocale: React.PropTypes.object,
antLocale: PropTypes.object,
};

getChildContext() {
Expand Down
3 changes: 2 additions & 1 deletion components/menu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import createReactClass from 'create-react-class';
import { MenuProps } from './PropsType';

const Menu = React.createClass<MenuProps, any>({
const Menu = createReactClass<MenuProps, any>({
render() {
return <div>TODO for react-native</div>;
},
Expand Down
3 changes: 2 additions & 1 deletion components/nav-bar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import createReactClass from 'create-react-class';
import NavBarProps from './PropsType';

const NavBar = React.createClass<NavBarProps, any>({
const NavBar = createReactClass<NavBarProps, any>({
render() {
return <div>TODO for react-native</div>;
},
Expand Down
3 changes: 2 additions & 1 deletion components/notice-bar/Marquee.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import React from 'react';
import createReactClass from 'create-react-class';
import ReactDOM from 'react-dom';
import assign from 'object-assign';

Expand All @@ -18,7 +19,7 @@ export interface MarqueeProp {
fps?: number;
}

const Marquee = React.createClass<MarqueeProp, any>({
const Marquee = createReactClass<MarqueeProp, any>({
getDefaultProps() {
return {
text: '',
Expand Down
3 changes: 2 additions & 1 deletion components/pagination/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { View, Text } from 'react-native';
import Button from '../button';
import Flex from '../flex';
Expand All @@ -18,7 +19,7 @@ export default class Pagination extends React.Component<PaginationProps, any> {
};

static contextTypes = {
antLocale: React.PropTypes.object,
antLocale: PropTypes.object,
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion components/pagination/index.web.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* tslint:disable:jsx-no-multiline-js */
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import Button from '../button';
import Flex from '../flex';
Expand All @@ -16,7 +17,7 @@ export default class Pagination extends React.Component<PaginationProps, any> {
};

static contextTypes = {
antLocale: React.PropTypes.object,
antLocale: PropTypes.object,
};

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion components/range/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from 'react';
import createReactClass from 'create-react-class';
import RangeProps from './PropsType';

const Range = React.createClass<RangeProps, any>({
const Range = createReactClass<RangeProps, any>({
render() {
return <div>TODO for react-native</div>;
},
Expand Down
3 changes: 2 additions & 1 deletion components/refresh-control/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import createReactClass from 'create-react-class';
import { StyleSheet, View, Text, ScrollView, TouchableWithoutFeedback } from 'react-native';
import { RefreshControl } from 'antd-mobile';

Expand Down Expand Up @@ -36,7 +37,7 @@ class Row extends React.Component<any, any> {
}
}

export default React.createClass({
export default createReactClass({
getInitialState() {
return {
isRefreshing: false,
Expand Down
3 changes: 2 additions & 1 deletion components/search-bar/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import createReactClass from 'create-react-class';
import { View, Alert } from 'react-native';
import { SearchBar } from 'antd-mobile';

export default React.createClass({
export default createReactClass({
getInitialState() {
return {
value: '美食',
Expand Down
3 changes: 2 additions & 1 deletion components/table/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import createReactClass from 'create-react-class';

const Table = React.createClass<any, any>({
const Table = createReactClass<any, any>({
render() {
return <div>TODO for react-native</div>;
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"array-tree-filter": "~1.0.0",
"babel-runtime": "6.x",
"classnames": "~2.2.1",
"create-react-class": "^15.5.2",
"moment": "~2.18.1",
"normalize.css": "^6.0.0",
"nuka-carousel": "~2.0.4",
"object-assign": "~4.1.0",
"omit.js": "~0.1.0",
"prop-types": "^15.5.8",
"rc-checkbox": "~2.0.0",
"rc-collapse": "~1.7.0",
"rc-dialog": "~6.5.7",
Expand Down
3 changes: 2 additions & 1 deletion site/desktop/src/template/Content/ComponentDoc.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import DocumentTitle from 'react-document-title';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
Expand All @@ -10,7 +11,7 @@ import Demo from './Demo';

export default class ComponentDoc extends React.Component {
static contextTypes = {
intl: React.PropTypes.object,
intl: PropTypes.object,
}

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion site/desktop/src/template/Content/Demo.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* eslint react/no-danger: 0 */
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
import { Button, Modal, Radio } from 'antd';

export default class Demo extends React.Component {
static contextTypes = {
intl: React.PropTypes.object,
intl: PropTypes.object,
}

state = {
Expand Down
3 changes: 2 additions & 1 deletion site/desktop/src/template/Content/MainContent.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'bisheng/router';
import Menu from 'antd/lib/menu';
import Row from 'antd/lib/row';
Expand All @@ -11,7 +12,7 @@ const SubMenu = Menu.SubMenu;

export default class MainContent extends React.Component {
static contextTypes = {
intl: React.PropTypes.object.isRequired,
intl: PropTypes.object.isRequired,
}

componentDidMount() {
Expand Down
5 changes: 3 additions & 2 deletions site/desktop/src/template/Layout/Header.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Link } from 'bisheng/router';
import { FormattedMessage } from 'react-intl';
import enquire from 'enquire.js';
Expand All @@ -12,8 +13,8 @@ const Option = Select.Option;

export default class Header extends React.Component {
static contextTypes = {
router: React.PropTypes.object.isRequired,
intl: React.PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
intl: PropTypes.object.isRequired,
}

constructor(props) {
Expand Down
3 changes: 2 additions & 1 deletion site/desktop/src/template/Layout/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { cloneElement } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import { addLocaleData, IntlProvider } from 'react-intl';
import Header from './Header';
Expand All @@ -19,7 +20,7 @@ if (typeof window !== 'undefined') {

export default class Layout extends React.Component {
static contextTypes = {
router: React.PropTypes.object.isRequired,
router: PropTypes.object.isRequired,
};
constructor(props) {
super(props);
Expand Down

0 comments on commit 55965c4

Please sign in to comment.