react-redux-toastr
Advanced tools
Comparing version 3.3.1 to 3.4.0
@@ -53,2 +53,4 @@ 'use strict'; | ||
_this.transitionOut = options.transitionOut || _config2.default.transitionOut; | ||
console.log(_this.props); | ||
return _this; | ||
@@ -104,6 +106,7 @@ } | ||
}, | ||
className: (0, _classnames2.default)('toastr', 'animated', this.props.item.type, this.props.item.options.icon), | ||
className: (0, _classnames2.default)('toastr', 'animated', this.props.item.type, this.props.item.options.icon, this.props.item.options.className), | ||
onMouseEnter: this.mouseEnter.bind(this), | ||
onMouseLeave: this.mouseLeave.bind(this), | ||
onClick: this.handleClick.bind(this) }, | ||
onClick: this.handleClick.bind(this) | ||
}, | ||
_react2.default.createElement( | ||
@@ -198,7 +201,13 @@ 'div', | ||
this._renderSubComponent = function (SubComponent) { | ||
// If SubComponent is already a valid React element, just render it. | ||
if ((0, _react.isValidElement)(SubComponent)) return SubComponent; | ||
var removeCurrentToastrFunc = function removeCurrentToastrFunc() { | ||
return _this3.props.remove(_this3.props.item.id); | ||
}; | ||
// If SubComponent is a class reference, create a React element from it | ||
return _react2.default.createElement(SubComponent, null); | ||
if ((0, _react.isValidElement)(SubComponent)) { | ||
return _react2.default.cloneElement(SubComponent, { | ||
remove: removeCurrentToastrFunc | ||
}); | ||
} | ||
return _react2.default.createElement(SubComponent, { remove: removeCurrentToastrFunc }); | ||
}; | ||
@@ -205,0 +214,0 @@ }; |
{ | ||
"name": "react-redux-toastr", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "react-redux-toastr is a React toastr message implemented with Redux", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -101,3 +101,3 @@ ##`react-redux-toastr` [demo](http://diegoddox.github.io/react-redux-toastr/) | ||
Each of these methods can take up to three arguments the `title` a `message` and `options`. | ||
In `options` you can specify the `timeout` `icon` `onShowComplete` `onHideComplete` and `component`. | ||
In `options` you can specify the `timeOut` `icon` `onShowComplete` `onHideComplete` `className` and `component`. | ||
@@ -116,7 +116,7 @@ `icon` can be one of the following: | ||
const toastrOptions = { | ||
timeOut: 3000, | ||
timeOut: 3000, // by setting to 0 it will prevent the auto close | ||
icon: 'my-icon-name', | ||
onShowComplete: () => console.log('SHOW: animation is done'), | ||
onHideComplete: () => console.log('HIDE: animation is done'), | ||
component: ( | ||
component: ( // this option will give you a func 'remove' as props | ||
<MyCustomComponent myProp="myValue"> | ||
@@ -123,0 +123,0 @@ <span>Hello, World!</span> |
@@ -22,2 +22,4 @@ import CSSCore from 'fbjs/lib/CSSCore'; | ||
this.transitionOut = options.transitionOut || config.transitionOut; | ||
console.log(this.props); | ||
} | ||
@@ -114,8 +116,12 @@ | ||
_renderSubComponent = (SubComponent) => { | ||
// If SubComponent is already a valid React element, just render it. | ||
if (isValidElement(SubComponent)) return SubComponent; | ||
const removeCurrentToastrFunc = () => this.props.remove(this.props.item.id); | ||
// If SubComponent is a class reference, create a React element from it | ||
if (isValidElement(SubComponent)) { | ||
return React.cloneElement(SubComponent, { | ||
remove: removeCurrentToastrFunc | ||
}); | ||
} | ||
return ( | ||
<SubComponent /> | ||
<SubComponent remove={removeCurrentToastrFunc}/> | ||
); | ||
@@ -128,6 +134,7 @@ }; | ||
ref={(ref) => this.toastrBox = ref} | ||
className={cn('toastr', 'animated', this.props.item.type, this.props.item.options.icon)} | ||
className={cn('toastr', 'animated', this.props.item.type, this.props.item.options.icon, this.props.item.options.className)} | ||
onMouseEnter={this.mouseEnter.bind(this)} | ||
onMouseLeave={this.mouseLeave.bind(this)} | ||
onClick={this.handleClick.bind(this)}> | ||
onClick={this.handleClick.bind(this)} | ||
> | ||
<div className="message-holder"> | ||
@@ -134,0 +141,0 @@ {this.props.item.title && <div className="title">{this.props.item.title}</div>} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93160
1681