Skip to content

Commit

Permalink
Fix PropTypes warnings for React 15.5
Browse files Browse the repository at this point in the history
  • Loading branch information
hesselbom committed Apr 18, 2017
1 parent 0b49d36 commit 2cfd74a
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
8 changes: 6 additions & 2 deletions lib/provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactRedux = require('react-redux');

var _utils = require('./utils');
Expand All @@ -30,7 +34,7 @@ var IntlProvider = function (_React$Component) {
function IntlProvider(props) {
_classCallCheck(this, IntlProvider);

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(IntlProvider).call(this, props));
var _this = _possibleConstructorReturn(this, (IntlProvider.__proto__ || Object.getPrototypeOf(IntlProvider)).call(this, props));

_this.translate = function (key, placeholders, isHTML) {
var result = (0, _utils.translateKey)(key, _this.props.translations[_this.props.locale]['messages']);
Expand Down Expand Up @@ -65,7 +69,7 @@ var IntlProvider = function (_React$Component) {
}(_react2.default.Component);

IntlProvider.childContextTypes = {
translate: _react2.default.PropTypes.func
translate: _propTypes2.default.func
};


Expand Down
2 changes: 1 addition & 1 deletion lib/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

exports.default = function () {
var state = arguments.length <= 0 || arguments[0] === undefined ? initialState : arguments[0];
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
var action = arguments[1];

switch (action.type) {
Expand Down
6 changes: 5 additions & 1 deletion lib/withTranslate.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _hoistNonReactStatics = require('hoist-non-react-statics');

var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
Expand All @@ -26,7 +30,7 @@ exports.default = function (WrappedComponent) {
};
WithTranslate.displayName = 'withTranslate(' + getComponentDisplayName(WrappedComponent) + ')';
WithTranslate.contextTypes = {
translate: _react2.default.PropTypes.func
translate: _propTypes2.default.func
};
return (0, _hoistNonReactStatics2.default)(WithTranslate, WrappedComponent);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-redux-multilingual",
"version": "1.0.2",
"version": "1.0.3",
"description": "A simple multilingual translate component and HOC for react and redux",
"main": "lib/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/provider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Children } from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { supplant, translateKey, createHTMLMarkup } from './utils'

Expand All @@ -11,7 +12,7 @@ class IntlProvider extends React.Component {
}
}
static childContextTypes = {
translate: React.PropTypes.func
translate: PropTypes.func
};
translate = (key, placeholders, isHTML) => {
let result = translateKey(key, this.props.translations[this.props.locale]['messages'])
Expand Down
3 changes: 2 additions & 1 deletion src/withTranslate.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import PropTypes from 'prop-types'
import hoistNonReactStatics from 'hoist-non-react-statics'

const getComponentDisplayName = (WrappedComponent) => {
Expand All @@ -11,7 +12,7 @@ export default (WrappedComponent) => {
}
WithTranslate.displayName = `withTranslate(${getComponentDisplayName(WrappedComponent)})`
WithTranslate.contextTypes = {
translate: React.PropTypes.func
translate: PropTypes.func
}
return hoistNonReactStatics(WithTranslate, WrappedComponent)
}

0 comments on commit 2cfd74a

Please sign in to comment.