diff --git a/examples/handleVisibleChange.js b/examples/handleVisibleChange.js
index 9ad5ae2..1c2faf3 100644
--- a/examples/handleVisibleChange.js
+++ b/examples/handleVisibleChange.js
@@ -15,7 +15,15 @@ var Test = React.createClass({
visible: visible
});
},
+ handleDestroy(){
+ this.setState({
+ destroy:true
+ });
+ },
render() {
+ if(this.state.destroy){
+ return null;
+ }
return
;
}
});
diff --git a/package.json b/package.json
index d049b99..e84e523 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "rc-tooltip",
- "version": "2.2.0",
+ "version": "2.2.1",
"description": "tooltip ui component for react",
"keywords": [
"react",
diff --git a/src/Tooltip.jsx b/src/Tooltip.jsx
index 5b1cb41..3414b28 100644
--- a/src/Tooltip.jsx
+++ b/src/Tooltip.jsx
@@ -106,6 +106,14 @@ class Tooltip extends React.Component {
}
}
+ componentWillUnmount() {
+ if (this.tipContainer) {
+ React.unmountComponentAtNode(this.tipContainer);
+ document.body.removeChild(this.tipContainer);
+ this.tipContainer = null;
+ }
+ }
+
render() {
if (this.state.visible) {
this.popupRendered = true;