Skip to content

Commit

Permalink
Use react-lifecycles-compat polyfill (#4079)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikras committed Jun 15, 2018
1 parent 6a5aa7c commit 07d07a0
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 1 deletion.
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"is-promise": "^2.1.0",
"lodash": "^4.17.10",
"lodash-es": "^4.17.10",
"prop-types": "^15.6.1"
"prop-types": "^15.6.1",
"react-lifecycles-compat": "^3.0.4"
},
"devDependencies": {
"babel-cli": "^6.26.0",
Expand Down
2 changes: 2 additions & 0 deletions src/Form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import React, { Component } from 'react'
import { polyfill } from 'react-lifecycles-compat'
import PropTypes from 'prop-types'
import type { ReactContext } from './types'

Expand Down Expand Up @@ -35,4 +36,5 @@ Form.contextTypes = {
_reduxForm: PropTypes.object
}

polyfill(Form)
export default Form
2 changes: 2 additions & 0 deletions src/createField.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import React, { Component, createElement } from 'react'
import { polyfill } from 'react-lifecycles-compat'
import PropTypes from 'prop-types'
import invariant from 'invariant'
import createConnectedField from './ConnectedField'
Expand Down Expand Up @@ -155,6 +156,7 @@ const createField = (structure: Structure<*, *>) => {
_reduxForm: PropTypes.object
}

polyfill(Field)
return Field
}

Expand Down
2 changes: 2 additions & 0 deletions src/createFieldArray.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import React, { Component, createElement } from 'react'
import { polyfill } from 'react-lifecycles-compat'
import PropTypes from 'prop-types'
import invariant from 'invariant'
import createConnectedFieldArray from './ConnectedFieldArray'
Expand Down Expand Up @@ -133,6 +134,7 @@ const createFieldArray = (structure: Structure<*, *>) => {
_reduxForm: PropTypes.object
}

polyfill(FieldArray)
return FieldArray
}

Expand Down
2 changes: 2 additions & 0 deletions src/createFields.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import { Component, createElement } from 'react'
import { polyfill } from 'react-lifecycles-compat'
import PropTypes from 'prop-types'
import invariant from 'invariant'
import createConnectedFields from './ConnectedFields'
Expand Down Expand Up @@ -124,6 +125,7 @@ const createFields = (structure: Structure<*, *>) => {
_reduxForm: PropTypes.object
}

polyfill(Fields)
return Fields
}

Expand Down
2 changes: 2 additions & 0 deletions src/createReduxForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow
import * as React from 'react'
import { polyfill } from 'react-lifecycles-compat'
import hoistStatics from 'hoist-non-react-statics'
import invariant from 'invariant'
import isPromise from 'is-promise'
Expand Down Expand Up @@ -1157,6 +1158,7 @@ const createReduxForm = (structure: Structure<*, *>) => {
}
}

polyfill(ReduxForm)
return hoistStatics(ReduxForm, WrappedComponent)
}
}
Expand Down

0 comments on commit 07d07a0

Please sign in to comment.