diff --git a/package.json b/package.json index 788fe7203e..97e01dffca 100644 --- a/package.json +++ b/package.json @@ -99,6 +99,7 @@ "webpack": "3.10.0" }, "dependencies": { - "prop-types": "^15.6.1" + "prop-types": "^15.6.1", + "react-lifecycles-compat": "^3.0.2" } } \ No newline at end of file diff --git a/src/DayPicker.js b/src/DayPicker.js index eaa527c6ae..b688065a3e 100644 --- a/src/DayPicker.js +++ b/src/DayPicker.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import { polyfill } from 'react-lifecycles-compat'; import PropTypes from 'prop-types'; import Caption from './Caption'; @@ -14,7 +15,7 @@ import classNames from './classNames'; import { ENTER, SPACE, LEFT, UP, DOWN, RIGHT } from './keys'; -export default class DayPicker extends Component { +export class _DayPicker extends Component { static VERSION = '7.1.4'; static propTypes = { @@ -575,6 +576,10 @@ export default class DayPicker extends Component { } } +const DayPicker = polyfill(_DayPicker); + DayPicker.DateUtils = DateUtils; DayPicker.LocaleUtils = LocaleUtils; DayPicker.ModifiersUtils = ModifiersUtils; + +export default DayPicker; diff --git a/src/DayPickerInput.js b/src/DayPickerInput.js index 23093bfe98..c0c49be401 100644 --- a/src/DayPickerInput.js +++ b/src/DayPickerInput.js @@ -1,4 +1,5 @@ import React from 'react'; +import { polyfill } from 'react-lifecycles-compat'; import PropTypes from 'prop-types'; import DayPicker from './DayPicker'; @@ -48,7 +49,7 @@ export function defaultParse(str) { return new Date(year, month, day); } -export default class DayPickerInput extends React.Component { +export class _DayPickerInput extends React.Component { static propTypes = { value: PropTypes.oneOfType([PropTypes.string, PropTypes.instanceOf(Date)]), inputProps: PropTypes.object, @@ -499,3 +500,6 @@ export default class DayPickerInput extends React.Component { ); } } + +const DayPickerInput = polyfill(_DayPickerInput); +export default DayPickerInput; diff --git a/yarn.lock b/yarn.lock index 37b4b548b7..5c814dae29 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4955,6 +4955,10 @@ react-dom@16.2.0: object-assign "^4.1.1" prop-types "^15.6.0" +react-lifecycles-compat@3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.2.tgz#7279047275bd727a912e25f734c0559527e84eff" + react-reconciler@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/react-reconciler/-/react-reconciler-0.7.0.tgz#9614894103e5f138deeeb5eabaf3ee80eb1d026d"