summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFrancesco <firefelix@gmail.com>2015-06-10 10:28:02 +0200
committerFrancesco <firefelix@gmail.com>2015-06-10 10:30:00 +0200
commit4ce236995fc6bce4956e8316ddb824444fcada64 (patch)
tree44bd350366113f759fd241fa44f830e18f10c98f /lib
parenta54e39b4db5f845841f1258b7398f24d0b1b8117 (diff)
downloadreact-autosize-textarea-0.1.1.zip
react-autosize-textarea-0.1.1.tar.gz
react-autosize-textarea-0.1.1.tar.bz2
removing event listener in componentWillUnmount. Fix #2v0.1.1
Diffstat (limited to 'lib')
-rw-r--r--lib/TextareaAutosize.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/TextareaAutosize.js b/lib/TextareaAutosize.js
index c7a68df..f4ab8ff 100644
--- a/lib/TextareaAutosize.js
+++ b/lib/TextareaAutosize.js
@@ -22,6 +22,12 @@ const TextareaAutosize = React.createClass({
}
},
+ componentWillUnmount() {
+ if (this.props.onResize) {
+ this.refs.textarea.getDOMNode().removeEventListener('autosize:resized');
+ }
+ },
+
render() {
return (
<textarea {...this.props} ref='textarea'>