Skip to content

Commit

Permalink
[4.x] Fix deprecation warnings for react >= 15.5.0 (#666)
Browse files Browse the repository at this point in the history
* Handle React.PropTypes deprecations

* Handle React.createClass deprecation

* Handle react-addons-test-utils deprecations
  • Loading branch information
Calyhre authored and timdorr committed Apr 11, 2017
1 parent 064d527 commit c96bef6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 16 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,19 @@
"istanbul": "^0.3.17",
"jsdom": "~5.4.3",
"mocha": "^2.2.5",
"react": "^0.14.0",
"react-addons-test-utils": "^0.14.0",
"react-dom": "^0.14.0",
"react": "^15.5.0",
"react-dom": "^15.5.0",
"redux": "^3.0.0",
"rimraf": "^2.3.4",
"webpack": "^1.11.0"
},
"dependencies": {
"create-react-class": "^15.5.1",
"hoist-non-react-statics": "^1.0.3",
"invariant": "^2.0.0",
"lodash": "^4.2.0",
"loose-envify": "^1.1.0"
"loose-envify": "^1.1.0",
"prop-types": "^15.5.4"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/Provider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Component, PropTypes, Children } from 'react'
import { Component, Children } from 'react'
import PropTypes from 'prop-types'
import storeShape from '../utils/storeShape'
import warning from '../utils/warning'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/storeShape.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PropTypes } from 'react'
import PropTypes from 'prop-types'

export default PropTypes.shape({
subscribe: PropTypes.func.isRequired,
Expand Down
9 changes: 5 additions & 4 deletions test/components/Provider.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import expect from 'expect'
import React, { PropTypes, Component } from 'react'
import TestUtils from 'react-addons-test-utils'
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import TestUtils from 'react-dom/test-utils'
import { createStore } from 'redux'
import { Provider } from '../../src/index'

Expand Down Expand Up @@ -34,14 +35,14 @@ describe('React', () => {
expect(() => TestUtils.renderIntoDocument(
<Provider store={store}>
</Provider>
)).toThrow(/exactly one child/)
)).toThrow(/a single React element/)

expect(() => TestUtils.renderIntoDocument(
<Provider store={store}>
<div />
<div />
</Provider>
)).toThrow(/exactly one child/)
)).toThrow(/a single React element/)
} finally {
Provider.propTypes = propTypes
}
Expand Down
14 changes: 8 additions & 6 deletions test/components/connect.spec.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import expect from 'expect'
import React, { createClass, Children, PropTypes, Component } from 'react'
import React, { Children, Component } from 'react'
import createClass from 'create-react-class'
import PropTypes from 'prop-types'
import ReactDOM from 'react-dom'
import TestUtils from 'react-addons-test-utils'
import TestUtils from 'react-dom/test-utils'
import { createStore } from 'redux'
import { connect } from '../../src/index'

describe('React', () => {
describe('connect', () => {
class Passthrough extends Component {
render() {
return <div {...this.props} />
return <div />
}
}

Expand Down Expand Up @@ -1381,7 +1383,7 @@ describe('React', () => {
}

ImpureComponent.contextTypes = {
statefulValue: React.PropTypes.number
statefulValue: PropTypes.number
}

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

StatefulWrapper.childContextTypes = {
statefulValue: React.PropTypes.number
statefulValue: PropTypes.number
}

const tree = TestUtils.renderIntoDocument(
Expand Down Expand Up @@ -1727,7 +1729,7 @@ describe('React', () => {
updatedCount++
}
render() {
return <div {...this.props} />
return <div />
}
}

Expand Down

0 comments on commit c96bef6

Please sign in to comment.