Skip to content

Commit

Permalink
React 15: Use PropTypes from a separate package (#34)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
iKonrad authored and gor181 committed May 4, 2017
1 parent 9af2c68 commit bbe1833
Show file tree
Hide file tree
Showing 8 changed files with 1,042 additions and 34 deletions.
1,037 changes: 1,020 additions & 17 deletions dist/react-notification-system-redux.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-notification-system-redux.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion example/src/components/container.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import {connect} from 'react-redux';
import ReactDOM from 'react-dom';

Expand Down
4 changes: 2 additions & 2 deletions lib/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ var _const = require('./const');
// }

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

return _extends({
type: _const.RNS_SHOW_NOTIFICATION
Expand Down
15 changes: 9 additions & 6 deletions lib/notifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ var _react = require('react');

var _react2 = _interopRequireDefault(_react);

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

var _propTypes2 = _interopRequireDefault(_propTypes);

var _actions = require('./actions');

var actions = _interopRequireWildcard(_actions);
Expand Down Expand Up @@ -105,10 +109,9 @@ var Notifications = function (_React$Component) {
key: 'render',
value: function () {
function render() {
var _props = this.props;
var notifications = _props.notifications;

var rest = _objectWithoutProperties(_props, ['notifications']);
var _props = this.props,
notifications = _props.notifications,
rest = _objectWithoutProperties(_props, ['notifications']);

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

Notifications.propTypes = {
notifications: _react.PropTypes.array
notifications: _propTypes2['default'].array
};

Notifications.contextTypes = {
store: _react.PropTypes.object
store: _propTypes2['default'].object
};

// Tie actions to Notifications component instance
Expand Down
9 changes: 4 additions & 5 deletions lib/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr
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; }

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

switch (action.type) {
case _const.RNS_SHOW_NOTIFICATION:
var type = action.type;

var rest = _objectWithoutProperties(action, ['type']);
var type = action.type,
rest = _objectWithoutProperties(action, ['type']);

return [].concat(_toConsumableArray(state), [_extends({}, rest, { uid: action.uid })]);
case _const.RNS_HIDE_NOTIFICATION:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-notification-system-redux",
"version": "1.1.1",
"version": "1.1.2",
"description": "react-notification-system-redux",
"main": "lib/notifications.js",
"author": "Goran Udosic",
Expand Down Expand Up @@ -44,6 +44,7 @@
"sinon": "^1.17.6"
},
"dependencies": {
"prop-types": "^15.5.8",
"react-notification-system": "^0.2.x"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion src/notifications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {PropTypes} from 'react';
import React from 'react';
import PropTypes from 'prop-types';

import * as actions from './actions';
import reducer from './reducer';
Expand Down

0 comments on commit bbe1833

Please sign in to comment.