Skip to content

Commit c96bef6

Browse files
Calyhretimdorr
authored andcommitted
[4.x] Fix deprecation warnings for react >= 15.5.0 (#666)
* Handle React.PropTypes deprecations * Handle React.createClass deprecation * Handle react-addons-test-utils deprecations
1 parent 064d527 commit c96bef6

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

package.json

+5-4
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,19 @@
8181
"istanbul": "^0.3.17",
8282
"jsdom": "~5.4.3",
8383
"mocha": "^2.2.5",
84-
"react": "^0.14.0",
85-
"react-addons-test-utils": "^0.14.0",
86-
"react-dom": "^0.14.0",
84+
"react": "^15.5.0",
85+
"react-dom": "^15.5.0",
8786
"redux": "^3.0.0",
8887
"rimraf": "^2.3.4",
8988
"webpack": "^1.11.0"
9089
},
9190
"dependencies": {
91+
"create-react-class": "^15.5.1",
9292
"hoist-non-react-statics": "^1.0.3",
9393
"invariant": "^2.0.0",
9494
"lodash": "^4.2.0",
95-
"loose-envify": "^1.1.0"
95+
"loose-envify": "^1.1.0",
96+
"prop-types": "^15.5.4"
9697
},
9798
"peerDependencies": {
9899
"react": "^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0",

src/components/Provider.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Component, PropTypes, Children } from 'react'
1+
import { Component, Children } from 'react'
2+
import PropTypes from 'prop-types'
23
import storeShape from '../utils/storeShape'
34
import warning from '../utils/warning'
45

src/utils/storeShape.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { PropTypes } from 'react'
1+
import PropTypes from 'prop-types'
22

33
export default PropTypes.shape({
44
subscribe: PropTypes.func.isRequired,

test/components/Provider.spec.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import expect from 'expect'
2-
import React, { PropTypes, Component } from 'react'
3-
import TestUtils from 'react-addons-test-utils'
2+
import React, { Component } from 'react'
3+
import PropTypes from 'prop-types'
4+
import TestUtils from 'react-dom/test-utils'
45
import { createStore } from 'redux'
56
import { Provider } from '../../src/index'
67

@@ -34,14 +35,14 @@ describe('React', () => {
3435
expect(() => TestUtils.renderIntoDocument(
3536
<Provider store={store}>
3637
</Provider>
37-
)).toThrow(/exactly one child/)
38+
)).toThrow(/a single React element/)
3839

3940
expect(() => TestUtils.renderIntoDocument(
4041
<Provider store={store}>
4142
<div />
4243
<div />
4344
</Provider>
44-
)).toThrow(/exactly one child/)
45+
)).toThrow(/a single React element/)
4546
} finally {
4647
Provider.propTypes = propTypes
4748
}

test/components/connect.spec.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import expect from 'expect'
2-
import React, { createClass, Children, PropTypes, Component } from 'react'
2+
import React, { Children, Component } from 'react'
3+
import createClass from 'create-react-class'
4+
import PropTypes from 'prop-types'
35
import ReactDOM from 'react-dom'
4-
import TestUtils from 'react-addons-test-utils'
6+
import TestUtils from 'react-dom/test-utils'
57
import { createStore } from 'redux'
68
import { connect } from '../../src/index'
79

810
describe('React', () => {
911
describe('connect', () => {
1012
class Passthrough extends Component {
1113
render() {
12-
return <div {...this.props} />
14+
return <div />
1315
}
1416
}
1517

@@ -1381,7 +1383,7 @@ describe('React', () => {
13811383
}
13821384

13831385
ImpureComponent.contextTypes = {
1384-
statefulValue: React.PropTypes.number
1386+
statefulValue: PropTypes.number
13851387
}
13861388

13871389
const decorator = connect(state => state, null, null, { pure: false })
@@ -1405,7 +1407,7 @@ describe('React', () => {
14051407
}
14061408

14071409
StatefulWrapper.childContextTypes = {
1408-
statefulValue: React.PropTypes.number
1410+
statefulValue: PropTypes.number
14091411
}
14101412

14111413
const tree = TestUtils.renderIntoDocument(
@@ -1727,7 +1729,7 @@ describe('React', () => {
17271729
updatedCount++
17281730
}
17291731
render() {
1730-
return <div {...this.props} />
1732+
return <div />
17311733
}
17321734
}
17331735

0 commit comments

Comments
 (0)