Skip to content

Commit bbe1833

Browse files
iKonradgor181
authored andcommitted
React 15: Use PropTypes from a separate package (#34)
* Use PropTypes from a separate package to accommodate changes in React 15 * Use PropTypes from a separate package to accommodate changes in React 15 * Added PropTypes to the dependencies
1 parent 9af2c68 commit bbe1833

8 files changed

+1042
-34
lines changed

dist/react-notification-system-redux.js

Lines changed: 1020 additions & 17 deletions
Large diffs are not rendered by default.

dist/react-notification-system-redux.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/src/components/container.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {PropTypes} from 'react';
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
23
import {connect} from 'react-redux';
34
import ReactDOM from 'react-dom';
45

lib/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ var _const = require('./const');
2929
// }
3030

3131
function show() {
32-
var opts = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
33-
var level = arguments.length <= 1 || arguments[1] === undefined ? 'success' : arguments[1];
32+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
33+
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'success';
3434

3535
return _extends({
3636
type: _const.RNS_SHOW_NOTIFICATION

lib/notifications.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ var _react = require('react');
66

77
var _react2 = _interopRequireDefault(_react);
88

9+
var _propTypes = require('prop-types');
10+
11+
var _propTypes2 = _interopRequireDefault(_propTypes);
12+
913
var _actions = require('./actions');
1014

1115
var actions = _interopRequireWildcard(_actions);
@@ -105,10 +109,9 @@ var Notifications = function (_React$Component) {
105109
key: 'render',
106110
value: function () {
107111
function render() {
108-
var _props = this.props;
109-
var notifications = _props.notifications;
110-
111-
var rest = _objectWithoutProperties(_props, ['notifications']);
112+
var _props = this.props,
113+
notifications = _props.notifications,
114+
rest = _objectWithoutProperties(_props, ['notifications']);
112115

113116
return _react2['default'].createElement(_reactNotificationSystem2['default'], _extends({ ref: 'notify' }, rest));
114117
}
@@ -121,11 +124,11 @@ var Notifications = function (_React$Component) {
121124
}(_react2['default'].Component);
122125

123126
Notifications.propTypes = {
124-
notifications: _react.PropTypes.array
127+
notifications: _propTypes2['default'].array
125128
};
126129

127130
Notifications.contextTypes = {
128-
store: _react.PropTypes.object
131+
store: _propTypes2['default'].object
129132
};
130133

131134
// Tie actions to Notifications component instance

lib/reducer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
1313
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
1414

1515
function Notifications() {
16-
var state = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0];
17-
var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
16+
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17+
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1818

1919
switch (action.type) {
2020
case _const.RNS_SHOW_NOTIFICATION:
21-
var type = action.type;
22-
23-
var rest = _objectWithoutProperties(action, ['type']);
21+
var type = action.type,
22+
rest = _objectWithoutProperties(action, ['type']);
2423

2524
return [].concat(_toConsumableArray(state), [_extends({}, rest, { uid: action.uid })]);
2625
case _const.RNS_HIDE_NOTIFICATION:

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-notification-system-redux",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "react-notification-system-redux",
55
"main": "lib/notifications.js",
66
"author": "Goran Udosic",
@@ -44,6 +44,7 @@
4444
"sinon": "^1.17.6"
4545
},
4646
"dependencies": {
47+
"prop-types": "^15.5.8",
4748
"react-notification-system": "^0.2.x"
4849
},
4950
"peerDependencies": {

src/notifications.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, {PropTypes} from 'react';
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
23

34
import * as actions from './actions';
45
import reducer from './reducer';

0 commit comments

Comments
 (0)