diff options
author | JoramWilander <jwawilander@gmail.com> | 2015-09-04 09:26:15 -0400 |
---|---|---|
committer | JoramWilander <jwawilander@gmail.com> | 2015-09-04 09:26:15 -0400 |
commit | 9f7084611d8f1147ac19a14a6a61c2d1a8ef0a97 (patch) | |
tree | 4eec24207d875c3da3137760e6d14c67bb0c2ae5 /web/react/components | |
parent | 1b923528448eace438a1f498116a19361a8b0fb2 (diff) | |
download | chat-9f7084611d8f1147ac19a14a6a61c2d1a8ef0a97.tar.gz chat-9f7084611d8f1147ac19a14a6a61c2d1a8ef0a97.tar.bz2 chat-9f7084611d8f1147ac19a14a6a61c2d1a8ef0a97.zip |
Make onHeightChange not required.
Diffstat (limited to 'web/react/components')
-rw-r--r-- | web/react/components/textbox.jsx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web/react/components/textbox.jsx b/web/react/components/textbox.jsx index b4518fe80..ea8126bec 100644 --- a/web/react/components/textbox.jsx +++ b/web/react/components/textbox.jsx @@ -242,7 +242,7 @@ export default class Textbox extends React.Component { const e = React.findDOMNode(this.refs.message); const w = React.findDOMNode(this.refs.wrapper); - let prevHeight = $(e).height(); + const prevHeight = $(e).height(); const lht = parseInt($(e).css('lineHeight'), 10); const lines = e.scrollHeight / lht; @@ -260,7 +260,7 @@ export default class Textbox extends React.Component { $(w).css({height: 'auto'}).height(167); } - if (prevHeight !== $(e).height()) { + if (prevHeight !== $(e).height() && this.props.onHeightChange) { this.props.onHeightChange(); } } @@ -320,6 +320,6 @@ Textbox.propTypes = { messageText: React.PropTypes.string.isRequired, onUserInput: React.PropTypes.func.isRequired, onKeyPress: React.PropTypes.func.isRequired, - onHeightChange: React.PropTypes.func.isRequired, + onHeightChange: React.PropTypes.func, createMessage: React.PropTypes.string.isRequired }; |