react-portal
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -13,2 +13,6 @@ var React = require('react'); | ||
onClose: function() { | ||
console.log('Portal closed'); | ||
}, | ||
render: function() { | ||
@@ -41,3 +45,3 @@ var button1 = <button>Open portal with pseudo modal</button>; | ||
<Portal closeOnOutsideClick={true} openByClickOn={button2}> | ||
<Portal closeOnOutsideClick={true} openByClickOn={button2} onClose={this.onClose}> | ||
<div style={{border: '1px solid black', margin: 10, padding: 10}}> | ||
@@ -44,0 +48,0 @@ <p>Click anywhere outside of this portal to close it.</p> |
@@ -94,2 +94,6 @@ import React, {findDOMNode} from 'react'; | ||
this.setState({active: false}); | ||
if (this.props.onClose) { | ||
this.props.onClose(); | ||
} | ||
} | ||
@@ -118,3 +122,4 @@ | ||
closeOnOutsideClick: React.PropTypes.bool, | ||
isOpened: React.PropTypes.bool | ||
isOpened: React.PropTypes.bool, | ||
onClose: React.PropTypes.func | ||
}; | ||
@@ -121,0 +126,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"author": "Vojtech Miksu", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"license": "MIT", | ||
@@ -9,0 +9,0 @@ "repository": { |
@@ -131,2 +131,6 @@ 'use strict'; | ||
this.setState({ active: false }); | ||
if (this.props.onClose) { | ||
this.props.onClose(); | ||
} | ||
} | ||
@@ -165,3 +169,4 @@ }, { | ||
closeOnOutsideClick: _React$findDOMNode2['default'].PropTypes.bool, | ||
isOpened: _React$findDOMNode2['default'].PropTypes.bool | ||
isOpened: _React$findDOMNode2['default'].PropTypes.bool, | ||
onClose: _React$findDOMNode2['default'].PropTypes.func | ||
}; | ||
@@ -168,0 +173,0 @@ |
@@ -89,2 +89,5 @@ React-portal | ||
#### onClose: func (optional) | ||
This callback is called when the portal closes. | ||
## Tips & Tricks | ||
@@ -123,2 +126,3 @@ - Does your modal have a fullscreen overlay and the `closeOnOutsideClick` doesn't work? [There is a simple solution](https://github.com/tajo/react-portal/issues/2#issuecomment-92058826). | ||
npm install | ||
npm install react | ||
gulp | ||
@@ -125,0 +129,0 @@ ``` |
Sorry, the diff of this file is too big to display
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
1698135
22324
137